META-INF.resources.view.jsp Maven / Gradle / Ivy
<%--
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
--%>
<%@ include file="/init.jsp" %>
" key="youtube-video" />" height="<%= youTubeDisplayContext.getHeight() %>" src="<%= youTubeDisplayContext.getImageURL() %>" width="<%= youTubeDisplayContext.getWidth() %>" />
function resizeIFrame() {
var iframe = document.getElementById(' iframe');
if (iframe != null) {
var displayContextWidth = <%= youTubeDisplayContext.getWidth() %>;
var parentWidth = iframe.parentElement.offsetWidth;
if (displayContextWidth > parentWidth) {
displayContextWidth = parentWidth;
}
iframe.setAttribute('height', <%= youTubeDisplayContext.getHeight() %>);
iframe.setAttribute('width', displayContextWidth);
}
}
Liferay.provide(
window,
' addDragAndDropListener',
function () {
if (!Liferay.Layout) {
setTimeout(function () {
addDragAndDropListener();
}, 5000);
}
else {
Liferay.Layout.on(['drag:end', 'drag:start'], function () {
AUI().debounce( resizeIFrame(), 500);
});
}
},
['aui-debounce']
);
Liferay.on('allPortletsReady', function () {
addDragAndDropListener();
});
Liferay.on('portletReady', function () {
resizeIFrame();
});
A.on('windowresize', function () {
resizeIFrame();
});