/** * jQuery iLightBox - Revolutionary Lightbox Plugin * http://www.ilightbox.net/ * * @version: 2.2.4 - October 14, 2017 * * @author: iProDev (Hemn Chawroka) * http://www.iprodev.com/ * */ (function($, window, undefined) { var extensions = { flash: ['swf'], image: ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff', 'tif', 'jfif', 'jpe'], iframe: ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'jsp', 'php', 'pl', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt'], video: ['avi', 'mov', 'mpg', 'mpeg', 'movie', 'mp4', 'webm', 'ogv', 'ogg', '3gp', 'm4v'] }, // Global DOM elements $win = $(window), $doc = $(document), // Support indicators browser, transform, gpuAcceleration, fullScreenApi = '', userAgent = navigator.userAgent || navigator.vendor || window.opera, supportTouch = !!('ontouchstart' in window) && (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)), isMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4)), // Events clickEvent = supportTouch ? "itap.iLightBox" : "click.iLightBox", touchStartEvent = supportTouch ? "touchstart.iLightBox" : "mousedown.iLightBox", touchStopEvent = supportTouch ? "touchend.iLightBox" : "mouseup.iLightBox", touchMoveEvent = supportTouch ? "touchmove.iLightBox" : "mousemove.iLightBox", // Math shorthands abs = Math.abs, sqrt = Math.sqrt, round = Math.round, max = Math.max, min = Math.min, floor = Math.floor, random = Math.random, pluginspages = { quicktime: 'http://www.apple.com/quicktime/download', flash: 'http://www.adobe.com/go/getflash' }, iLightBox = function(el, options, items, instant) { var iL = this; iL.options = options, iL.selector = el.selector || el, iL.context = el.context, iL.instant = instant; if (items.length < 1) iL.attachItems(); else iL.items = items; iL.vars = { total: iL.items.length, start: 0, current: null, next: null, prev: null, BODY: $('body'), loadRequests: 0, overlay: $('
'), loader: $('
'), toolbar: $('
'), innerToolbar: $('
'), title: $('
'), closeButton: $(''), fullScreenButton: $(''), innerPlayButton: $(''), innerNextButton: $(''), innerPrevButton: $(''), holder: $('
'), nextPhoto: $('
'), prevPhoto: $('
'), nextButton: $(''), prevButton: $(''), thumbnails: $('
'), thumbs: false, nextLock: false, prevLock: false, hashLock: false, isMobile: false, mobileMaxWidth: 980, isInFullScreen: false, isSwipe: false, mouseID: 0, cycleID: 0, isPaused: 0 }; // Hideable elements with mousemove event iL.vars.hideableElements = iL.vars.nextButton.add(iL.vars.prevButton); iL.normalizeItems(); //Check necessary plugins iL.availPlugins(); //Set startFrom iL.options.startFrom = (iL.options.startFrom > 0 && iL.options.startFrom >= iL.vars.total) ? iL.vars.total - 1 : iL.options.startFrom; //If randomStart iL.options.startFrom = (iL.options.randomStart) ? floor(random() * iL.vars.total) : iL.options.startFrom; iL.vars.start = iL.options.startFrom; if (instant) iL.instantCall(); else iL.patchItemsEvents(); if (iL.options.linkId) { iL.hashChangeHandler(); $win.iLightBoxHashChange(function() { iL.hashChangeHandler(); }); } if (supportTouch) { var RegExp = /(click|mouseenter|mouseleave|mouseover|mouseout)/ig, replace = "itap"; iL.options.caption.show = iL.options.caption.show.replace(RegExp, replace), iL.options.caption.hide = iL.options.caption.hide.replace(RegExp, replace), iL.options.social.show = iL.options.social.show.replace(RegExp, replace), iL.options.social.hide = iL.options.social.hide.replace(RegExp, replace); } if (iL.options.controls.arrows) { $.extend(iL.options.styles, { nextOffsetX: 0, prevOffsetX: 0, nextOpacity: 0, prevOpacity: 0 }); } }; //iLightBox helpers iLightBox.prototype = { showLoader: function() { var iL = this; iL.vars.loadRequests += 1; if (iL.options.path.toLowerCase() == "horizontal") iL.vars.loader.addClass('ilightbox-show').stop().animate({ top: '-30px' }, iL.options.show.speed, 'easeOutCirc'); else iL.vars.loader.addClass('ilightbox-show').stop().animate({ left: '-30px' }, iL.options.show.speed, 'easeOutCirc'); }, hideLoader: function() { var iL = this; iL.vars.loadRequests -= 1; iL.vars.loadRequests = (iL.vars.loadRequests < 0) ? 0 : iL.vars.loadRequests; if (iL.options.path.toLowerCase() == "horizontal") { if (iL.vars.loadRequests <= 0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({ top: '-192px' }, iL.options.show.speed, 'easeInCirc'); } else { if (iL.vars.loadRequests <= 0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({ left: '-192px' }, iL.options.show.speed, 'easeInCirc'); } }, createUI: function() { var iL = this; iL.ui = { currentElement: iL.vars.holder, nextElement: iL.vars.nextPhoto, prevElement: iL.vars.prevPhoto, currentItem: iL.vars.current, nextItem: iL.vars.next, prevItem: iL.vars.prev, hide: function() { iL.closeAction(); }, refresh: function() { (arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto(); }, fullscreen: function() { iL.fullScreenAction(); } }; }, attachItems: function() { var iL = this, itemsObject = new Array(), items = new Array(); $(iL.selector, iL.context).each(function() { var t = $(this), URL = t.attr(iL.options.attr) || null, options = t.data("options") && eval("({" + t.data("options") + "})") || {}, caption = t.data('caption'), title = t.data('title'), type = t.data('type') || getTypeByExtension(URL); items.push({ URL: URL, caption: caption, title: title, type: type, options: options }); if (!iL.instant) itemsObject.push(t); }); iL.items = items, iL.itemsObject = itemsObject; }, normalizeItems: function() { var iL = this, newItems = new Array(); $.each(iL.items, function(key, val) { if (typeof val == "string") val = { url: val }; var URL = val.url || val.URL || null, options = val.options || {}, caption = val.caption || null, title = val.title || null, type = (val.type) ? val.type.toLowerCase() : getTypeByExtension(URL), ext = (typeof URL != 'object') ? getExtension(URL) : ''; options.thumbnail = options.thumbnail || ((type == "image") ? URL : null), options.videoType = options.videoType || null, options.skin = options.skin || iL.options.skin, options.width = options.width || null, options.height = options.height || null, options.mousewheel = (typeof options.mousewheel != 'undefined') ? options.mousewheel : true, options.swipe = (typeof options.swipe != 'undefined') ? options.swipe : true, options.social = (typeof options.social != 'undefined') ? options.social : iL.options.social.buttons && $.extend({}, {}, iL.options.social.buttons); if (type == "video") { options.html5video = (typeof options.html5video != 'undefined') ? options.html5video : {}; options.html5video.webm = options.html5video.webm || options.html5video.WEBM || null; options.html5video.controls = (typeof options.html5video.controls != 'undefined') ? options.html5video.controls : "controls"; options.html5video.preload = options.html5video.preload || "metadata"; options.html5video.autoplay = (typeof options.html5video.autoplay != 'undefined') ? options.html5video.autoplay : false; } if (!options.width || !options.height) { if (type == "video") options.width = 1280, options.height = 720; else if (type == "iframe") options.width = '100%', options.height = '90%'; else if (type == "flash") options.width = 1280, options.height = 720; } delete val.url; val.index = key; val.URL = URL; val.caption = caption; val.title = title; val.type = type; val.options = options; val.ext = ext; newItems.push(val); }); iL.items = newItems; }, instantCall: function() { var iL = this, key = iL.vars.start; iL.vars.current = key; iL.vars.next = (iL.items[key + 1]) ? key + 1 : null; iL.vars.prev = (iL.items[key - 1]) ? key - 1 : null; iL.addContents(); iL.patchEvents(); }, addContents: function() { var iL = this, vars = iL.vars, opts = iL.options, viewport = getViewport(), path = opts.path.toLowerCase(), recognizingItems = vars.total > 0 && iL.items.filter(function(e, i, arr) { return ['image', 'flash', 'video'].indexOf(e.type) === -1 && typeof e.recognized === 'undefined' && (opts.smartRecognition || e.options.smartRecognition); }), needRecognition = recognizingItems.length > 0; if (opts.mobileOptimizer && !opts.innerToolbar) vars.isMobile = viewport.width <= vars.mobileMaxWidth; vars.overlay.addClass(opts.skin).hide().css('opacity', opts.overlay.opacity); if (opts.linkId) vars.overlay[0].setAttribute('linkid', opts.linkId); //Add Toolbar Buttons if (opts.controls.toolbar) { vars.toolbar.addClass(opts.skin).append(vars.closeButton); if (opts.controls.fullscreen) vars.toolbar.append(vars.fullScreenButton); if (opts.controls.slideshow) vars.toolbar.append(vars.innerPlayButton); if (vars.total > 1) vars.toolbar.append(vars.innerPrevButton).append(vars.innerNextButton); } //Append elements to body vars.BODY.addClass('ilightbox-noscroll').append(vars.overlay).append(vars.loader).append(vars.holder).append(vars.nextPhoto).append(vars.prevPhoto); if (!opts.innerToolbar) vars.BODY.append(vars.toolbar); if (opts.controls.arrows) vars.BODY.append(vars.nextButton).append(vars.prevButton); if (opts.controls.thumbnail && vars.total > 1) { vars.BODY.append(vars.thumbnails); vars.thumbnails.addClass(opts.skin).addClass('ilightbox-' + path); $('div.ilightbox-thumbnails-grid', vars.thumbnails).empty(); vars.thumbs = true; } //Configure loader and arrows var loaderCss = (opts.path.toLowerCase() == "horizontal") ? { left: parseInt((viewport.width / 2) - (vars.loader.outerWidth() / 2)) } : { top: parseInt((viewport.height / 2) - (vars.loader.outerHeight() / 2)) }; vars.loader.addClass(opts.skin).css(loaderCss); vars.nextButton.add(vars.prevButton).addClass(opts.skin); if (path == "horizontal") vars.loader.add(vars.nextButton).add(vars.prevButton).addClass('horizontal'); // Configure arrow buttons vars.BODY[vars.isMobile ? 'addClass' : 'removeClass']('isMobile'); if (!opts.infinite) { vars.prevButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled'); if (vars.current == 0) vars.prevButton.add(vars.innerPrevButton).addClass('disabled'); if (vars.current >= vars.total - 1) vars.nextButton.add(vars.innerNextButton).addClass('disabled'); } if (opts.show.effect) { vars.overlay.stop().fadeIn(opts.show.speed); vars.toolbar.stop().fadeIn(opts.show.speed); } else { vars.overlay.show(); vars.toolbar.show(); } var length = recognizingItems.length; if (needRecognition) { iL.showLoader(); $.each(recognizingItems, function(key, val) { var resultFnc = function(result) { console.log(result); var key = -1, filter = iL.items.filter(function(e, i, arr) { if (e.URL == result.url) key = i; return e.URL == result.url; }), self = iL.items[key]; if (result) $.extend(true, self, { URL: result.source, type: result.type, recognized: true, options: { html5video: result.html5video, width: (result.type == "image") ? 0 : (result.width || self.width), height: (result.type == "image") ? 0 : (result.height || self.height), thumbnail: self.options.thumbnail || result.thumbnail } }); length--; if (length == 0) { iL.hideLoader(); vars.dontGenerateThumbs = false; iL.generateThumbnails(); if (opts.show.effect) setTimeout(function() { iL.generateBoxes(); }, opts.show.speed); else iL.generateBoxes(); } }; iL.ogpRecognition(this, resultFnc); }); } else { if (opts.show.effect) setTimeout(function() { iL.generateBoxes(); }, opts.show.speed); else iL.generateBoxes(); } iL.createUI(); window.iLightBox = { close: function() { iL.closeAction(); }, fullscreen: function() { iL.fullScreenAction(); }, moveNext: function() { iL.moveTo('next'); }, movePrev: function() { iL.moveTo('prev'); }, goTo: function(index) { iL.goTo(index); }, refresh: function() { iL.refresh(); }, reposition: function() { (arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto(); }, setOption: function(options) { iL.setOption(options); }, destroy: function() { iL.closeAction(); iL.dispatchItemsEvents(); } }; if (opts.linkId) { vars.hashLock = true; window.location.hash = opts.linkId + '/' + vars.current; setTimeout(function() { vars.hashLock = false; }, 55); } if (!opts.slideshow.startPaused) { iL.resume(); vars.innerPlayButton.removeClass('ilightbox-play').addClass('ilightbox-pause'); } //Trigger the onOpen callback if (typeof iL.options.callback.onOpen == 'function') iL.options.callback.onOpen.call(iL); }, loadContent: function(obj, opt, speed) { var iL = this, holder, item; iL.createUI(); obj.speed = speed || iL.options.effects.loadedFadeSpeed; if (opt == 'current') { if (!obj.options.mousewheel) iL.vars.lockWheel = true; else iL.vars.lockWheel = false; if (!obj.options.swipe) iL.vars.lockSwipe = true; else iL.vars.lockSwipe = false; } switch (opt) { case 'current': holder = iL.vars.holder, item = iL.vars.current; break; case 'next': holder = iL.vars.nextPhoto, item = iL.vars.next; break; case 'prev': holder = iL.vars.prevPhoto, item = iL.vars.prev; break; } holder.removeAttr('style class').addClass('ilightbox-holder' + (supportTouch ? ' supportTouch' : '')).addClass(obj.options.skin); $('div.ilightbox-inner-toolbar', holder).remove(); if (obj.title || iL.options.innerToolbar) { var innerToolbar = iL.vars.innerToolbar.clone(); if (obj.title && iL.options.show.title) { var title = iL.vars.title.clone(); title.empty().html(obj.title); innerToolbar.append(title); } if (iL.options.innerToolbar) { innerToolbar.append((iL.vars.total > 1) ? iL.vars.toolbar.clone() : iL.vars.toolbar); } holder.prepend(innerToolbar); } console.warn('loadContent', arguments); iL.loadSwitcher(obj, holder, item, opt); }, loadSwitcher: function(obj, holder, item, opt) { var iL = this, opts = iL.options, api = { element: holder, position: item }; switch (obj.type) { case 'image': //Trigger the onBeforeLoad callback if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item); if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api); iL.loadImage(obj.URL, function(img) { //Trigger the onAfterLoad callback if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item); if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api); var width = (img) ? img.width : 400, height = (img) ? img.height : 200; holder.data({ naturalWidth: width, naturalHeight: height }); $('div.ilightbox-container', holder).empty().append((img) ? '' : '' + opts.errors.loadImage + ''); //Trigger the onRender callback if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item); if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api); iL.configureHolder(obj, opt, holder); }); break; case 'video': holder.data({ naturalWidth: obj.options.width, naturalHeight: obj.options.height }); if (opt === 'current') { iL.addContent(holder, obj); //Trigger the onRender callback if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item); if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api); } else { $('div.ilightbox-container', holder).empty(); } iL.configureHolder(obj, opt, holder); break; case 'iframe': //iL.showLoader(); holder.data({ naturalWidth: obj.options.width, naturalHeight: obj.options.height }); iL.configureHolder(obj, opt, holder); if (opt === 'current') { var el = iL.addContent(holder, obj); //Trigger the onRender callback if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item); if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api); //Trigger the onBeforeLoad callback if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item); if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api); el.bind('load', function() { //Trigger the onAfterLoad callback if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item); if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api); //iL.hideLoader(); el.unbind('load'); }); } else { $('div.ilightbox-container', holder).empty(); } break; case 'inline': var el = $(obj.URL), content = iL.addContent(holder, obj), images = findImageInElement(holder); holder.data({ naturalWidth: (iL.items[item].options.width || el.outerWidth()), naturalHeight: (iL.items[item].options.height || el.outerHeight()) }); content.children().eq(0).show(); //Trigger the onRender callback if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item); if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api); //Trigger the onBeforeLoad callback if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item); if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api); iL.loadImage(images, function() { //Trigger the onAfterLoad callback if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item); if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api); iL.configureHolder(obj, opt, holder); }); break; case 'flash': var el = iL.addContent(holder, obj); holder.data({ naturalWidth: (iL.items[item].options.width || el.outerWidth()), naturalHeight: (iL.items[item].options.height || el.outerHeight()) }); //Trigger the onRender callback if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item); if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api); iL.configureHolder(obj, opt, holder); break; case 'ajax': var ajax = obj.options.ajax || {}; //Trigger the onBeforeLoad callback if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item); if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api); iL.showLoader(); $.ajax({ url: obj.URL || opts.ajaxSetup.url, data: ajax.data || null, dataType: ajax.dataType || "html", type: ajax.type || opts.ajaxSetup.type, cache: ajax.cache || opts.ajaxSetup.cache, crossDomain: ajax.crossDomain || opts.ajaxSetup.crossDomain, global: ajax.global || opts.ajaxSetup.global, ifModified: ajax.ifModified || opts.ajaxSetup.ifModified, username: ajax.username || opts.ajaxSetup.username, password: ajax.password || opts.ajaxSetup.password, beforeSend: ajax.beforeSend || opts.ajaxSetup.beforeSend, complete: ajax.complete || opts.ajaxSetup.complete, success: function(data, textStatus, jqXHR) { iL.hideLoader(); var el = $(data), container = $('div.ilightbox-container', holder), elWidth = iL.items[item].options.width || parseInt(el[0].getAttribute('width')), elHeight = iL.items[item].options.height || parseInt(el[0].getAttribute('height')), css = (el[0].getAttribute('width') && el[0].getAttribute('height')) ? { 'overflow': 'hidden' } : {}; container.empty().append($('
').css(css).html(el)); holder.show().data({ naturalWidth: (elWidth || container.outerWidth()), naturalHeight: (elHeight || container.outerHeight()) }).hide(); //Trigger the onRender callback if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item); if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api); var images = findImageInElement(holder); iL.loadImage(images, function() { //Trigger the onAfterLoad callback if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item); if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api); iL.configureHolder(obj, opt, holder); }); opts.ajaxSetup.success(data, textStatus, jqXHR); if (typeof ajax.success == 'function') ajax.success(data, textStatus, jqXHR); }, error: function(jqXHR, textStatus, errorThrown) { //Trigger the onAfterLoad callback if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item); if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api); iL.hideLoader(); $('div.ilightbox-container', holder).empty().append('' + opts.errors.loadContents + ''); iL.configureHolder(obj, opt, holder); opts.ajaxSetup.error(jqXHR, textStatus, errorThrown); if (typeof ajax.error == 'function') ajax.error(jqXHR, textStatus, errorThrown); } }); break; case 'html': var object = obj.URL, el container = $('div.ilightbox-container', holder); if (object[0].nodeName) el = object.clone(); else { var dom = $(object); if (dom.selector) el = $('
' + dom + '
'); else el = dom; } var elWidth = iL.items[item].options.width || parseInt(el.attr('width')), elHeight = iL.items[item].options.height || parseInt(el.attr('height')); iL.addContent(holder, obj); el.appendTo(document.documentElement).hide(); //Trigger the onRender callback if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item); if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api); var images = findImageInElement(holder); //Trigger the onBeforeLoad callback if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item); if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api); iL.loadImage(images, function() { //Trigger the onAfterLoad callback if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item); if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api); holder.show().data({ naturalWidth: (elWidth || container.outerWidth()), naturalHeight: (elHeight || container.outerHeight()) }).hide(); el.remove(); iL.configureHolder(obj, opt, holder); }); break; } }, configureHolder: function(obj, opt, holder) { var iL = this, vars = iL.vars, opts = iL.options; if (opt != "current")(opt == "next") ? holder.addClass('ilightbox-next') : holder.addClass('ilightbox-prev'); if (opt == "current") var item = vars.current; else if (opt == "next") var opacity = opts.styles.nextOpacity, item = vars.next; else var opacity = opts.styles.prevOpacity, item = vars.prev; var api = { element: holder, position: item }; iL.items[item].options.width = iL.items[item].options.width || 0, iL.items[item].options.height = iL.items[item].options.height || 0; if (opt == "current") { if (opts.show.effect) holder.css(transform, gpuAcceleration).fadeIn(obj.speed, function() { holder.css(transform, ''); if (obj.caption) { iL.setCaption(obj, holder); var caption = $('div.ilightbox-caption', holder), percent = parseInt((caption.outerHeight() / holder.outerHeight()) * 100); if (opts.caption.start & percent <= 50) caption.fadeIn(opts.effects.fadeSpeed); } var social = obj.options.social; if (social) { iL.setSocial(social, obj.URL, holder); if (opts.social.start) $('div.ilightbox-social', holder).fadeIn(opts.effects.fadeSpeed); } //Generate thumbnails iL.generateThumbnails(); //Trigger the onShow callback if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item); if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api); }); else { holder.show(); //Generate thumbnails iL.generateThumbnails(); //Trigger the onShow callback if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item); if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api); } } else { if (opts.show.effect) holder.fadeTo(obj.speed, opacity, function() { if (opt == "next") vars.nextLock = false; else vars.prevLock = false; //Generate thumbnails iL.generateThumbnails(); //Trigger the onShow callback if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item); if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api); }); else { holder.css({ opacity: opacity }).show(); if (opt == "next") vars.nextLock = false; else vars.prevLock = false; //Generate thumbnails iL.generateThumbnails(); //Trigger the onShow callback if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item); if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api); } } setTimeout(function() { iL.repositionPhoto(); }, 0); }, generateBoxes: function() { var iL = this, vars = iL.vars, opts = iL.options; if (opts.infinite && vars.total >= 3) { if (vars.current == vars.total - 1) vars.next = 0; if (vars.current == 0) vars.prev = vars.total - 1; } else opts.infinite = false; iL.loadContent(iL.items[vars.current], 'current', opts.show.speed); if (iL.items[vars.next]) iL.loadContent(iL.items[vars.next], 'next', opts.show.speed); if (iL.items[vars.prev]) iL.loadContent(iL.items[vars.prev], 'prev', opts.show.speed); }, generateThumbnails: function() { var iL = this, vars = iL.vars, opts = iL.options, timeOut = null; if (vars.thumbs && !iL.vars.dontGenerateThumbs) { var thumbnails = vars.thumbnails, container = $('div.ilightbox-thumbnails-container', thumbnails), grid = $('div.ilightbox-thumbnails-grid', container), i = 0; grid.removeAttr('style').empty(); $.each(iL.items, function(key, val) { var isActive = (vars.current == key) ? 'ilightbox-active' : '', opacity = (vars.current == key) ? opts.thumbnails.activeOpacity : opts.thumbnails.normalOpacity, thumb = val.options.thumbnail, thumbnail = $('
'), icon = $('
'); thumbnail.css({ opacity: 0 }).addClass(isActive); if ((val.type == "video" || val.type == "flash") && typeof val.options.icon == 'undefined') { icon.addClass('ilightbox-thumbnail-video'); thumbnail.append(icon); } else if (val.options.icon) { icon.addClass('ilightbox-thumbnail-' + val.options.icon); thumbnail.append(icon); } if (thumb) iL.loadImage(thumb, function(img) { i++; if (img) thumbnail.data({ naturalWidth: img.width, naturalHeight: img.height }).append(''); else thumbnail.data({ naturalWidth: opts.thumbnails.maxWidth, naturalHeight: opts.thumbnails.maxHeight }); clearTimeout(timeOut); timeOut = setTimeout(function() { iL.positionThumbnails(thumbnails, container, grid); }, 20); setTimeout(function() { thumbnail.fadeTo(opts.effects.loadedFadeSpeed, opacity); }, i * 20); }); grid.append(thumbnail); }); iL.vars.dontGenerateThumbs = true; } }, positionThumbnails: function(thumbnails, container, grid) { var iL = this, vars = iL.vars, opts = iL.options, viewport = getViewport(), path = opts.path.toLowerCase(); if (!thumbnails) thumbnails = vars.thumbnails; if (!container) container = $('div.ilightbox-thumbnails-container', thumbnails); if (!grid) grid = $('div.ilightbox-thumbnails-grid', container); var thumbs = $('.ilightbox-thumbnail', grid), widthAvail = (path == 'horizontal') ? viewport.width - opts.styles.pageOffsetX : thumbs.eq(0).outerWidth() - opts.styles.pageOffsetX, heightAvail = (path == 'horizontal') ? thumbs.eq(0).outerHeight() - opts.styles.pageOffsetY : viewport.height - opts.styles.pageOffsetY, gridWidth = (path == 'horizontal') ? 0 : widthAvail, gridHeight = (path == 'horizontal') ? heightAvail : 0, active = $('.ilightbox-active', grid), gridCss = {}, css = {}; if (arguments.length < 3) { thumbs.css({ opacity: opts.thumbnails.normalOpacity }); active.css({ opacity: opts.thumbnails.activeOpacity }); } thumbs.each(function(i) { var t = $(this), data = t.data(), width = (path == 'horizontal') ? 0 : opts.thumbnails.maxWidth; height = (path == 'horizontal') ? opts.thumbnails.maxHeight : 0; dims = iL.getNewDimenstions(width, height, data.naturalWidth, data.naturalHeight, true); t.css({ width: dims.width, height: dims.height }); if (path == 'horizontal') t.css({ 'float': 'left' }); (path == 'horizontal') ? ( gridWidth += t.outerWidth() ) : ( gridHeight += t.outerHeight() ); }); gridCss = { width: gridWidth, height: gridHeight }; grid.css(gridCss); gridCss = {}; var gridOffset = grid.offset(), activeOffset = (active.length) ? active.offset() : { top: parseInt(heightAvail / 2), left: parseInt(widthAvail / 2) }; gridOffset.top = (gridOffset.top - $doc.scrollTop()), gridOffset.left = (gridOffset.left - $doc.scrollLeft()), activeOffset.top = (activeOffset.top - gridOffset.top - $doc.scrollTop()), activeOffset.left = (activeOffset.left - gridOffset.left - $doc.scrollLeft()); (path == 'horizontal') ? ( gridCss.top = 0, gridCss.left = parseInt((widthAvail / 2) - activeOffset.left - (active.outerWidth() / 2)) ) : ( gridCss.top = parseInt(((heightAvail / 2) - activeOffset.top - (active.outerHeight() / 2))), gridCss.left = 0 ); if (arguments.length < 3) grid.stop().animate(gridCss, opts.effects.repositionSpeed, 'easeOutCirc'); else grid.css(gridCss); }, loadImage: function(image, callback) { if (!$.isArray(image)) image = [image]; var iL = this, length = image.length; if (length > 0) { iL.showLoader(); $.each(image, function(index, value) { var img = new Image(); img.onload = function() { length -= 1; if (length == 0) { iL.hideLoader(); callback(img); } }; img.onerror = img.onabort = function() { length -= 1; if (length == 0) { iL.hideLoader(); callback(false); } }; img.src = image[index]; }); } else callback(false); }, patchItemsEvents: function() { var iL = this, vars = iL.vars, clickEvent = supportTouch ? "itap.iL" : "click.iL", vEvent = supportTouch ? "click.iL" : "itap.iL"; if (iL.context && iL.selector) { var $items = $(iL.selector, iL.context); $(iL.context).on(clickEvent, iL.selector, function() { var $this = $(this), key = $items.index($this); if ($('body').hasClass('mobile-browser') && $('body').hasClass('mobile-two-click')) { if (!$this.hasClass('hovered')) { $this.addClass('hovered'); return false; } } vars.current = key; vars.next = iL.items[key + 1] ? key + 1 : null; vars.prev = iL.items[key - 1] ? key - 1 : null; iL.addContents(); iL.patchEvents(); return false; }).on(vEvent, iL.selector, function() { return false; }); } else $.each(iL.itemsObject, function(key, val) { val.on(clickEvent, function() { vars.current = key; vars.next = iL.items[key + 1] ? key + 1 : null; vars.prev = iL.items[key - 1] ? key - 1 : null; iL.addContents(); iL.patchEvents(); return false; }).on(vEvent, function() { return false; }); }); }, dispatchItemsEvents: function() { var iL = this, vars = iL.vars, opts = iL.options; if (iL.context && iL.selector) $(iL.context).off('.iL', iL.selector); else $.each(iL.itemsObject, function(key, val) { val.off('.iL'); }); }, refresh: function() { var iL = this; iL.dispatchItemsEvents(); iL.attachItems(); iL.normalizeItems(); iL.patchItemsEvents(); }, patchEvents: function() { var iL = this, vars = iL.vars, opts = iL.options, path = opts.path.toLowerCase(), holders = $('.ilightbox-holder'), fullscreenEvent = fullScreenApi.fullScreenEventName + '.iLightBox', durationThreshold = 1000, horizontalDistanceThreshold = verticalDistanceThreshold = 100, buttonsArray = [vars.nextButton[0], vars.prevButton[0], vars.nextButton[0].firstChild, vars.prevButton[0].firstChild]; $win.bind('resize.iLightBox', function() { var viewport = getViewport(); if (opts.mobileOptimizer && !opts.innerToolbar) vars.isMobile = viewport.width <= vars.mobileMaxWidth; vars.BODY[vars.isMobile ? 'addClass' : 'removeClass']('isMobile'); iL.repositionPhoto(null); if (supportTouch) { clearTimeout(vars.setTime); vars.setTime = setTimeout(function() { var scrollTop = getScrollXY().y; window.scrollTo(0, scrollTop - 30); window.scrollTo(0, scrollTop + 30); window.scrollTo(0, scrollTop); }, 2000); } if (vars.thumbs) iL.positionThumbnails(); }).bind('keydown.iLightBox', function(event) { if (opts.controls.keyboard) { switch (event.keyCode) { case 13: if (event.shiftKey && opts.keyboard.shift_enter) iL.fullScreenAction(); break; case 27: if (opts.keyboard.esc) iL.closeAction(); break; case 37: if (opts.keyboard.left && !vars.lockKey) iL.moveTo('prev'); break; case 38: if (opts.keyboard.up && !vars.lockKey) iL.moveTo('prev'); break; case 39: if (opts.keyboard.right && !vars.lockKey) iL.moveTo('next'); break; case 40: if (opts.keyboard.down && !vars.lockKey) iL.moveTo('next'); break; } } }); if (fullScreenApi.supportsFullScreen) $win.bind(fullscreenEvent, function() { iL.doFullscreen(); }); var holderEventsArr = [opts.caption.show + '.iLightBox', opts.caption.hide + '.iLightBox', opts.social.show + '.iLightBox', opts.social.hide + '.iLightBox'].filter(function(e, i, arr) { return arr.lastIndexOf(e) === i; }), holderEvents = ""; $.each(holderEventsArr, function(key, val) { if (key != 0) holderEvents += ' '; holderEvents += val; }); $doc.on(clickEvent, '.ilightbox-overlay', function() { if (opts.overlay.blur) iL.closeAction(); }).on(clickEvent, '.ilightbox-next, .ilightbox-next-button', function() { iL.moveTo('next'); }).on(clickEvent, '.ilightbox-prev, .ilightbox-prev-button', function() { iL.moveTo('prev'); }).on(clickEvent, '.ilightbox-thumbnail', function() { var t = $(this), thumbs = $('.ilightbox-thumbnail', vars.thumbnails), index = thumbs.index(t); if (index != vars.current) iL.goTo(index); }).on(holderEvents, '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e) { var caption = $('div.ilightbox-caption', vars.holder), social = $('div.ilightbox-social', vars.holder), fadeSpeed = opts.effects.fadeSpeed; if (vars.nextLock || vars.prevLock) { if (e.type == opts.caption.show && !caption.is(':visible')) caption.fadeIn(fadeSpeed); else if (e.type == opts.caption.hide && caption.is(':visible')) caption.fadeOut(fadeSpeed); if (e.type == opts.social.show && !social.is(':visible')) social.fadeIn(fadeSpeed); else if (e.type == opts.social.hide && social.is(':visible')) social.fadeOut(fadeSpeed); } else { if (e.type == opts.caption.show && !caption.is(':visible')) caption.stop().fadeIn(fadeSpeed); else if (e.type == opts.caption.hide && caption.is(':visible')) caption.stop().fadeOut(fadeSpeed); if (e.type == opts.social.show && !social.is(':visible')) social.stop().fadeIn(fadeSpeed); else if (e.type == opts.social.hide && social.is(':visible')) social.stop().fadeOut(fadeSpeed); } }).on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-wrapper', function(e) { if (e.type == 'mouseenter') vars.lockWheel = true; else vars.lockWheel = false; }).on(clickEvent, '.ilightbox-toolbar a.ilightbox-close, .ilightbox-toolbar a.ilightbox-fullscreen, .ilightbox-toolbar a.ilightbox-play, .ilightbox-toolbar a.ilightbox-pause', function() { var t = $(this); if (t.hasClass('ilightbox-fullscreen')) iL.fullScreenAction(); else if (t.hasClass('ilightbox-play')) { iL.resume(); t.addClass('ilightbox-pause').removeClass('ilightbox-play'); } else if (t.hasClass('ilightbox-pause')) { iL.pause(); t.addClass('ilightbox-play').removeClass('ilightbox-pause'); } else iL.closeAction(); }).on(touchMoveEvent, '.ilightbox-overlay, .ilightbox-thumbnails-container', function(e) { // prevent scrolling e.preventDefault(); }); function mouseMoveHandler(e) { if (!vars.isMobile) { if (!vars.mouseID) { vars.hideableElements.show(); } vars.mouseID = clearTimeout(vars.mouseID); if (buttonsArray.indexOf(e.target) === -1) vars.mouseID = setTimeout(function() { vars.hideableElements.hide(); vars.mouseID = clearTimeout(vars.mouseID); }, 3000); } } if (opts.controls.arrows && !supportTouch) $doc.on('mousemove.iLightBox', mouseMoveHandler); if (opts.controls.slideshow && opts.slideshow.pauseOnHover) $doc.on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e) { if (e.type == 'mouseenter' && vars.cycleID) iL.pause(); else if (e.type == 'mouseleave' && vars.isPaused) iL.resume(); }); var switchers = $('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails'); if (opts.controls.mousewheel) switchers.on('mousewheel.iLightBox', function(event, delta) { if (!vars.lockWheel) { event.preventDefault(); if (delta < 0) iL.moveTo('next'); else if (delta > 0) iL.moveTo('prev'); } }); if (opts.controls.swipe) holders.on(touchStartEvent, function(event) { if (vars.nextLock || vars.prevLock || vars.total == 1 || vars.lockSwipe) return; vars.BODY.addClass('ilightbox-closedhand'); var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event, scrollTop = $doc.scrollTop(), scrollLeft = $doc.scrollLeft(), offsets = [ holders.eq(0).offset(), holders.eq(1).offset(), holders.eq(2).offset() ], offSet = [{ top: offsets[0].top - scrollTop, left: offsets[0].left - scrollLeft }, { top: offsets[1].top - scrollTop, left: offsets[1].left - scrollLeft }, { top: offsets[2].top - scrollTop, left: offsets[2].left - scrollLeft }], start = { time: (new Date()).getTime(), coords: [data.pageX - scrollLeft, data.pageY - scrollTop] }, stop; function moveEachHandler(i) { var t = $(this), offset = offSet[i], scroll = [(start.coords[0] - stop.coords[0]), (start.coords[1] - stop.coords[1])]; t[0].style[path == "horizontal" ? 'left' : 'top'] = (path == "horizontal" ? offset.left - scroll[0] : offset.top - scroll[1]) + 'px'; } function moveHandler(event) { if (!start) return; var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event; stop = { time: (new Date()).getTime(), coords: [data.pageX - scrollLeft, data.pageY - scrollTop] }; holders.each(moveEachHandler); // prevent scrolling event.preventDefault(); } function repositionHolders() { holders.each(function() { var t = $(this), offset = t.data('offset') || { top: t.offset().top - scrollTop, left: t.offset().left - scrollLeft }, top = offset.top, left = offset.left; t.css(transform, gpuAcceleration).stop().animate({ top: top, left: left }, 500, 'easeOutCirc', function() { t.css(transform, ''); }); }); } holders.bind(touchMoveEvent, moveHandler); $doc.one(touchStopEvent, function(event) { holders.unbind(touchMoveEvent, moveHandler); vars.BODY.removeClass('ilightbox-closedhand'); if (start && stop) { if (path == "horizontal" && stop.time - start.time < durationThreshold && abs(start.coords[0] - stop.coords[0]) > horizontalDistanceThreshold && abs(start.coords[1] - stop.coords[1]) < verticalDistanceThreshold) { if (start.coords[0] > stop.coords[0]) { if (vars.current == vars.total - 1 && !opts.infinite) repositionHolders(); else { vars.isSwipe = true; iL.moveTo('next'); } } else { if (vars.current == 0 && !opts.infinite) repositionHolders(); else { vars.isSwipe = true; iL.moveTo('prev'); } } } else if (path == "vertical" && stop.time - start.time < durationThreshold && abs(start.coords[1] - stop.coords[1]) > horizontalDistanceThreshold && abs(start.coords[0] - stop.coords[0]) < verticalDistanceThreshold) { if (start.coords[1] > stop.coords[1]) { if (vars.current == vars.total - 1 && !opts.infinite) repositionHolders(); else { vars.isSwipe = true; iL.moveTo('next'); } } else { if (vars.current == 0 && !opts.infinite) repositionHolders(); else { vars.isSwipe = true; iL.moveTo('prev'); } } } else repositionHolders(); } start = stop = undefined; }); }); }, goTo: function(index) { var iL = this, vars = iL.vars, opts = iL.options, diff = (index - vars.current); if (opts.infinite) { if (index == vars.total - 1 && vars.current == 0) diff = -1; if (vars.current == vars.total - 1 && index == 0) diff = 1; } if (diff == 1) iL.moveTo('next'); else if (diff == -1) iL.moveTo('prev'); else { if (vars.nextLock || vars.prevLock) return false; //Trigger the onBeforeChange callback if (typeof opts.callback.onBeforeChange == 'function') opts.callback.onBeforeChange.call(iL, iL.ui); if (opts.linkId) { vars.hashLock = true; window.location.hash = opts.linkId + '/' + index; } if (iL.items[index]) { if (!iL.items[index].options.mousewheel) vars.lockWheel = true; else iL.vars.lockWheel = false; if (!iL.items[index].options.swipe) vars.lockSwipe = true; else vars.lockSwipe = false; } $.each([vars.holder, vars.nextPhoto, vars.prevPhoto], function(key, val) { val.css(transform, gpuAcceleration).fadeOut(opts.effects.loadedFadeSpeed); }); vars.current = index; vars.next = index + 1; vars.prev = index - 1; iL.createUI(); setTimeout(function() { iL.generateBoxes(); }, opts.effects.loadedFadeSpeed + 50); $('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(index).addClass('ilightbox-active'); iL.positionThumbnails(); if (opts.linkId) setTimeout(function() { vars.hashLock = false; }, 55); // Configure arrow buttons if (!opts.infinite) { vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled'); if (vars.current == 0) { vars.prevButton.add(vars.innerPrevButton).addClass('disabled'); } if (vars.current >= vars.total - 1) { vars.nextButton.add(vars.innerNextButton).addClass('disabled'); } } // Reset next cycle timeout iL.resetCycle(); //Trigger the onAfterChange callback if (typeof opts.callback.onAfterChange == 'function') opts.callback.onAfterChange.call(iL, iL.ui); } }, moveTo: function(side) { var iL = this, vars = iL.vars, opts = iL.options, path = opts.path.toLowerCase(), viewport = getViewport(), switchSpeed = opts.effects.switchSpeed; if (vars.nextLock || vars.prevLock) return false; else { var item = (side == "next") ? vars.next : vars.prev; if (opts.linkId) { vars.hashLock = true; window.location.hash = opts.linkId + '/' + item; } if (side == "next") { if (!iL.items[item]) return false; var firstHolder = vars.nextPhoto, secondHolder = vars.holder, lastHolder = vars.prevPhoto, firstClass = 'ilightbox-prev', secondClass = 'ilightbox-next'; } else if (side == "prev") { if (!iL.items[item]) return false; var firstHolder = vars.prevPhoto, secondHolder = vars.holder, lastHolder = vars.nextPhoto, firstClass = 'ilightbox-next', secondClass = 'ilightbox-prev'; } //Trigger the onBeforeChange callback if (typeof opts.callback.onBeforeChange == 'function') opts.callback.onBeforeChange.call(iL, iL.ui); (side == "next") ? vars.nextLock = true: vars.prevLock = true; var captionFirst = $('div.ilightbox-caption', secondHolder), socialFirst = $('div.ilightbox-social', secondHolder); if (captionFirst.length) captionFirst.stop().fadeOut(switchSpeed, function() { $(this).remove(); }); if (socialFirst.length) socialFirst.stop().fadeOut(switchSpeed, function() { $(this).remove(); }); if (iL.items[item].caption) { iL.setCaption(iL.items[item], firstHolder); var caption = $('div.ilightbox-caption', firstHolder), percent = parseInt((caption.outerHeight() / firstHolder.outerHeight()) * 100); if (opts.caption.start && percent <= 50) caption.fadeIn(switchSpeed); } var social = iL.items[item].options.social; if (social) { iL.setSocial(social, iL.items[item].URL, firstHolder); if (opts.social.start) $('div.ilightbox-social', firstHolder).fadeIn(opts.effects.fadeSpeed); } $.each([firstHolder, secondHolder, lastHolder], function(key, val) { val.removeClass('ilightbox-next ilightbox-prev'); }); var firstOffset = firstHolder.data('offset'), winW = (viewport.width - (opts.styles.pageOffsetX)), winH = (viewport.height - (opts.styles.pageOffsetY)), width = firstOffset.newDims.width, height = firstOffset.newDims.height, thumbsOffset = firstOffset.thumbsOffset, diff = firstOffset.diff, top = parseInt((winH / 2) - (height / 2) - diff.H - (thumbsOffset.H / 2)), left = parseInt((winW / 2) - (width / 2) - diff.W - (thumbsOffset.W / 2)); firstHolder.css(transform, gpuAcceleration).animate({ top: top, left: left, opacity: 1 }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() { firstHolder.css(transform, ''); }); $('div.ilightbox-container', firstHolder).animate({ width: width, height: height }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc'); var secondOffset = secondHolder.data('offset'), object = secondOffset.object; diff = secondOffset.diff; width = secondOffset.newDims.width, height = secondOffset.newDims.height; width = parseInt(width * opts.styles[side == 'next' ? 'prevScale' : 'nextScale']), height = parseInt(height * opts.styles[side == 'next' ? 'prevScale' : 'nextScale']), top = (path == 'horizontal') ? parseInt((winH / 2) - object.offsetY - (height / 2) - diff.H - (thumbsOffset.H / 2)) : parseInt(winH - object.offsetX - diff.H - (thumbsOffset.H / 2)); if (side == 'prev') left = (path == 'horizontal') ? parseInt(winW - object.offsetX - diff.W - (thumbsOffset.W / 2)) : parseInt((winW / 2) - (width / 2) - diff.W - object.offsetY - (thumbsOffset.W / 2)); else { top = (path == 'horizontal') ? top : parseInt(object.offsetX - diff.H - height - (thumbsOffset.H / 2)), left = (path == 'horizontal') ? parseInt(object.offsetX - diff.W - width - (thumbsOffset.W / 2)) : parseInt((winW / 2) - object.offsetY - (width / 2) - diff.W - (thumbsOffset.W / 2)); } $('div.ilightbox-container', secondHolder).animate({ width: width, height: height }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc'); secondHolder.addClass(firstClass).css(transform, gpuAcceleration).animate({ top: top, left: left, opacity: opts.styles.prevOpacity }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() { secondHolder.css(transform, ''); $('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(item).addClass('ilightbox-active'); iL.positionThumbnails(); if (iL.items[item]) { if (!iL.items[item].options.mousewheel) vars.lockWheel = true; else vars.lockWheel = false; if (!iL.items[item].options.swipe) vars.lockSwipe = true; else vars.lockSwipe = false; } vars.isSwipe = false; // Remove iframe & video from previous slide if (['iframe', 'video'].indexOf(iL.items[vars.current].type) !== -1) { $('div.ilightbox-container', secondHolder).empty(); } if (side == "next") { vars.nextPhoto = lastHolder, vars.prevPhoto = secondHolder, vars.holder = firstHolder; vars.nextPhoto.hide(); vars.next = vars.next + 1, vars.prev = vars.current, vars.current = vars.current + 1; if (opts.infinite) { if (vars.current > vars.total - 1) vars.current = 0; if (vars.current == vars.total - 1) vars.next = 0; if (vars.current == 0) vars.prev = vars.total - 1; } iL.createUI(); if (!iL.items[vars.next]) vars.nextLock = false; else iL.loadContent(iL.items[vars.next], 'next'); } else { vars.prevPhoto = lastHolder; vars.nextPhoto = secondHolder; vars.holder = firstHolder; vars.prevPhoto.hide(); vars.next = vars.current; vars.current = vars.prev; vars.prev = vars.current - 1; if (opts.infinite) { if (vars.current == vars.total - 1) vars.next = 0; if (vars.current == 0) vars.prev = vars.total - 1; } iL.createUI(); if (!iL.items[vars.prev]) vars.prevLock = false; else iL.loadContent(iL.items[vars.prev], 'prev'); } // Add iframe & video content for current slide if (['iframe', 'video'].indexOf(iL.items[vars.current].type) !== -1) { iL.loadContent(iL.items[vars.current], 'current'); } if (opts.linkId) setTimeout(function() { vars.hashLock = false; }, 55); // Configure arrow buttons if (!opts.infinite) { vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled'); if (vars.current == 0) vars.prevButton.add(vars.innerPrevButton).addClass('disabled'); if (vars.current >= vars.total - 1) vars.nextButton.add(vars.innerNextButton).addClass('disabled'); } iL.repositionPhoto(); // Reset next cycle timeout iL.resetCycle(); //Trigger the onAfterChange callback if (typeof opts.callback.onAfterChange == 'function') opts.callback.onAfterChange.call(iL, iL.ui); }); top = (path == 'horizontal') ? getPixel(lastHolder, 'top') : ((side == "next") ? parseInt(-(winH / 2) - lastHolder.outerHeight()) : parseInt(top * 2)), left = (path == 'horizontal') ? ((side == "next") ? parseInt(-(winW / 2) - lastHolder.outerWidth()) : parseInt(left * 2)) : getPixel(lastHolder, 'left'); lastHolder.css(transform, gpuAcceleration).animate({ top: top, left: left, opacity: opts.styles.nextOpacity }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() { lastHolder.css(transform, ''); }).addClass(secondClass); } }, setCaption: function(obj, target) { var iL = this, caption = $('
'); if (obj.caption) { caption.html(obj.caption); $('div.ilightbox-container', target).append(caption); } }, normalizeSocial: function(obj, url) { var iL = this, vars = iL.vars, opts = iL.options, baseURL = window.location.href; $.each(obj, function(key, value) { if (!value) return true; var item = key.toLowerCase(), source, text; switch (item) { case 'facebook': source = "http://www.facebook.com/share.php?v=4&src=bm&u={URL}", text = "Share on Facebook"; break; case 'twitter': source = "http://twitter.com/home?status={URL}", text = "Share on Twitter"; break; case 'googleplus': source = "https://plus.google.com/share?url={URL}", text = "Share on Google+"; break; case 'delicious': source = "http://delicious.com/post?url={URL}", text = "Share on Delicious"; break; case 'digg': source = "http://digg.com/submit?phase=2&url={URL}", text = "Share on Digg"; break; case 'reddit': source = "http://reddit.com/submit?url={URL}", text = "Share on reddit"; break; } obj[key] = { URL: value.URL && absolutizeURI(baseURL, value.URL) || opts.linkId && window.location.href || typeof url !== 'string' && baseURL || url && absolutizeURI(baseURL, url) || baseURL, source: value.source || source || value.URL && absolutizeURI(baseURL, value.URL) || url && absolutizeURI(baseURL, url), text: value.text || text || "Share on " + key, width: (typeof(value.width) != 'undefined' && !isNaN(value.width)) ? parseInt(value.width) : 640, height: value.height || 360 }; }); return obj; }, setSocial: function(obj, url, target) { var iL = this, socialBar = $('
'), buttons = ''; socialBar.html(buttons); $('div.ilightbox-container', target).append(socialBar); }, fullScreenAction: function() { var iL = this, vars = iL.vars; if (fullScreenApi.supportsFullScreen) { if (fullScreenApi.isFullScreen()) fullScreenApi.cancelFullScreen(document.documentElement); else fullScreenApi.requestFullScreen(document.documentElement); } else { iL.doFullscreen(); } }, doFullscreen: function() { var iL = this, vars = iL.vars, viewport = getViewport(), opts = iL.options; if (opts.fullAlone) { var currentHolder = vars.holder, current = iL.items[vars.current], windowWidth = viewport.width, windowHeight = viewport.height, elements = [currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader], hideElements = [vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails]; if (!vars.isInFullScreen) { vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = true; vars.overlay.css({ opacity: 1 }); $.each(hideElements, function(i, element) { element.hide(); }); vars.fullScreenButton.attr('title', opts.text.exitFullscreen); if (opts.fullStretchTypes.indexOf(current.type) != -1) currentHolder.data({ naturalWidthOld: currentHolder.data('naturalWidth'), naturalHeightOld: currentHolder.data('naturalHeight'), naturalWidth: windowWidth, naturalHeight: windowHeight }); else { var viewport = current.options.fullViewPort || opts.fullViewPort || '', newWidth = windowWidth, newHeight = windowHeight, width = currentHolder.data('naturalWidth'), height = currentHolder.data('naturalHeight'); if (viewport.toLowerCase() == 'fill') { newHeight = (newWidth / width) * height; if (newHeight < windowHeight) { newWidth = (windowHeight / height) * width, newHeight = windowHeight; } } else if (viewport.toLowerCase() == 'fit') { var dims = iL.getNewDimenstions(newWidth, newHeight, width, height, true); newWidth = dims.width, newHeight = dims.height; } else if (viewport.toLowerCase() == 'stretch') { newWidth = newWidth, newHeight = newHeight; } else { var scale = (width > newWidth || height > newHeight) ? true : false, dims = iL.getNewDimenstions(newWidth, newHeight, width, height, scale); newWidth = dims.width, newHeight = dims.height; } currentHolder.data({ naturalWidthOld: currentHolder.data('naturalWidth'), naturalHeightOld: currentHolder.data('naturalHeight'), naturalWidth: newWidth, naturalHeight: newHeight }); } $.each(elements, function(key, val) { val.addClass('ilightbox-fullscreen'); }); //Trigger the onEnterFullScreen callback if (typeof opts.callback.onEnterFullScreen == 'function') opts.callback.onEnterFullScreen.call(iL, iL.ui); } else { vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = false; vars.overlay.css({ opacity: iL.options.overlay.opacity }); $.each(hideElements, function(i, element) { element.show(); }); vars.fullScreenButton.attr('title', opts.text.enterFullscreen); currentHolder.data({ naturalWidth: currentHolder.data('naturalWidthOld'), naturalHeight: currentHolder.data('naturalHeightOld'), naturalWidthOld: null, naturalHeightOld: null }); $.each(elements, function(key, val) { val.removeClass('ilightbox-fullscreen'); }); //Trigger the onExitFullScreen callback if (typeof opts.callback.onExitFullScreen == 'function') opts.callback.onExitFullScreen.call(iL, iL.ui); } } else { if (!vars.isInFullScreen) vars.isInFullScreen = true; else vars.isInFullScreen = false; } iL.repositionPhoto(true); }, closeAction: function() { var iL = this, vars = iL.vars, opts = iL.options; $win.unbind('.iLightBox'); $doc.off('.iLightBox'); if (vars.isInFullScreen) fullScreenApi.cancelFullScreen(document.documentElement); $('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails').off('.iLightBox'); if (opts.hide.effect) vars.overlay.stop().fadeOut(opts.hide.speed, function() { vars.overlay.remove(); vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox'); }); else { vars.overlay.remove(); vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox'); } var fadeOuts = [vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails]; $.each(fadeOuts, function(i, element) { element.removeAttr('style').remove(); }); vars.dontGenerateThumbs = vars.isInFullScreen = false; window.iLightBox = null; if (opts.linkId) { vars.hashLock = true; removeHash(); setTimeout(function() { vars.hashLock = false; }, 55); } //Trigger the onHide callback if (typeof opts.callback.onHide == 'function') opts.callback.onHide.call(iL, iL.ui); }, repositionPhoto: function() { var iL = this, vars = iL.vars, opts = iL.options, path = opts.path.toLowerCase(), viewport = getViewport(), winWidth = viewport.width, winHeight = viewport.height; var thumbsOffsetW = (vars.isInFullScreen && opts.fullAlone || vars.isMobile) ? 0 : ((path == 'horizontal') ? 0 : vars.thumbnails.outerWidth()), thumbsOffsetH = vars.isMobile ? vars.toolbar.outerHeight() : ((vars.isInFullScreen && opts.fullAlone) ? 0 : ((path == 'horizontal') ? vars.thumbnails.outerHeight() : 0)), width = (vars.isInFullScreen && opts.fullAlone) ? winWidth : (winWidth - (opts.styles.pageOffsetX)), height = (vars.isInFullScreen && opts.fullAlone) ? winHeight : (winHeight - (opts.styles.pageOffsetY)), offsetW = (path == 'horizontal') ? parseInt((iL.items[vars.next] || iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2 : (((width / 10) <= 30) ? 30 : (width / 10))) : parseInt(((width / 10) <= 30) ? 30 : (width / 10)) + thumbsOffsetW, offsetH = (path == 'horizontal') ? parseInt(((height / 10) <= 30) ? 30 : (height / 10)) + thumbsOffsetH : parseInt((iL.items[vars.next] || iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2 : (((height / 10) <= 30) ? 30 : (height / 10))); var elObject = { type: 'current', width: width, height: height, item: iL.items[vars.current], offsetW: offsetW, offsetH: offsetH, thumbsOffsetW: thumbsOffsetW, thumbsOffsetH: thumbsOffsetH, animate: arguments.length, holder: vars.holder }; iL.repositionEl(elObject); if (iL.items[vars.next]) { elObject = $.extend(elObject, { type: 'next', item: iL.items[vars.next], offsetX: opts.styles.nextOffsetX, offsetY: opts.styles.nextOffsetY, holder: vars.nextPhoto }); iL.repositionEl(elObject); } if (iL.items[vars.prev]) { elObject = $.extend(elObject, { type: 'prev', item: iL.items[vars.prev], offsetX: opts.styles.prevOffsetX, offsetY: opts.styles.prevOffsetY, holder: vars.prevPhoto }); iL.repositionEl(elObject); } var loaderCss = (path == "horizontal") ? { left: parseInt((width / 2) - (vars.loader.outerWidth() / 2)) } : { top: parseInt((height / 2) - (vars.loader.outerHeight() / 2)) }; vars.loader.css(loaderCss); }, repositionEl: function(obj) { var iL = this, vars = iL.vars, opts = iL.options, path = opts.path.toLowerCase(), widthAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.width : (obj.width - obj.offsetW)) : (obj.width - obj.offsetW), heightAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.height : (obj.height - obj.offsetH)) : (obj.height - obj.offsetH), itemParent = obj.item, item = obj.item.options, holder = obj.holder, offsetX = obj.offsetX || 0, offsetY = obj.offsetY || 0, thumbsOffsetW = obj.thumbsOffsetW, thumbsOffsetH = obj.thumbsOffsetH; if (obj.type == 'current') { if (typeof item.width == 'number' && item.width) widthAvail = ((vars.isInFullScreen && opts.fullAlone) && (opts.fullStretchTypes.indexOf(itemParent.type) != -1 || item.fullViewPort || opts.fullViewPort)) ? widthAvail : ((item.width > widthAvail) ? widthAvail : item.width); if (typeof item.height == 'number' && item.height) heightAvail = ((vars.isInFullScreen && opts.fullAlone) && (opts.fullStretchTypes.indexOf(itemParent.type) != -1 || item.fullViewPort || opts.fullViewPort)) ? heightAvail : ((item.height > heightAvail) ? heightAvail : item.height); } else { if (typeof item.width == 'number' && item.width) widthAvail = (item.width > widthAvail) ? widthAvail : item.width; if (typeof item.height == 'number' && item.height) heightAvail = (item.height > heightAvail) ? heightAvail : item.height; } if (opts.innerToolbar) heightAvail = parseInt(heightAvail - $('.ilightbox-inner-toolbar', holder).outerHeight()); var width = (typeof item.width == 'string' && item.width.indexOf('%') != -1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width) : holder.data('naturalWidth'), height = (typeof item.height == 'string' && item.height.indexOf('%') != -1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height) : holder.data('naturalHeight'); var dims = ((typeof item.width == 'string' && item.width.indexOf('%') != -1 || typeof item.height == 'string' && item.height.indexOf('%') != -1) ? { width: width, height: height } : iL.getNewDimenstions(widthAvail, heightAvail, width, height)), newDims = $.extend({}, dims, {}); if (obj.type == 'prev' || obj.type == 'next') width = parseInt(dims.width * ((obj.type == 'next') ? opts.styles.nextScale : opts.styles.prevScale)), height = parseInt(dims.height * ((obj.type == 'next') ? opts.styles.nextScale : opts.styles.prevScale)); else width = dims.width, height = dims.height; var widthDiff = parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2), heightDiff = parseInt((getPixel(holder, 'padding-top') + getPixel(holder, 'padding-bottom') + getPixel(holder, 'border-top-width') + getPixel(holder, 'border-bottom-width') + ($('.ilightbox-inner-toolbar', holder).outerHeight() || 0)) / 2); switch (obj.type) { case 'current': var top = parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)), left = parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2)); break; case 'next': var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)), left = (path == 'horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2)); break; case 'prev': var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)), left = (path == 'horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2)); break; } holder.data('offset', { top: top, left: left, newDims: newDims, diff: { W: widthDiff, H: heightDiff }, thumbsOffset: { W: thumbsOffsetW, H: thumbsOffsetH }, object: obj }); if (obj.animate > 0 && opts.effects.reposition) { holder.css(transform, gpuAcceleration).stop().animate({ top: top, left: left }, opts.effects.repositionSpeed, 'easeOutCirc', function() { holder.css(transform, ''); }); $('div.ilightbox-container', holder).stop().animate({ width: width, height: height }, opts.effects.repositionSpeed, 'easeOutCirc'); $('div.ilightbox-inner-toolbar', holder).stop().animate({ width: width }, opts.effects.repositionSpeed, 'easeOutCirc', function() { $(this).css('overflow', 'visible'); }); } else { holder.css({ top: top, left: left }); $('div.ilightbox-container', holder).css({ width: width, height: height }); $('div.ilightbox-inner-toolbar', holder).css({ width: width }); } }, resume: function(priority) { var iL = this, vars = iL.vars, opts = iL.options; if (!opts.slideshow.pauseTime || opts.controls.slideshow && vars.total <= 1 || priority < vars.isPaused) { return; } vars.isPaused = 0; if (vars.cycleID) { vars.cycleID = clearTimeout(vars.cycleID); } vars.cycleID = setTimeout(function() { if (vars.current == vars.total - 1) iL.goTo(0); else iL.moveTo('next'); }, opts.slideshow.pauseTime); }, pause: function(priority) { var iL = this, vars = iL.vars, opts = iL.options; if (priority < vars.isPaused) { return; } vars.isPaused = priority || 100; if (vars.cycleID) { vars.cycleID = clearTimeout(vars.cycleID); } }, resetCycle: function() { var iL = this, vars = iL.vars, opts = iL.options; if (opts.controls.slideshow && vars.cycleID && !vars.isPaused) { iL.resume(); } }, getNewDimenstions: function(width, height, width_old, height_old, thumb) { var iL = this; if (!width) factor = height / height_old; else if (!height) factor = width / width_old; else factor = min(width / width_old, height / height_old); if (!thumb) { if (factor > iL.options.maxScale) factor = iL.options.maxScale; else if (factor < iL.options.minScale) factor = iL.options.minScale; } var final_width = (iL.options.keepAspectRatio) ? round(width_old * factor) : width, final_height = (iL.options.keepAspectRatio) ? round(height_old * factor) : height; return { width: final_width, height: final_height, ratio: factor }; }, setOption: function(options) { var iL = this; iL.options = $.extend(true, iL.options, options || {}); iL.refresh(); }, availPlugins: function() { var iL = this, testEl = document.createElement("video"); iL.plugins = { flash: !isMobile, quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >= 0) ? true : false, html5H264: !!(testEl.canPlayType && testEl.canPlayType('video/mp4').replace(/no/, '')), html5WebM: !!(testEl.canPlayType && testEl.canPlayType('video/webm').replace(/no/, '')), html5Vorbis: !!(testEl.canPlayType && testEl.canPlayType('video/ogg').replace(/no/, '')), html5QuickTime: !!(testEl.canPlayType && testEl.canPlayType('video/quicktime').replace(/no/, '')) }; }, addContent: function(element, obj) { var iL = this, el; switch (obj.type) { case 'video': var HTML5 = false, videoType = obj.videoType, html5video = obj.options.html5video; if (((videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v') || html5video.h264) && iL.plugins.html5H264) obj.ext = 'mp4', obj.URL = html5video.h264 || obj.URL; else if (html5video.webm && iL.plugins.html5WebM) obj.ext = 'webm', obj.URL = html5video.webm || obj.URL; else if (html5video.ogg && iL.plugins.html5Vorbis) obj.ext = 'ogv', obj.URL = html5video.ogg || obj.URL; if (iL.plugins.html5H264 && (videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v')) HTML5 = true, videoType = "video/mp4"; else if (iL.plugins.html5WebM && (videoType == 'video/webm' || obj.ext == 'webm')) HTML5 = true, videoType = "video/webm"; else if (iL.plugins.html5Vorbis && (videoType == 'video/ogg' || obj.ext == 'ogv')) HTML5 = true, videoType = "video/ogg"; else if (iL.plugins.html5QuickTime && (videoType == 'video/quicktime' || obj.ext == 'mov' || obj.ext == 'qt')) HTML5 = true, videoType = "video/quicktime"; if (HTML5) { el = $('