var jv2ajax = false; var jv2includemode = true; var jv2includeGalleryUrl = 'http://margodavisphoto.com/Europe/Europe.php'; var jv2includeGalleryIndexUrl = 'http://margodavisphoto.com/Europe/gallery/'; var jv2includeModeAjaxUrl = ''; var jv2imgHoverOpacity = true; (function($) { $.fn.galleryViewer = function(setup) { var imgArr = new Array(); setup = jQuery.extend({ ajax:false, includemode:true, includeGalleryUrl:'http://margodavisphoto.com/Europe/Europe.php', includeGalleryIndexUrl:'http://margodavisphoto.com/Europe/gallery/', galleryfolder:'gallery/', overlayBgColor:'#000', overlayOpacity:0.7, imageBtnSlideShow:'gallery/?img=play', imageBtnSlideShowPause:'gallery/?img=pause', imageBtnClose:'gallery/?img=close', imageBlank:'gallery/?img=blank', imageGet:'gallery/?img=', containerBorderSize:10, containerResizeSpeed:400, viewerLoop:false, slideshow:true, slideshowAutoStart:false, slideShowDuration:6000, imageInfo:false, imageInfoLink:'gallery/?info=', shareEnabled:false, shareFacebook:false, shareGoogleplus:false, shareTwitter:false, shareLinkedIn:false, shareStumbleupon:false, sharePinterest:false, customShare:false, shareLink:'gallery/?share=', showDownloadLink:false, downloadOptions:false, openInNewTab:false, downloadLink:'gallery/?download=', showPrintLink:false, txtDownload:'Download', txtPrint:'Print', txtImageInfo:'Image info', txtImageInfoHide:'Hide info', txtShare:'Share this', txtShareHide:'Hide sharing', txtAuthor:'by', txtImage:'Image', txtOf:'of', disqus_enabled:false, imageArray:imgArr, currentImage:0, folder:'', folderPath:'' },setup); var dimensions = jQuery.extend({ pWidth:0, pHeight:0, wWidth:0, wHeight:0, posTop:0, posLeft:0, scroll:0 },dimensions); var imgElements = this; var resizing = false; var origImgWidth = 0; var origImgHeight = 0; var myPlayer = null; getUrlVars(); var uf = jv2getAlbumFromUrl(); if(uf!=null) { setup.folder = uf; setup.folderPath = uf + '/'; } function executeLink() { if($('#gJv2overlay').length==0) initViewer(this,imgElements); else findImageToView(this); return false; } $(document).keyup(function(objEvent) { eventKeyPress(objEvent); }); function initViewer(elClicked,imgElements) { $('embed,object,select').css({'visibility':'hidden'}); createViewer(); setup.imageArray.length = 0; setup.currentImage = 0; for( var i = 0; i < imgElements.length; i++ ) { setup.imageArray.push( { href : $(imgElements[i]).attr('href'), title: $(imgElements[i]).attr('title'), caption : $(imgElements[i]).attr('caption'), author : $(imgElements[i]).attr('author'), orig : $(imgElements[i]).attr('orig'), video : $(imgElements[i]).attr('video') }); if($(imgElements[i]).attr('orig') == $(elClicked).attr('orig')) setup.currentImage = i; } updateURL({i:$(elClicked).attr('orig')}); viewImage(); } function findImageToView(elClicked) { var img = $(elClicked).attr('orig'); var imgNum = null; for( var i = 0; i < setup.imageArray.length; i++ ) { if(setup.imageArray[i].orig == img) { imgNum = i; break; } } if(imgNum != null) { setup.currentImage = imgNum; viewImage(); } } function createViewer() { getWindowDimensions(); $('
').appendTo("body").css({ backgroundColor:setup.overlayBgColor, opacity:setup.overlayOpacity, width:dimensions.pWidth, height:dimensions.pHeight }).click(function() { closeOverlay(); }).fadeIn(); viewer = '
' + '
' + '
' + '
' + '
' + '
' + '
' + '' + '
' + '
' + '
' + '
'; $('
').html(viewer).appendTo("body").css({ top:dimensions.posTop, left:dimensions.posLeft }).click(function() { closeOverlay(); }).show(); $("#imgInfoBox").click(function(event){ event.stopPropagation(); }); //myPlayer = _V_("videoPlayer"); if(setup.imageInfo) { $('').appendTo('#imgInfo'); $(''+setup.txtImageInfo+'').appendTo('#viewExif').click(function(event) { imageInfo(); return false; }); } if(setup.shareEnabled) { var jv2Share = $('#jv2Share'); var jv2ShareLinks = $('#jv2ShareLinks'); $('').click(function(event){$('#jv2ShareLinks').slideToggle();return false;}).appendTo(jv2Share); if(setup.shareFacebook) $('').click(function(event){share('facebook');return false;}).appendTo(jv2ShareLinks); if(setup.shareGoogleplus) $('').click(function(event){share('googleplus');return false;}).appendTo(jv2ShareLinks); if(setup.shareTwitter) $('').click(function(event){share('twitter');return false;}).appendTo(jv2ShareLinks); if(setup.shareLinkedIn) $('').click(function(event){share('linkedin');return false;}).appendTo(jv2ShareLinks); if(setup.shareStumbleupon) $('').click(function(event){share('stumbleupon');return false;}).appendTo(jv2ShareLinks); if(setup.sharePinterest) $('').click(function(event){share('pinterest');return false;}).appendTo(jv2ShareLinks); } if(setup.customShare) { $('').appendTo('#imgInfo'); $(''+setup.txtShare+'').appendTo('#viewShare').click(function(event) { customShare(); return false; }); } if(setup.showDownloadLink) $(''+setup.txtDownload+'').appendTo('#imgInfo'); if(setup.downloadOptions && !setup.openInNewTab) $(' S/M/L').appendTo('#downloadLink'); if(setup.showPrintLink) { $('').appendTo('#imgInfo'); $(''+setup.txtPrint+'').appendTo('#printLink').click(function(event) { printImage(); return false; }); } if(setup.disqus_enabled) { $('').click(function(){ toggleGalleryDisqus(); return false; }).appendTo('#jv2Comments'); $('').click(function() { toggleGalleryDisqus(); return false; }).appendTo('#jv2Comments'); } if(setup.slideshow) { var ssLink = $('').appendTo("#imgSlideShow").click(function() { startSlideShow(); }).show(); if(setup.slideshowAutoStart) ssLink.trigger('click'); } $('').appendTo("#viewerClose").click(function() { closeOverlay(); }).show(); // resizing window $(window).resize(function() { getWindowDimensions(); $('#gJv2overlay').css({ width:dimensions.wWidth, height:dimensions.wHeight }); if(resizing != true) { resizing = true; $.gDoTimeout( 'resize', 1000 , function(){ resizeViewer(false); resizing = false; }); } }); } function getWindowDimensions() { dimensions.wWidth = $(window).width(); dimensions.wHeight = $(window).height(); dimensions.pWidth = $(document).width(); dimensions.pHeight = $(document).height(); dimensions.scroll = $(window).scrollTop(); dimensions.posTop = dimensions.scroll + (dimensions.wHeight / 10); dimensions.posLeft = $(window).scrollLeft(); } function videoPlayer() { $('#imgDiv').hide(); if(myPlayer != null) { if(myPlayer.techName == "html5") { myPlayer.tag.src = ""; myPlayer.tech.removeTriggers(); myPlayer.load(); } //myPlayer.tech.destroy(); myPlayer.destroy(); $(myPlayer.el).remove(); } var code = '
'; $(code).prependTo('#imgDivWrap'); $("#gJv2videoPlayerWrap").click(function(event){ event.stopPropagation(); }); myPlayer = _V_("videoPlayer"); } function viewImage() { getUrlVars(); var uf = jv2getAlbumFromUrl(); if(uf!=null) { setup.folder = uf; setup.folderPath = uf + '/'; } removeImageInfo(); hideGalleryDisqus(); $('#imgLoading').show(); $('#imgImg, #imgNav, #imgInfoBox').hide(); if(setup.imageArray[setup.currentImage].video != null) videoPlayer(); else { $('#gJv2videoPlayerWrap').remove(); myPlayer = null; var preloadImage = new Image(); preloadImage.onload = function() { $('#imgDiv').show(); $('#imgImg').attr('src', setup.imageArray[setup.currentImage].href); origImgWidth = preloadImage.width; origImgHeight = preloadImage.height; resizeViewer(true); }; preloadImage.src = setup.imageArray[setup.currentImage].href; } currentImage = setup.imageArray[setup.currentImage].orig; updateURL({i:setup.imageArray[setup.currentImage].orig}); if(setup.disqus_enabled) { $(document).ready (function () { getUrlVars(); var uf = jv2getAlbumFromUrl(); var identifier = disqus_identifier_prefix+(uf!=null?uf.replace('/','_')+'_':'')+urlVars.fparam('i'); $('#disqusCount').attr('data-disqus-identifier',identifier); loadDisqusCount(identifier); }); } } function imageMaxSize(imgWidth,imgHeight,widthAdjust,heightAdjust) { if(typeof(widthAdjust)=='undefined') widthAdjust = 0; if(typeof(heightAdjust)=='undefined') heightAdjust = 0; var extraHeight = 60; var imgTotalMargin = (setup.containerBorderSize*4); var maxHeight = dimensions.wHeight - imgTotalMargin + heightAdjust - extraHeight; var maxWidth = dimensions.wWidth - imgTotalMargin + widthAdjust; if( imgHeight > maxHeight ) { var newHeight = maxHeight; var newWidth = Math.floor((newHeight / imgHeight) * imgWidth); if( newWidth > maxWidth ) { newWidth = maxWidth; newHeight = Math.floor((newWidth / imgWidth) * imgHeight); } dimensions.imgHeight = newHeight; dimensions.imgWidth = newWidth; } else if( imgWidth > maxWidth ) { var newWidth = maxWidth; var newHeight = Math.floor((newWidth / imgWidth) * imgHeight); if( newHeight > maxHeight ) { newHeight = maxHeight; newWidth = Math.floor((newHeight / imgHeight) * newWidth); } dimensions.imgHeight = newHeight; dimensions.imgWidth = newWidth; } else { dimensions.imgHeight = imgHeight; dimensions.imgWidth = imgWidth; } } function resizeViewer(initImg,addHeight) { var widthAdjust = 0; var heightAdjust = 0; if(typeof(addHeight)!='undefined' && addHeight == true) { heightAdjust = $('#imgCaption').height() * -1; } var extraHeight = 60; var imgMargin = (setup.containerBorderSize*2); imageMaxSize(origImgWidth,origImgHeight,widthAdjust,heightAdjust); var imgWrapWidth = (dimensions.imgWidth + imgMargin); var imgWrapHeight = (dimensions.imgHeight + imgMargin); dimensions.posTop = dimensions.scroll + ((dimensions.wHeight - imgWrapHeight)/2) - (extraHeight/2) + (heightAdjust/2); if(dimensions.posTop < imgMargin) dimensions.posTop = imgMargin; $('#gJv2imgViewer').animate({ top: dimensions.posTop }, setup.containerResizeSpeed); //$('#disqusBg').animate({ top:dimensions.posTop+setup.containerBorderSize }, setup.containerResizeSpeed); if(!initImg) $('#imgImg').animate({ width:dimensions.imgWidth, height:dimensions.imgHeight }, setup.containerResizeSpeed); $('#imgDivWrap').animate({ width: imgWrapWidth }); $('#imgNav').css({ height: imgWrapHeight }); $('#imgDiv, #disqusBg').animate({ width: dimensions.imgWidth, height: dimensions.imgHeight }, setup.containerResizeSpeed, function() { if(initImg) showImg(dimensions.imgWidth,dimensions.imgHeight); }); $('#disqus_thread').animate({ width: (dimensions.imgWidth-40), height: (dimensions.imgHeight-40) }, setup.containerResizeSpeed, function() { if(initImg) showImg(dimensions.imgWidth,dimensions.imgHeight); }); if(myPlayer != null) { myPlayer.width(dimensions.imgWidth); myPlayer.height(dimensions.imgHeight); } $('#imgInfoBox').css({ width: dimensions.imgWidth }); $('#imgPrevious, #imgNext').css({ height: dimensions.imgHeight + (setup.containerBorderSize * 2) }); }; function showImg(w,h) { $('#imgLoading').hide(); $('#imgImg').css({width:w,height:h}).fadeIn(function() { $('#imgNav').show(); $('#imgPrevious, #imgNext').unbind().css({'background':'transparent url(' + setup.imageBlank + ') no-repeat'}); if( (setup.currentImage != 0 || setup.viewerLoop) && setup.imageArray.length>1) { $('#imgPrevious').hover(function() { $('#imgPrevious span').css('display','block'); },function() { $('#imgPrevious span').css('display','none'); }).show().bind('click',function() { if(setup.sshowOn) stopSlideshow(); if(setup.currentImage==0) setup.currentImage = setup.imageArray.length-1; else setup.currentImage--; viewImage(); return false; }); } if( (setup.currentImage != setup.imageArray.length-1 || setup.viewerLoop) && setup.imageArray.length>1) { $('#imgNext').hover(function() { $('#imgNext span').css('display','block'); },function() { $('#imgNext span').css('display','none'); }).show().bind('click',function() { if(setup.sshowOn) stopSlideshow(); if( setup.currentImage == setup.imageArray.length-1 ) setup.currentImage=0; else setup.currentImage++; viewImage(); return false; }); } $('#imgInfoBox').slideDown('fast',function(){resizeViewer(false,true)}); if( setup.imageArray[setup.currentImage].title ) { $('#imgTitle').html(setup.imageArray[setup.currentImage].title).show(); if(setup.imageArray[setup.currentImage].caption!=null) $('#imgCaption').html(setup.imageArray[setup.currentImage].caption).show(); else $('#imgCaption').html('').show(); if(setup.imageArray[setup.currentImage].author!=null) $('#imgAuthor').html(' '+setup.txtAuthor+' '+setup.imageArray[setup.currentImage].author).show(); else $('#imgAuthor').html('').show(); var origVal = setup.imageArray[setup.currentImage].orig; $('#imgCurrentOriginal').val(origVal); if(setup.showDownloadLink) { if(setup.openInNewTab) { $('#downloadLinkRef').attr('href',setup.galleryfolder+setup.folderPath+origVal).attr('target','_blank'); } else { $('#downloadLinkRef').attr('href',setup.downloadLink+setup.galleryfolder+setup.folderPath+origVal); $('#downloadLinkRefS').attr('href',setup.downloadLink+setup.galleryfolder+setup.folderPath+origVal+'&size=S'); $('#downloadLinkRefM').attr('href',setup.downloadLink+setup.galleryfolder+setup.folderPath+origVal+'&size=M'); $('#downloadLinkRefL').attr('href',setup.downloadLink+setup.galleryfolder+setup.folderPath+origVal+'&size=L'); } } } if( setup.imageArray.length > 1 ) $('#imgCount').html(setup.txtImage+' '+(setup.currentImage+1)+' '+setup.txtOf+' '+setup.imageArray.length).show(); }); preloadNextPrev(); }; function toggleGalleryDisqus() { if($('#disqus_thread').is(':visible')) hideGalleryDisqus(); else showGalleryDisqus(); } function showGalleryDisqus() { if(setup.sshowOn) stopSlideshow(); var w = $('#imgDiv').width(); var h = $('#imgDiv').height(); if($('#disqusBg').length == 0) $('
').css({ opacity:0.5, width:w, height:h , display:'none'}).appendTo('#imgNav').bind('click',function(event){event.stopPropagation();removeExif();}); $("#disqusBg").fadeIn(); //$("#disqusBgContent").fadeIn(); if($('#disqus_thread').length == 0) $('
').css({ width:(w-40), height:(h-40) }).appendTo('#imgNav').bind('click',function(event){event.stopPropagation();}); loadDisqus(); $('#disqus_thread').fadeIn(); } function hideGalleryDisqus() { $("#disqusBg").fadeOut(); $("#disqus_thread").fadeOut(); $("#showDisqus").show(); $("#hideDisqus").hide(); } function printImage() { var imgWin = window.open(setup.imageArray[setup.currentImage].href); imgWin.window.print(); imgWin.document.close(); } function imageInfo() { if($('#exifBg').length == 0) { removeShare(); var src = $('#imgCurrentOriginal').val(); src = decodeURIComponent(src); var w = $('#imgDiv').width(); var h = $('#imgDiv').height(); $('
').css({ opacity:0.5, width:w, height:h }).appendTo('#imgNav'); $('
').css({ width:(w-40), height:(h-40) }).load(setup.imageInfoLink+setup.folderPath+src.replace(setup.galleryfolder,'')).appendTo('#imgNav').bind('click',function(event){event.stopPropagation();removeImageInfo();}); $('#viewExif a').text(setup.txtImageInfoHide); } else { removeImageInfo(); } } function removeImageInfo() { $('#exifInfo').remove(); $('#exifBg').remove(); $('#viewExif a').text(setup.txtImageInfo); } function customShare() { if($('#shareBg').length == 0) { removeImageInfo(); var src = $('#imgCurrentOriginal').val(); src = escape(src); var w = $('#imgDiv').width(); var h = $('#imgDiv').height(); $('
').css({ opacity:0.5, width:w, height:h }).appendTo('#imgNav'); $('
').css({ width:(w-40), height:(h-40) }).load(setup.shareLink+src.replace(setup.galleryfolder,'')).appendTo('#imgNav').bind('click',function(event){event.stopPropagation();removeShare();}); $('#viewShare a').text(setup.txtShareHide); } else { removeShare(); } } function removeShare() { $('#shareInfo').remove(); $('#shareBg').remove(); $('#viewShare a').text(setup.txtShare); } function clearImage() { $('#imgTitle').html(''); $('#imgCaption').html(''); $('#imgAuthor').html(''); } function nextSlide() { clearImage(); setup.currentImage++; viewImage(); if(setup.sshowOn && setup.currentImage < setup.imageArray.length-1) { $.gDoTimeout( 'sss', setup.slideShowDuration , function(){ nextSlide(); }); } return false; } function startSlideShow() { setup.sshowOn = true; $("#imgSlideShow img").remove(); $('').appendTo("#imgSlideShow").click(function() { stopSlideshow(); }).show(); $.gDoTimeout( 'ss', setup.slideShowDuration , function(){ nextSlide(); }); } function stopSlideshow() { setup.sshowOn = false; $.gDoTimeout( 'ss' ); $.gDoTimeout( 'sss' ); $("#imgSlideShow img").remove(); $('').appendTo("#imgSlideShow").click(function() { startSlideShow(); }).show(); } function preloadNextPrev() { if ( (setup.imageArray.length -1) > setup.currentImage ) { objNext = new Image(); objNext.src = setup.imageArray[setup.currentImage + 1].href; } if ( setup.currentImage > 0 ) { objPrev = new Image(); objPrev.src = setup.imageArray[setup.currentImage -1].href; } } function closeOverlay() { updateURL({i:null}); jv2RemoveViewer(); } function eventKeyPress(objEvent) { if(typeof(objEvent.DOM_VK_ESCAPE) != 'undefined') { keycode = objEvent.keyCode; escapeKey = objEvent.DOM_VK_ESCAPE; } else { keycode = objEvent.keyCode; escapeKey = 27; } if(keycode == escapeKey) closeOverlay(); else if(keycode==39 && setup.currentImage!=(setup.imageArray.length-1) ) { setup.currentImage++; viewImage(); } else if(keycode==37 && setup.currentImage!=0) { setup.currentImage--; viewImage(); } } function share(site) { getUrlVars(); var uf = jv2getAlbumFromUrl(); var directUrl = window.location.href; var shareDomain = window.location.protocol + '//' + window.location.host; var shareUrl = ''; var imageurl = ''; var serviceUrl = ''; var title = $('#imgTitle').text(); var p = []; p.push('s=1'); if(uf!=null) p.push('f='+uf); if(typeof(urlVars.fparam('i'))!='undefined') p.push('i='+urlVars.fparam('i')); var newPath = []; var pathArray = window.location.pathname.split( '/' ); var pathPartNum = pathArray.length; for ( i = 0; i < pathPartNum; i++ ) { if(i < pathPartNum-1 && pathArray[i]!='' && pathArray[i]!='index.php') newPath.push(pathArray[i]); } // use shareUrl for services that do not use hashbangs and _escaped_fragment_ GET conversion) if(jv2includemode && jv2includeGalleryIndexUrl != '') shareUrl = jv2includeGalleryIndexUrl; else if(newPath.length) shareUrl = shareDomain + '/' + newPath.join('/') + '/'; else shareUrl = shareDomain; imageurl = shareUrl; if(p.length) shareUrl = shareUrl + '?' + p.join('&'); if(jv2includemode && jv2includeGalleryIndexUrl != '') directUrl = shareUrl; if(uf!=null) imageurl = imageurl + uf + '/'; if(typeof(urlVars.fparam('i'))!='undefined') imageurl = imageurl + urlVars.fparam('i'); if(site=='facebook') serviceUrl = "https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(directUrl); else if(site=='googleplus') serviceUrl = "https://plus.google.com/share?url="+encodeURIComponent(directUrl); else if(site=='twitter') serviceUrl = "http://twitter.com/share?url="+encodeURIComponent(shareUrl)+"&text="+encodeURIComponent(title); else if(site=='linkedin') serviceUrl = "http://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(shareUrl); else if(site=='stumbleupon') serviceUrl = "http://www.stumbleupon.com/submit?url="+encodeURIComponent(directUrl)+"&title="+encodeURIComponent(title); else if(site=='pinterest') serviceUrl = "//www.pinterest.com/pin/create/button/?url="+encodeURIComponent(directUrl)+"&media="+encodeURIComponent(imageurl)+"&description="+encodeURIComponent(title); window.open( serviceUrl, site+'-share-dialog', 'width=626,height=436' ); return false; } return this.unbind('click').click(executeLink); }; })(jQuery); function updateGalleryContent(time,frequency,prepend) { var galleryUrl = ''; if(jv2includemode) galleryUrl = jv2includeModeAjaxUrl; $.ajax({ type: "GET", url: galleryUrl, data: 'newItems=true&checkTime='+time, cache: false, dataType:'json', success: function(r) { if(prepend) $(r.html).prependTo( $('#galleryPage') ); else $(r.html).insertBefore( $('#galleryDivEnd') ); $.gDoTimeout( 'update', (frequency*1000) , function(){ updateGalleryContent(r.time,frequency,prepend); }); }, error: function() { } }); } function loadDisqusCount(identifier) { disqus_identifier = identifier; disqus_url = window.location.href; if(window.DISQUS) DISQUSWIDGETS.getCount(); else $.getScript ("//"+disqus_shortname+".disqus.com/count.js"); } function loadDisqus() { getUrlVars(); var uf = jv2getAlbumFromUrl(); var identifier = disqus_identifier_prefix+(uf!=null?uf.replace('/','_')+'_':'')+urlVars.fparam('i'); if(window.DISQUS) { DISQUS.reset({ reload: true, config: function () { this.page.identifier = identifier; this.page.url = window.location.href; } }); } else { disqus_identifier = identifier; disqus_url = window.location.href; var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; $('head').append(dsq); } }; function uploadAnother( ref ) { var tempFile = window.document.createElement( 'INPUT' ); tempFile.setAttribute( 'type', 'file' ); tempFile.className = 'fileupload'; tempFile.setAttribute( 'name', 'fileupload[]' ); var tempForm = false; var tempParent = false; var ok = true; try { while( ok == true ) { if( tempParent == false ) { tempParent = ref.parentNode; } else if ( tempParent.nodeName.toLowerCase() == 'form' ) { tempForm = tempParent; ok = false; } else { tempParent = tempParent.parentNode; } } // ends while } catch( e ) {}; ok = null; tempForm.insertBefore( tempFile, ref ); if (tempForm.length-1 >= 5){ tempForm.removeChild(ref); } return false; } // ends uploadAnother /* * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010 * http://benalman.com/projects/jquery-dotimeout-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($){var a={},c="gDoTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery); (function($) { var $document = $(document), iframe, hash = '', needHistoryAdd = /MSIE/.test(navigator.userAgent), afterHistoryRead = false, afterHistoryAdd = false; function checkHashChange() { if(hash != (hash = document.location.hash)) { if(!afterHistoryRead && needHistoryAdd) historyAdd(hash); afterHistoryRead = false; $document.trigger('hashChange', [hash]); } setTimeout(checkHashChange, 100); } function historyAdd(hash) { if (!iframe) iframe = $('').appendTo('body')[0]; var d = iframe.contentDocument || (iframe.contentWindow ? iframe.contentWindow.document : iframe.document); d.open(); d.write('' + document.title + ''); d.write($('
').append($('
').text(hash)).html()); d.write(''); afterHistoryAdd = true; d.close(); } if('onpropertychange' in document && 'attachEvent' in document) { document.attachEvent('onpropertychange', function() { if(event.propertyName=='location') checkHashChange(); }); } if(needHistoryAdd) { window._historyRead = function() { if(!afterHistoryAdd) { var newHash = this._hash; if(document.location.hash != newHash) { afterHistoryRead = true; document.location.hash = newHash; } } afterHistoryAdd = false; }; } $(function(){ setTimeout(checkHashChange, 1) }); })(jQuery); /* * Purl (A JavaScript URL parser) v2.3.1 * Developed and maintanined by Mark Perkins, mark@allmarkedup.com * Source repository: https://github.com/allmarkedup/jQuery-URL-Parser * Licensed under an MIT-style license. See https://github.com/allmarkedup/jQuery-URL-Parser/blob/master/LICENSE for details. */ var urlVars = new Object; var urlVarsPrevious = new Object; var currentAlbum = '/'; var currentImage = null; function getUrlVars(prev) { if(typeof(prev)!='undefined' && prev) urlVarsPrevious = jQuery.extend({},urlVars); try { urlVars = $.url(); } catch(err) {} } function updateURL(params) { if(params == null || params == undefined) params = {}; var hash = []; urlVarsTemp = jQuery.extend(urlVars.fparam(),params); jQuery.each(urlVarsTemp, function(i,val) { if(val!=null || (i=='f' && val!='/' && val!=null) ) hash.push( i + '=' + escape(val) ); //encodeURIComponent }); window.location.hash = '!/'+hash.join('&'); } function jv2RemoveViewer() { currentImage = null; $('#gJv2imgViewer').fadeOut(200,function() { $(this).remove(); $('#gJv2overlay').fadeOut(500,function() { $(this).remove(); $('embed, object, select').css({ 'visibility':'visible' }); }); }); } function jv2getAlbumFromUrl() { if(typeof(urlVars.fparam('f'))!='undefined') return urlVars.fparam('f'); else if(typeof(urlVars.param('f'))!='undefined') return urlVars.param('f'); else return null; } function addLoadingOverlay(elementId) { pageElement = $('#'+elementId); if(($(pageElement).outerHeight(true))!=null) { var marginLeft = $(pageElement).css('margin-left'); if(typeof(marginLeft)=='undefined') marginLeft = 0; $('
').addClass('loadingFade') .attr('id',elementId+'loading') .height( $(pageElement).outerHeight(true) ) .width( $(pageElement).outerWidth() ) .css('margin-left',marginLeft) .insertBefore(pageElement) .fadeIn(); } } function removeLoadingOverlay(elementId) { $('#'+elementId+'loading').remove(); } function jv2loadAlbum(folder) { if(folder=='') folder=null; updateURL({f:folder}); return false; } function jv2loadAlbumAjax(folder) { var galleryUrl = ''; if(jv2includemode) galleryUrl = jv2includeModeAjaxUrl; $.gDoTimeout('gLoad',500,function(){ addLoadingOverlay('gJv2'); }); $.ajax({ type: 'GET', url: galleryUrl, data: 'f='+escape(folder), cache: false, dataType:'html', success: function(content) { $('#gJv2').html(content); jv2loadImageFromHash(); currentAlbum = folder; }, complete: function() { $.gDoTimeout('gLoad'); removeLoadingOverlay('gJv2'); } }); return false; } function jv2loadImageFromHash() { if(typeof(urlVars.fparam('i'))!='undefined' && currentImage != urlVars.fparam('i')) { $(".gItem").each(function(){ if($(this).attr('orig') == urlVars.fparam('i')) $(this).click(); }); } } function jv2handleGalleryHash() { getUrlVars(true); var uf = jv2getAlbumFromUrl(); if(typeof(urlVars.fparam('f'))!='undefined' && uf != currentAlbum) { jv2RemoveViewer(); jv2loadAlbumAjax(uf); } else if(typeof(urlVars.fparam('i'))!='undefined') { jv2loadImageFromHash(); } else if(typeof(urlVars.fparam('f'))=='undefined') { if($('#gJv2overlay').length==0 && typeof(urlVarsPrevious.fparam('f'))!='undefined' ) jv2loadAlbumAjax('/'); else { jv2RemoveViewer(); } } if((uf == currentAlbum || !jv2ajax) && typeof(urlVars.fparam('i'))=='undefined') { jv2RemoveViewer(); } } $(function() { if(jv2ajax && window.location.hash=='') window.location.hash = '#!/'; $(document).bind('hashChange', jv2handleGalleryHash); }); if(jv2imgHoverOpacity) { $(function() { $('#gJv2').on('mouseenter','.imgWrap',function(){ $(this).animate({'opacity':0.7},500); }); $('#gJv2').on('mouseleave','.imgWrap',function(){ $(this).animate({'opacity':1},300); }); }); }