Slideshow control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//initialize SlideshowObject control | |
function createSlideControl(slidecontrolId) | |
{ | |
loadPicturesInfo(function(picEntries) { | |
var slidecontrol_slideshowObject = new SlideshowObject(slidecontrolId, picEntries.src, picEntries.fullImageSrc, picEntries.title, picEntries.description, picEntries.height, picEntries.width, 15, 1.0); | |
ChangePic(slidecontrol_slideshowObject); | |
InitSlideControlNavButtons(slidecontrol_slideshowObject); | |
}); | |
} | |
// | |
function InitSlideControlNavButtons(slideshowObject) { | |
var btn_prev = document.getElementById("btn_prev"); | |
AddEvtHandler(btn_prev, "onclick", function() { NextPrevious(slideshowObject, false);}); | |
var btn_pp = document.getElementById("btn_pp"); | |
AddEvtHandler(btn_pp, "onclick", function() { PlayPause(slideshowObject);}); | |
var btn_next = document.getElementById("btn_next"); | |
AddEvtHandler(btn_next, "onclick", function() { NextPrevious(slideshowObject, true);}); | |
} | |
//retrieve picture entries for SlideObject control | |
function loadPicturesInfo(cbPicsResults) { | |
var context = new SP.ClientContext.get_current(); | |
var web = context.get_web(); | |
var list = web.get_lists().getByTitle(ctx.ListTitle); | |
var viewXml = '<View></View>'; | |
var query = new SP.CamlQuery(); | |
query.set_viewXml(viewXml); | |
var items = list.getItems(query); | |
context.load(items,"Include(Title,EncodedAbsWebImgUrl,EncodedAbsUrl,ImageWidth,ImageHeight)"); | |
context.add_requestSucceeded(onLoaded); | |
context.add_requestFailed(onFailure); | |
context.executeQueryAsync(); | |
function onLoaded() { | |
var widthArray = []; | |
var heightArray = []; | |
var pictureArray = []; | |
var linkArray = []; | |
var titleArray = []; | |
var descriptionArray = []; | |
var itemsCount = items.get_count(); | |
for (i = 0; i < itemsCount; i++) { | |
var item = items.itemAt(i); | |
var picEntry = item.get_fieldValues(); | |
titleArray.push(picEntry.Title); | |
pictureArray.push(picEntry.EncodedAbsWebImgUrl); | |
linkArray.push(picEntry.EncodedAbsUrl); | |
descriptionArray.push(''); | |
widthArray.push(picEntry.ImageWidth); | |
heightArray.push(picEntry.ImageHeight); | |
} | |
picEntries = {title:titleArray,description:descriptionArray,fullImageSrc: linkArray,src:pictureArray, width:widthArray,height:heightArray}; | |
cbPicsResults(picEntries); | |
} | |
function onFailure() { | |
cbPicsResults(null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment