// V 1.1.2 (with Klix mods) - CTRL+F "Klix" to find mods /* - Query vars you can use on your url for the box: isIframe=true - will force it to recognize it as a url to open in an iframe lightboxWidth=100 - force the width of a swf, iframe, or video instead of using the default lightboxHeight=100 - force the height of a swf, iframe, or video instead of using the default quality=large - determine the quality of a video for use in the custom youtube player instead of the default minFlashVer=10.0.0 - determine the min flash version that can view a swf bgColor=#fff - determine the bg color of a swf wmode=opaque - manually determine the wmode for a swf backup=[uriencodeddata] - give uri encoded HTML data to show as a swf's backup content */ var undef; // mousewheel event plugin (function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery) var mbbox = { MARGIN: 70, // the minimum margin around the shown asset, does not include title, so don't make too small if using titles DEBUG: false, // determines if it should log info to the console.log function, for developers only DEFAULT_WIDTH: 640, // default width for video/swf/iframes if none is defined using a 'lightboxWidth' url var DEFAULT_HEIGHT: 360, // default height for video/swf/iframes if none is defined using a 'lightboxHeight' url var SHOW_PAGING_FIELD: true, // true or false to show the little '1/12' if there's more than 1 in the group ASSUME_ABSOLUTE_PATHS_IFRAME: false, // true would assume any url not vimeo or youtube should open iframe, false it will assume is an image USE_CUSTOM_YOUTUBE_PLAYER: true, // uses the included flash/html5 player instead of the default youtube one for youtube videos DEFAULT_YOUTUBE_QUALITY: 'large', // only applies if using the custom youtube player, sets it's default quality if none supplied via a query var USE_MOUSE_WHEEL: true, // true or false to allow navigation through asset groups to use the mouse wheel USE_HISTORY: false, // to add a #hash fragment on open, and close the box if removed (allows the back button to close the lightbox) thumbs: [], loadingImg: undef, state: 'unstarted', lbHash: '', mobileMode: false, markupAdded: false, addMarkup: function() { if (!mbbox.markupAdded) jQuery('body').append(mbbox_html); mbbox.markupAdded = true; jQuery('#mbbox-bg, #mbbox-cont').css({display:'none', opacity:0}); jQuery("#mbbox-cont, #mbbox-cont .vert-center-child").click(function(e){ if (e.target == e.currentTarget) mbbox.bgClick(); }); mbbox.state = 'created'; // watch the mouse wheel to navigate as well if it's turned on if (mbbox.USE_MOUSE_WHEEL) jQuery(document).bind("mousewheel", mbbox.onMouseWheel); // if mobile mode is on, then that means makeMobile was called but the markup wasn't added yet, so have to call it again now if (mbbox.mobileMode) mbbox.makeMobile(); }, ignoreClick: true, initialize: function(sel, ic) { // useful if manually calling the box up on click for some reason mbbox.ignoreClick = ic==true; // reset from any previous setup mbbox.reset(); // if is a string, make jQuery object if (sel.substr != undef) sel = jQuery(sel); // call addToGallery for each match of the selector sel.each(mbbox.addToGallery); // add the html for the box mbbox.addMarkup(); mbbox.state = 'ready'; }, makeMobile: function() { mbbox.mobileMode = true; if (mbbox.markupAdded) { jQuery('#mbbox-bg').css('position','absolute'); mbbox_fixCenter('#mbbox-bg'); jQuery('#mbbox-cont').css('position','absolute'); mbbox_fixCenter('#mbbox-cont'); } }, reset: function() { if (mbbox.showing) mbbox.hide(); // dont reset the markup added var or the markup will add again, which isn't needed mbbox.thumbs = []; mbbox.loadingImg = undef; mbbox.state = 'unstarted'; mbbox.lbHash = ''; mbbox.showing = false; mbbox.curInd = -1; mbbox.titleToBe = ''; mbbox.pagingToBe = ''; mbbox.nextIndToShow = -1; if (mbbox.USE_HISTORY) clearInterval(mbbox.closeCheckInt); }, addToGallery: function() { $this = jQuery(this); // move the title attribute info to the jquery data if ($this.data('title') == undef) { $this.data('title', $this.attr('title')); $this.removeAttr('title'); } mbbox.thumbs.push( [this, $this.attr('href'), $this.data('title')] ); if (mbbox.ignoreClick) $this.attr('onclick','event.returnValue = false; return false;'); else $this.attr('onclick','mbbox.showByIndex('+(mbbox.thumbs.length-1)+'); event.returnValue = false; return false;'); }, showByIndex: function(i) { var arr = mbbox.thumbs[i]; mbbox.show(arr[1], arr[2], i); }, showing: false, curInd: -1, closeCheckInt: -1, titleToBe: '', pagingToBe: '', show: function(url, title, indexOrUndef) { if (mbbox.state != 'ready' && mbbox.state != 'paging') return; mbbox.log('mbbox.show(): '+url+', '+title+', '+indexOrUndef); var type = 'img'; var ext = url.split('?')[0].split('.').reverse()[0].toLowerCase(); var dim = mbbox.getQueryDimensions(url); var isIframe = RegExp('[?|&]isIframe=?(.*?)(&|$)').exec(origUrl) == 'true'; var origUrl = url; mbbox.curInd = indexOrUndef; jQuery(window).trigger('resize'); // for the mobile version resizing if (ext == 'swf') { type = 'swf'; } // this will call youtube and vimeo vids iframes too, but the if statements afterwards will correct it if ((mbbox.ASSUME_ABSOLUTE_PATHS_IFRAME && (url.substr(0,7) == 'http://' || url.substring(0,8) == 'https://')) || isIframe) { type = 'iframe' } if (url.toLowerCase().indexOf('youtube.com') > -1 && url.indexOf('v=') > -1 && !isIframe) { type = 'yt'; url = url.match(/(&|\?)v=(.*?)($|&)/i)[2]; } if (url.toLowerCase().indexOf('vimeo.com') > -1 && !isIframe) { type = 'vim'; url = url.match(/(vimeo.com\/)(.*?)(\/|\?|$)/i)[2]; } mbbox.pagingToBe = mbbox.SHOW_PAGING_FIELD&&indexOrUndef!=undef&&mbbox.thumbs.length>1 ? (indexOrUndef+1)+' / '+mbbox.thumbs.length : ''; $box = jQuery('#mbbox-box'); $cont = jQuery('#mbbox-cont'); if (type == 'img') { mbbox.loadingImg = new Image(); mbbox.loadingImg.onload = mbbox.onImageLoaded; mbbox.loadingImg.src = url; mbbox.state = 'loading'; mbbox.titleToBe = title; } if (type == 'swf') { var minFlash = RegExp('[?|&]minFlashVer=?(.*?)(&|$)').exec(origUrl); var bgColor = RegExp('[?|&]bgColor=?(.*?)(&|$)').exec(origUrl); var wmode = RegExp('[?|&]wmode=?(.*?)(&|$)').exec(origUrl); var backup = RegExp('[?|&]backup=?(.*?)(&|$)').exec(origUrl); $box.html('
'+(backup==null ? '

You must have to view this content.

' : decodeURIComponent(backup[1]))+'
' + mbbox_ctrls); swfobject.embedSWF(url, 'mbbox-swf-container', '100%', '100%', (minFlash==null?'10.0.0':minFlash[1]), false, false, {wmode:(wmode==null?'opaque':wmode[1]), bgcolor:(bgColor==null?'#fff':bgColor[1])}); $cont.css({display:'block'}).delay(500).animate({opacity:1}, 500); mbbox.updateControls(); jQuery('#mbbox-title').text(title); jQuery('#mbbox-page').text(mbbox.pagingToBe); mbbox.state = 'showing [iframe]'; } if (type == 'iframe') { $box.html('