// This file is part of Shutter Reloaded WordPress plugin. For standalone version visit http://www.laptoptips.ca/javascripts/shutter-reloaded/ var shutterLinks = {}, shutterSets = {}; function shutterAddLoad(fn) { /* OM4 Core File Mod: Change fn to fn() on the following line and in the minified js file */ if ('undefined' != typeof jQuery) jQuery(document).ready(fn); else if( typeof window.onload != 'function' ) window.onload = fn; else {oldonld = window.onload; window.onload = function(){if(oldonld){oldonld();};fn();}}; } shutterReloaded = { I : function (a) { return document.getElementById(a); }, settings : function() { var t = this, s = shutterSettings; t.L10n = s.L10n || ['Previous','Next','Close','Full Size','Fit to Screen','Image','of','Loading...']; t.imageCount = s.imageCount || 0; t.textBtns = s.textBtns || 0; t.imgDir = s.imgDir || '/wp-content/plugins/shutter-reloaded/menu/'; t.FS = s.FS || 0; t.oneSet = s.oneSet || 0; }, init : function (a) { var t = this, L, T, ext, i, j, m, setid, inset, shfile, shMenuPre, k, img; if ( 'object' != typeof shutterSettings ) shutterSettings = {}; t.settings(); for ( i = 0, j = document.links.length; i < j; i++ ) { L = document.links[i]; ext = ( L.href.indexOf('?') == -1 ) ? L.href.slice(-4).toLowerCase() : L.href.substring( 0, L.href.indexOf('?') ).slice(-4).toLowerCase(); if ( ext != '.jpg' && ext != '.png' && ext != '.gif' && ext != 'jpeg' ) continue; if ( a == 'sh' && L.className.toLowerCase().indexOf('shutter') == -1 ) continue; if ( a == 'lb' && L.rel.toLowerCase().indexOf('lightbox') == -1 ) continue; if ( L.className && L.className.toLowerCase().indexOf('shutterset') != -1 ) setid = L.className.match(/shutterset[^\s]*/g); else if ( L.rel && L.rel.toLowerCase().indexOf('lightbox[') != -1 ) setid = L.rel.replace(/\s/g, '_'); else if ( t.oneSet ) setid = 'oneSetForAllLinks'; else setid = 0, inset = -1; if ( setid ) { if ( ! shutterSets[setid] ) shutterSets[setid] = []; inset = shutterSets[setid].push(i); } shfile = L.href.slice(L.href.lastIndexOf('/')+1); T = ( L.title && L.title != shfile ) ? L.title : ''; if ( !T && L.firstChild && L.firstChild.nodeName == 'IMG' ) T = L.firstChild.title || ''; shutterLinks[i] = {link:L.href,num:inset,set:setid,title:T} L.onclick = new Function('shutterReloaded.make("'+i+'");return false;'); } if ( ! t.textBtns ) { shMenuPre = ['close.gif','prev.gif','prev-d.gif','next.gif','next-d.gif','resize1.gif','resize2.gif','resize-d.gif','loading.gif']; for ( k = 0, m = shMenuPre.length; k < m; k++ ) { img = new Image(); img.src = t.imgDir+shMenuPre[k]; } } }, make : function(ln,fs) { var t = this, prev, next, prevlink = '', nextlink = '', previmg, nextimg, prevbtn, nextbtn, D, S, NB, fsarg = -1, imgNum, closebtn, fsbtn, fsLink, dv; if ( ! t.Top ) { if ( typeof window.pageYOffset != 'undefined' ) t.Top = window.pageYOffset; else t.Top = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop; } if ( typeof t.pgHeight == 'undefined' ) t.pgHeight = Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); if ( fs ) t.FS = ( fs > 0 ) ? 1 : 0; else t.FS = shutterSettings.FS || 0; if ( t.resizing ) t.resizing = null; window.onresize = new Function('shutterReloaded.resize("'+ln+'");'); document.documentElement.style.overflowX = 'hidden'; if ( ! t.VP ) { t._viewPort(); t.VP = true; } if ( ! (S = t.I('shShutter')) ) { S = document.createElement('div'); S.setAttribute('id','shShutter'); document.getElementsByTagName('body')[0].appendChild(S); t.hideTags(); } if ( ! (D = t.I('shDisplay')) ) { D = document.createElement('div'); D.setAttribute('id','shDisplay'); D.style.top = t.Top + 'px'; document.getElementsByTagName('body')[0].appendChild(D); } S.style.height = t.pgHeight + 'px'; dv = t.textBtns ? ' | ' : ''; if ( shutterLinks[ln].num > 1 ) { prev = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num - 2]; prevbtn = t.textBtns ? t.L10n[0] : ''; prevlink = ''+prevbtn+''+dv; previmg = new Image(); previmg.src = shutterLinks[prev].link; } else { prevlink = t.textBtns ? ''+t.L10n[0]+''+dv : ''; } if ( shutterLinks[ln].num != -1 && shutterLinks[ln].num < (shutterSets[shutterLinks[ln].set].length) ) { next = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num]; nextbtn = t.textBtns ? t.L10n[1] : ''; nextlink = ''+nextbtn+''+dv; nextimg = new Image(); nextimg.src = shutterLinks[next].link; } else { nextlink = t.textBtns ? ''+t.L10n[1]+''+dv : ''; } closebtn = t.textBtns ? t.L10n[2] : ''; imgNum = ( (shutterLinks[ln].num > 0) && t.imageCount ) ? ' '+t.L10n[5]+' '+shutterLinks[ln].num+' '+t.L10n[6]+' '+shutterSets[shutterLinks[ln].set].length : ''; if ( t.FS ) { fsbtn = t.textBtns ? t.L10n[4] : ''; } else { fsbtn = t.textBtns ? t.L10n[3] : ''; fsarg = 1; } fsbtn_d = t.textBtns ? ''+t.L10n[3]+''+dv : ''; fsLink = ''+fsbtn+''+dv+''+fsbtn_d+''; if ( ! (NB = t.I('shNavBar')) ) { NB = document.createElement('div'); NB.setAttribute('id','shNavBar'); document.getElementsByTagName('body')[0].appendChild(NB); } NB.innerHTML = dv+prevlink+''+closebtn+''+dv+nextlink+fsLink+imgNum; D.innerHTML = '