////////////////////////////////////////////////////////////////////////////// // openslideshow.js - Implement openslideshow feature for WST Photo Album plugin // --------------------------------------------------------------------------- // JAR 2006.06.20: Moved from C# code, clean up, fix bugs, and document. ////////////////////////////////////////////////////////////////////////////// /****************************** IMMEDIATE CODE ******************************/ //------------------------------------------ // Configure constants for slideshow applet //------------------------------------------ _slideShowURL = "plugins/albums/slideshow/slideshow.html"; _ssWinWdFudge = 112; _ssWinHtFudge = 220; _screenFudge = 40; _minWinWd = 440; _minWinHt = 360; //----------------------------------------------- // Create slides array for recording slides data //----------------------------------------------- _slides = new Array(); //------------------------------ // Init album and image indexes //------------------------------ _currentSlideGroup = 0; // Which album on a page? _currentSlideIndex = 0; // Which image in album? _windowHeight = 0; // Height of window (calculated in openSlideShow()) /***************************** PUBLIC FUNCTIONS *****************************/ //------------------------------------------ // Generic function to return URL parameter //------------------------------------------ function getURLParam(sParam) { var sRet="", sHref=window.location.href; if (sHref.indexOf("?") > -1 ) { var sQueryString = sHref.substr(sHref.indexOf("?") + 1); var aQueryString = sQueryString.split("&"); for (var i=0; i 0) { activeAlbum = parseInt(activeAlbum,10); var albumNavName = "album" + activeAlbum + "_nav"; var albumNav = document.getElementById(albumNavName); if (albumNav) window.location.replace("#" + albumNavName); } } //-------------------------------------------------------------------------- // Opens a new window with the selected album/image in the slideshow applet //-------------------------------------------------------------------------- function openSlideShow(imageGroup,initialIndex) { // Set selected album/slide variables: _currentSlideGroup = imageGroup; _currentSlideIndex = initialIndex; // Find max image dims: var i, album=_slides[_currentSlideGroup], maxWd=0, maxHt=0; for (i=0; i0 || extraHt>0) { // See which of width or height is most offensive and adjust accordingly: var squash = (extraWd > extraHt ? (winWidth-_ssWinWdFudge) / slideWd : (winHeight-_ssWinHtFudge) / slideHt); album[i].slideWd *= squash; album[i].slideHt *= squash; } } // Set this variable for slideshow use: _windowHeight = winHeight; // Open slideshow window/url: var slideWindow = window.open(_slideShowURL,"wst_slideshow", "scrollbars=yes,titlebar=no,location=no,status=no,toolbar=no,resizable=yes,width=" + winWidth + ",height=" + winHeight); slideWindow.focus(); } /* end of file */