
META-INF.resources.image_gallery_display.view_slide_show.jsp Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/image_gallery_display/init.jsp" %>
<%
Folder folder = (Folder)request.getAttribute(WebKeys.DOCUMENT_LIBRARY_FOLDER);
long folderId = (folder == null) ? 0 : folder.getFolderId();
long repositoryId = scopeGroupId;
if (folder != null) {
repositoryId = folder.getRepositoryId();
}
List fileEntries = DLAppServiceUtil.getFileEntries(repositoryId, folderId);
int defaultSpeed = 3000;
%>
<%
for (int i = 1; i <= 10; i++) {
%>
<%
}
%>
<%
if (!fileEntries.isEmpty()) {
FileEntry fileEntry = (FileEntry)fileEntries.get(0);
String largeSrc = DLUtil.getPreviewURL(fileEntry, fileEntry.getFileVersion(), themeDisplay, StringPool.BLANK);
%>
" key="slide-show" />" name=" slideShow" src="<%= largeSrc %>" />
<%
}
%>
var imgArray = [];
<%
for (int i = 0; i < fileEntries.size(); i++) {
FileEntry fileEntry = (FileEntry)fileEntries.get(i);
String largeSrc = DLUtil.getPreviewURL(fileEntry, fileEntry.getFileVersion(), themeDisplay, StringPool.BLANK);
%>
imgArray[<%= i %>] = '<%= largeSrc %>';
<%
}
%>
var imgArrayPos = 0;
var speed = <%= defaultSpeed %>;
var timeout = 0;
function pause() {
clearInterval( timeout);
timeout = 0;
}
function play() {
if ( timeout == 0) {
timeout = setInterval( showNext, speed);
}
}
function showNext() {
imgArrayPos++;
if ( imgArrayPos == imgArray.length) {
imgArrayPos = 0;
}
document.images. slideShow.src = imgArray[ imgArrayPos];
}
function showPrevious() {
imgArrayPos--;
if ( imgArrayPos < 0) {
imgArrayPos = imgArray.length - 1;
}
document.images. slideShow.src = imgArray[ imgArrayPos];
}
play();
© 2015 - 2025 Weber Informatics LLC | Privacy Policy