1var currentLigthbox; 2(function($, window, undefined) { 3 var extensions = { 4 flash: ['swf'], 5 image: ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff', 'tif', 'jfif', 'jpe'], 6 iframe: ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'jsp', 'php', 'pl', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt'], 7 video: ['avi', 'mov', 'mpg', 'mpeg', 'movie', 'mp4', 'webm', 'ogv', 'ogg', '3gp', 'm4v'] 8 }, 9 $win = $(window), 10 $doc = $(document), 11 browser, transform, gpuAcceleration, fullScreenApi = '', 12 userAgent = navigator.userAgent || navigator.vendor || window.opera, 13 supportTouch = !!('ontouchstart' in window) && (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)), 14 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)), 15 clickEvent = supportTouch ? "itap.iLightBox" : "click.iLightBox", 16 touchStartEvent = supportTouch ? "touchstart.iLightBox" : "mousedown.iLightBox", 17 touchStopEvent = supportTouch ? "touchend.iLightBox" : "mouseup.iLightBox", 18 touchMoveEvent = supportTouch ? "touchmove.iLightBox" : "mousemove.iLightBox", 19 abs = Math.abs, 20 sqrt = Math.sqrt, 21 round = Math.round, 22 max = Math.max, 23 min = Math.min, 24 floor = Math.floor, 25 random = Math.random, 26 pluginspages = { 27 quicktime: 'http://www.apple.com/quicktime/download', 28 flash: 'http://www.adobe.com/go/getflash' 29 }, 30 iLightBox = function(el, options, items, instant) { 31 var iL = this; 32 iL.options = options, iL.selector = el.selector || el, iL.context = el.context, iL.instant = instant; 33 if (items.length < 1) 34 iL.attachItems(); 35 else iL.items = items; 36 iL.vars = { 37 total: iL.items.length, 38 start: 0, 39 current: null, 40 next: null, 41 prev: null, 42 BODY: $('body'), 43 loadRequests: 0, 44 overlay: $('<div class="ilightbox-overlay"></div>'), 45 loader: $('<div class="ilightbox-loader"><div></div></div>'),
46 toolbar: $('<div class="ilightbox-toolbar"></div>'), 47 innerToolbar: $('<div class="ilightbox-inner-toolbar"></div>'), 48 title: $('<div class="ilightbox-title"></div>'), 49 closeButton: $('<a class="ilightbox-close" title="' + iL.options.text.close + '"></a>'), 50 fullScreenButton: $('<a class="ilightbox-fullscreen" title="' + iL.options.text.enterFullscreen + '"></a>'), 51 innerPlayButton: $('<a class="ilightbox-play" title="' + iL.options.text.slideShow + '"></a>'), 52 innerNextButton: $('<a class="ilightbox-next-button" title="' + iL.options.text.next + '"></a>'), 53 innerPrevButton: $('<a class="ilightbox-prev-button" title="' + iL.options.text.previous + '"></a>'), 54 holder: $('<div class="ilightbox-holder' + (supportTouch ? ' supportTouch' : '') + '" ondragstart="return false;"><div class="ilightbox-container"></div></div>'), 55 nextPhoto: $('<div class="ilightbox-holder' + (supportTouch ? ' supportTouch' : '') + ' ilightbox-next" ondragstart="return false;"><div class="ilightbox-container"></div></div>'), 56 prevPhoto: $('<div class="ilightbox-holder' + (supportTouch ? ' supportTouch' : '') + ' ilightbox-prev" ondragstart="return false;"><div class="ilightbox-container"></div></div>'), 57 nextButton: $('<a class="ilightbox-button ilightbox-next-button" ondragstart="return false;" title="' + iL.options.text.next + '"><span></span></a>'), 58 prevButton: $('<a class="ilightbox-button ilightbox-prev-button" ondragstart="return false;" title="' + iL.options.text.previous + '"><span></span></a>'), 59 thumbnails: $('<div class="ilightbox-thumbnails" ondragstart="return false;"><div class="ilightbox-thumbnails-container"><a class="ilightbox-thumbnails-dragger"></a><div class="ilightbox-thumbnails-grid"></div></div></div>'), 60 thumbs: !1, 61 nextLock: !1, 62 prevLock: !1, 63 hashLock: !1, 64 isMobile: !1, 65 mobileMaxWidth: 980, 66 isInFullScreen: !1, 67 isSwipe: !1, 68 mouseID: 0, 69 cycleID: 0, 70 isPaused: 0 71 }; 72 iL.vars.hideableElements = iL.vars.nextButton.add(iL.vars.prevButton); 73 iL.normalizeItems(); 74 iL.availPlugins(); 75 iL.options.startFrom = (iL.options.startFrom > 0 && iL.options.startFrom >= iL.vars.total) ? iL.vars.total - 1 : iL.options.startFrom; 76 iL.options.startFrom = (iL.options.randomStart) ? floor(random() * iL.vars.total) : iL.options.startFrom; 77 iL.vars.start = iL.options.startFrom; 78 if (instant) 79 iL.instantCall(); 80 else iL.patchItemsEvents(); 81 if (iL.options.linkId) { 82 iL.hashChangeHandler(); 83 $win.iLightBoxHashChange(function() { 84 iL.hashChangeHandler() 85 }) 86 } 87 if (supportTouch) { 88 var RegExp = /(click|mouseenter|mouseleave|mouseover|mouseout)/ig, 89 replace = "itap"; 90 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) 91 } 92 if (iL.options.controls.arrows) { 93 $.extend(iL.options.styles, { 94 nextOffsetX: 0, 95 prevOffsetX: 0, 96 nextOpacity: 0, 97 prevOpacity: 0 98 }) 99 } 100 }; 101 iLightBox.prototype = { 102 showLoader: function() { 103 var iL = this; 104 iL.vars.loadRequests += 1; 105 if (iL.options.path.toLowerCase() == "horizontal") 106 iL.vars.loader.stop().animate({ 107 top: '-30px' 108 }, iL.options.show.speed, 'easeOutCirc'); 109 else iL.vars.loader.stop().animate({ 110 left: '-30px' 111 }, iL.options.show.speed, 'easeOutCirc') 112 }, 113 hideLoader: function() { 114 var iL = this; 115 iL.vars.loadRequests -= 1; 116 iL.vars.loadRequests = (iL.vars.loadRequests < 0) ? 0 : iL.vars.loadRequests; 117 if (iL.options.path.toLowerCase() == "horizontal") { 118 if (iL.vars.loadRequests <= 0) 119 iL.vars.loader.stop().animate({ 120 top: '-192px' 121 }, iL.options.show.speed, 'easeInCirc') 122 } else { 123 if (iL.vars.loadRequests <= 0) 124 iL.vars.loader.stop().animate({ 125 left: '-192px' 126 }, iL.options.show.speed, 'easeInCirc') 127 } 128 }, 129 createUI: function() { 130 var iL = this; 131 iL.ui = { 132 currentElement: iL.vars.holder, 133 nextElement: iL.vars.nextPhoto, 134 prevElement: iL.vars.prevPhoto, 135 currentItem: iL.vars.current, 136 nextItem: iL.vars.next, 137 prevItem: iL.vars.prev, 138 hide: function() { 139 iL.closeAction() 140 }, 141 refresh: function() { 142 (arguments.length > 0) ? iL.repositionPhoto(!0): iL.repositionPhoto() 143 }, 144 fullscreen: function() { 145 iL.fullScreenAction() 146 } 147 } 148 }, 149 attachItems: function() { 150 var iL = this, 151 itemsObject = new Array(), 152 items = new Array(); 153 $(iL.selector, iL.context).each(function() { 154 var t = $(this), 155 URL = t.attr(iL.options.attr) || null, 156 options = t.data("options") && eval("({" + t.data("options") + "})") || {}, 157 caption = t.data('caption'), 158 title = t.data('title'), 159 type = t.data('type') || getTypeByExtension(URL); 160 items.push({ 161 URL: URL, 162 caption: caption, 163 title: title, 164 type: type, 165 options: options 166 }); 167 if (!iL.instant) 168 itemsObject.push(t) 169 }); 170 iL.items = items, iL.itemsObject = itemsObject 171 }, 172 normalizeItems: function() { 173 var iL = this, 174 newItems = new Array(); 175 $.each(iL.items, function(key, val) { 176 if (typeof val == "string") 177 val = { 178 url: val 179 }; 180 var URL = val.url || val.URL || null, 181 options = val.options || {}, 182 caption = val.caption || null, 183 title = val.title || null, 184 type = (val.type) ? val.type.toLowerCase() : getTypeByExtension(URL), 185 ext = (typeof URL != 'object') ? getExtension(URL) : ''; 186 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 : !0, options.swipe = (typeof options.swipe != 'undefined') ? options.swipe : !0, options.social = (typeof options.social != 'undefined') ? options.social : iL.options.social.buttons && $.extend({}, {}, iL.options.social.buttons); 187 if (type == "video") { 188 options.html5video = (typeof options.html5video != 'undefined') ? options.html5video : {}; 189 options.html5video.webm = options.html5video.webm || options.html5video.WEBM || null; 190 options.html5video.controls = (typeof options.html5video.controls != 'undefined') ? options.html5video.controls : "controls"; 191 options.html5video.preload = options.html5video.preload || "metadata"; 192 options.html5video.autoplay = (typeof options.html5video.autoplay != 'undefined') ? options.html5video.autoplay : !1 193 } 194 if (!options.width || !options.height) { 195 if (type == "video") 196 options.width = 1280, options.height = 720; 197 else if (type == "iframe") 198 options.width = '100%', options.height = '90%'; 199 else if (type == "flash") 200 options.width = 1280, options.height = 720 201 } 202 delete val.url; 203 val.index = key; 204 val.URL = URL; 205 val.caption = caption; 206 val.title = title; 207 val.type = type; 208 val.options = options; 209 val.ext = ext; 210 newItems.push(val) 211 }); 212 iL.items = newItems 213 }, 214 instantCall: function() { 215 var iL = this, 216 key = iL.vars.start; 217 iL.vars.current = key; 218 iL.vars.next = (iL.items[key + 1]) ? key + 1 : null; 219 iL.vars.prev = (iL.items[key - 1]) ? key - 1 : null; 220 iL.addContents(); 221 iL.patchEvents() 222 }, 223 addContents: function() { 224 var iL = this, 225 vars = iL.vars, 226 opts = iL.options, 227 viewport = getViewport(), 228 path = opts.path.toLowerCase(), 229 recognizingItems = vars.total > 0 && iL.items.filter(function(e, i, arr) { 230 return ['image', 'flash', 'video'].indexOf(e.type) === -1 && typeof e.recognized === 'undefined' && (opts.smartRecognition || e.options.smartRecognition) 231 }), 232 needRecognition = recognizingItems.length > 0;
233 if (opts.mobileOptimizer && !opts.innerToolbar) 234 vars.isMobile = viewport.width <= vars.mobileMaxWidth; 235 vars.overlay.addClass(opts.skin).hide().css('opacity', opts.overlay.opacity); 236 if (opts.linkId) 237 vars.overlay[0].setAttribute('linkid', opts.linkId); 238 if (opts.controls.toolbar) { 239 vars.toolbar.addClass(opts.skin).append(vars.closeButton); 240 if (opts.controls.fullscreen) 241 vars.toolbar.append(vars.fullScreenButton); 242 if (opts.controls.slideshow) 243 vars.toolbar.append(vars.innerPlayButton); 244 if (vars.total > 1) 245 vars.toolbar.append(vars.innerPrevButton).append(vars.innerNextButton) 246 } 247 vars.BODY.addClass('ilightbox-noscroll').append(vars.overlay).append(vars.loader).append(vars.holder).append(vars.nextPhoto).append(vars.prevPhoto); 248 if (!opts.innerToolbar) 249 vars.BODY.append(vars.toolbar); 250 if (opts.controls.arrows) 251 vars.BODY.append(vars.nextButton).append(vars.prevButton); 252 if (opts.controls.thumbnail && vars.total > 1) { 253 vars.BODY.append(vars.thumbnails); 254 vars.thumbnails.addClass(opts.skin).addClass('ilightbox-' + path); 255 $('div.ilightbox-thumbnails-grid', vars.thumbnails).empty(); 256 vars.thumbs = !0 257 } 258 var loaderCss = (opts.path.toLowerCase() == "horizontal") ? { 259 left: parseInt((viewport.width / 2) - (vars.loader.outerWidth() / 2)) 260 } : { 261 top: parseInt((viewport.height / 2) - (vars.loader.outerHeight() / 2)) 262 }; 263 vars.loader.addClass(opts.skin).css(loaderCss); 264 vars.nextButton.add(vars.prevButton).addClass(opts.skin); 265 if (path == "horizontal") 266 vars.loader.add(vars.nextButton).add(vars.prevButton).addClass('horizontal'); 267 vars.BODY[vars.isMobile ? 'addClass' : 'removeClass']('isMobile'); 268 if (!opts.infinite) { 269 vars.prevButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled'); 270 if (vars.current == 0) 271 vars.prevButton.add(vars.innerPrevButton).addClass('disabled'); 272 if (vars.current >= vars.total - 1) 273 vars.nextButton.add(vars.innerNextButton).addClass('disabled') 274 } 275 if (opts.show.effect) { 276 vars.overlay.stop().fadeIn(opts.show.speed); 277 vars.toolbar.stop().fadeIn(opts.show.speed) 278 } else { 279 vars.overlay.show(); 280 vars.toolbar.show() 281 } 282 var length = recognizingItems.length; 283 if (needRecognition) { 284 iL.showLoader(); 285 $.each(recognizingItems, function(key, val) { 286 var resultFnc = function(result) { 287 console.log(result); 288 var key = -1, 289 filter = iL.items.filter(function(e, i, arr) { 290 if (e.URL == result.url) 291 key = i; 292 return e.URL == result.url 293 }), 294 self = iL.items[key]; 295 if (result) 296 $.extend(!0, self, { 297 URL: result.source, 298 type: result.type, 299 recognized: !0, 300 options: { 301 html5video: result.html5video, 302 width: (result.type == "image") ? 0 : (result.width || self.width), 303 height: (result.type == "image") ? 0 : (result.height || self.height), 304 thumbnail: self.options.thumbnail || result.thumbnail 305 } 306 }); 307 length--; 308 if (length == 0) { 309 iL.hideLoader(); 310 vars.dontGenerateThumbs = !1; 311 iL.generateThumbnails(); 312 if (opts.show.effect) 313 setTimeout(function() { 314 iL.generateBoxes() 315 }, opts.show.speed); 316 else iL.generateBoxes() 317 } 318 }; 319 iL.ogpRecognition(this, resultFnc) 320 }) 321 } else { 322 if (opts.show.effect) 323 setTimeout(function() { 324 iL.generateBoxes() 325 }, opts.show.speed); 326 else iL.generateBoxes() 327 } 328 iL.createUI(); 329 window.iLightBox = { 330 close: function() { 331 iL.closeAction() 332 }, 333 fullscreen: function() { 334 iL.fullScreenAction() 335 }, 336 moveNext: function() { 337 iL.moveTo('next') 338 }, 339 movePrev: function() { 340 iL.moveTo('prev') 341 }, 342 goTo: function(index) { 343 iL.goTo(index) 344 }, 345 refresh: function() { 346 iL.refresh() 347 }, 348 reposition: function() { 349 (arguments.length > 0) ? iL.repositionPhoto(!0): iL.repositionPhoto() 350 }, 351 setOption: function(options) { 352 iL.setOption(options) 353 }, 354 destroy: function() { 355 iL.closeAction(); 356 iL.dispatchItemsEvents() 357 } 358 }; 359 if (opts.linkId) { 360 vars.hashLock = !0; 361 window.location.hash = opts.linkId + '/' + vars.current; 362 setTimeout(function() { 363 vars.hashLock = !1 364 }, 55) 365 } 366 if (!opts.slideshow.startPaused) { 367 iL.resume(); 368 vars.innerPlayButton.removeClass('ilightbox-play').addClass('ilightbox-pause') 369 } 370 if (typeof iL.options.callback.onOpen == 'function') 371 iL.options.callback.onOpen.call(iL) 372 }, 373 loadContent: function(obj, opt, speed) { 374 var iL = this, 375 holder, item; 376 iL.createUI(); 377 obj.speed = speed || iL.options.effects.loadedFadeSpeed; 378 if (opt == 'current') { 379 if (!obj.options.mousewheel) 380 iL.vars.lockWheel = !0; 381 else iL.vars.lockWheel = !1; 382 if (!obj.options.swipe) 383 iL.vars.lockSwipe = !0; 384 else iL.vars.lockSwipe = !1 385 } 386 switch (opt) { 387 case 'current': 388 holder = iL.vars.holder, item = iL.vars.current; 389 break; 390 case 'next': 391 holder = iL.vars.nextPhoto, item = iL.vars.next; 392 break; 393 case 'prev': 394 holder = iL.vars.prevPhoto, item = iL.vars.prev; 395 break 396 } 397 holder.removeAttr('style class').addClass('ilightbox-holder' + (supportTouch ? ' supportTouch' : '')).addClass(obj.options.skin); 398 $('div.ilightbox-inner-toolbar', holder).remove(); 399 if (obj.title || iL.options.innerToolbar) { 400 var innerToolbar = iL.vars.innerToolbar.clone(); 401 if (obj.title && iL.options.show.title) { 402 var title = iL.vars.title.clone(); 403 title.empty().html(obj.title); 404 innerToolbar.append(title) 405 } 406 if (iL.options.innerToolbar) { 407 innerToolbar.append((iL.vars.total > 1) ? iL.vars.toolbar.clone() : iL.vars.toolbar) 408 } 409 holder.prepend(innerToolbar) 410 } 411 iL.loadSwitcher(obj, holder, item, opt) 412 }, 413 loadSwitcher: function(obj, holder, item, opt) { 414 var iL = this, 415 opts = iL.options, 416 api = { 417 element: holder, 418 position: item 419 }; 420 switch (obj.type) { 421 case 'image': 422 if (typeof opts.callback.onBeforeLoad == 'function') 423 opts.callback.onBeforeLoad.call(iL, iL.ui, item); 424 if (typeof obj.options.onBeforeLoad == 'function') 425 obj.options.onBeforeLoad.call(iL, api); 426 iL.loadImage(obj.URL, function(img) { 427 if (typeof opts.callback.onAfterLoad == 'function') 428 opts.callback.onAfterLoad.call(iL, iL.ui, item); 429 if (typeof obj.options.onAfterLoad == 'function') 430 obj.options.onAfterLoad.call(iL, api); 431 var width = (img) ? img.width : 400, 432 height = (img) ? img.height : 200; 433 holder.data({
434 naturalWidth: width, 435 naturalHeight: height 436 }); 437 $('div.ilightbox-container', holder).empty().append((img) ? '<img src="' + obj.URL + '" class="ilightbox-image" />' : '<span class="ilightbox-alert">' + opts.errors.loadImage + '</span>'); 438 if (typeof opts.callback.onRender == 'function') 439 opts.callback.onRender.call(iL, iL.ui, item); 440 if (typeof obj.options.onRender == 'function') 441 obj.options.onRender.call(iL, api); 442 iL.configureHolder(obj, opt, holder) 443 }); 444 break; 445 case 'video': 446 holder.data({ 447 naturalWidth: obj.options.width, 448 naturalHeight: obj.options.height 449 }); 450 iL.addContent(holder, obj); 451 if (typeof opts.callback.onRender == 'function') 452 opts.callback.onRender.call(iL, iL.ui, item); 453 if (typeof obj.options.onRender == 'function') 454 obj.options.onRender.call(iL, api); 455 iL.configureHolder(obj, opt, holder); 456 break; 457 case 'iframe': 458 iL.showLoader(); 459 holder.data({ 460 naturalWidth: obj.options.width, 461 naturalHeight: obj.options.height 462 }); 463 var el = iL.addContent(holder, obj); 464 if (typeof opts.callback.onRender == 'function') 465 opts.callback.onRender.call(iL, iL.ui, item); 466 if (typeof obj.options.onRender == 'function') 467 obj.options.onRender.call(iL, api); 468 if (typeof opts.callback.onBeforeLoad == 'function') 469 opts.callback.onBeforeLoad.call(iL, iL.ui, item); 470 if (typeof obj.options.onBeforeLoad == 'function') 471 obj.options.onBeforeLoad.call(iL, api); 472 el.bind('load', function() { 473 if (typeof opts.callback.onAfterLoad == 'function') 474 opts.callback.onAfterLoad.call(iL, iL.ui, item); 475 if (typeof obj.options.onAfterLoad == 'function') 476 obj.options.onAfterLoad.call(iL, api); 477 iL.hideLoader(); 478 iL.configureHolder(obj, opt, holder); 479 el.unbind('load') 480 }); 481 break; 482 case 'inline': 483 var el = $(obj.URL), 484 content = iL.addContent(holder, obj), 485 images = findImageInElement(holder); 486 holder.data({ 487 naturalWidth: (iL.items[item].options.width || el.outerWidth()), 488 naturalHeight: (iL.items[item].options.height || el.outerHeight()) 489 }); 490 content.children().eq(0).show(); 491 if (typeof opts.callback.onRender == 'function') 492 opts.callback.onRender.call(iL, iL.ui, item); 493 if (typeof obj.options.onRender == 'function') 494 obj.options.onRender.call(iL, api); 495 if (typeof opts.callback.onBeforeLoad == 'function') 496 opts.callback.onBeforeLoad.call(iL, iL.ui, item); 497 if (typeof obj.options.onBeforeLoad == 'function') 498 obj.options.onBeforeLoad.call(iL, api); 499 iL.loadImage(images, function() { 500 if (typeof opts.callback.onAfterLoad == 'function') 501 opts.callback.onAfterLoad.call(iL, iL.ui, item); 502 if (typeof obj.options.onAfterLoad == 'function') 503 obj.options.onAfterLoad.call(iL, api); 504 iL.configureHolder(obj, opt, holder) 505 }); 506 break; 507 case 'flash': 508 var el = iL.addContent(holder, obj); 509 holder.data({
510 naturalWidth: (iL.items[item].options.width || el.outerWidth()), 511 naturalHeight: (iL.items[item].options.height || el.outerHeight()) 512 }); 513 if (typeof opts.callback.onRender == 'function') 514 opts.callback.onRender.call(iL, iL.ui, item); 515 if (typeof obj.options.onRender == 'function') 516 obj.options.onRender.call(iL, api); 517 iL.configureHolder(obj, opt, holder); 518 break; 519 case 'ajax': 520 var ajax = obj.options.ajax || {}; 521 if (typeof opts.callback.onBeforeLoad == 'function') 522 opts.callback.onBeforeLoad.call(iL, iL.ui, item); 523 if (typeof obj.options.onBeforeLoad == 'function') 524 obj.options.onBeforeLoad.call(iL, api); 525 iL.showLoader(); 526 $.ajax({ 527 url: obj.URL || opts.ajaxSetup.url, 528 data: ajax.data || null, 529 dataType: ajax.dataType || "html", 530 type: ajax.type || opts.ajaxSetup.type, 531 cache: ajax.cache || opts.ajaxSetup.cache, 532 crossDomain: ajax.crossDomain || opts.ajaxSetup.crossDomain, 533 global: ajax.global || opts.ajaxSetup.global, 534 ifModified: ajax.ifModified || opts.ajaxSetup.ifModified, 535 username: ajax.username || opts.ajaxSetup.username, 536 password: ajax.password || opts.ajaxSetup.password, 537 beforeSend: ajax.beforeSend || opts.ajaxSetup.beforeSend, 538 complete: ajax.complete || opts.ajaxSetup.complete, 539 success: function(data, textStatus, jqXHR) { 540 iL.hideLoader(); 541 var el = $(data), 542 container = $('div.ilightbox-container', holder), 543 elWidth = iL.items[item].options.width || parseInt(el[0].getAttribute('width')), 544 elHeight = iL.items[item].options.height || parseInt(el[0].getAttribute('height')), 545 css = (el[0].getAttribute('width') && el[0].getAttribute('height')) ? { 546 'overflow': 'hidden' 547 } : {}; 548 container.empty().append($('<div class="ilightbox-wrapper"></div>').css(css).html(el)); 549 holder.show().data({ 550 naturalWidth: (elWidth || container.outerWidth()), 551 naturalHeight: (elHeight || container.outerHeight()) 552 }).hide(); 553 if (typeof opts.callback.onRender == 'function') 554 opts.callback.onRender.call(iL, iL.ui, item); 555 if (typeof obj.options.onRender == 'function') 556 obj.options.onRender.call(iL, api); 557 var images = findImageInElement(holder); 558 iL.loadImage(images, function() { 559 if (typeof opts.callback.onAfterLoad == 'function') 560 opts.callback.onAfterLoad.call(iL, iL.ui, item); 561 if (typeof obj.options.onAfterLoad == 'function') 562 obj.options.onAfterLoad.call(iL, api); 563 iL.configureHolder(obj, opt, holder) 564 }); 565 opts.ajaxSetup.success(data, textStatus, jqXHR); 566 if (typeof ajax.success == 'function') 567 ajax.success(data, textStatus, jqXHR) 568 }, 569 error: function(jqXHR, textStatus, errorThrown) { 570 if (typeof opts.callback.onAfterLoad == 'function') 571 opts.callback.onAfterLoad.call(iL, iL.ui, item); 572 if (typeof obj.options.onAfterLoad == 'function') 573 obj.options.onAfterLoad.call(iL, api); 574 iL.hideLoader(); 575 $('div.ilightbox-container', holder).empty().append('<span class="ilightbox-alert">
575' + opts.errors.loadContents + '</span>'); 576 iL.configureHolder(obj, opt, holder); 577 opts.ajaxSetup.error(jqXHR, textStatus, errorThrown); 578 if (typeof ajax.error == 'function') 579 ajax.error(jqXHR, textStatus, errorThrown) 580 } 581 }); 582 break; 583 case 'html': 584 var object = obj.URL, 585 el 586 container = $('div.ilightbox-container', holder); 587 if (object[0].nodeName) 588 el = object.clone(); 589 else { 590 var dom = $(object); 591 if (dom.selector) 592 el = $('<div>' + dom + '</div>'); 593 else el = dom 594 } 595 var elWidth = iL.items[item].options.width || parseInt(el.attr('width')), 596 elHeight = iL.items[item].options.height || parseInt(el.attr('height')); 597 iL.addContent(holder, obj); 598 el.appendTo(document.documentElement).hide(); 599 if (typeof opts.callback.onRender == 'function') 600 opts.callback.onRender.call(iL, iL.ui, item); 601 if (typeof obj.options.onRender == 'function') 602 obj.options.onRender.call(iL, api); 603 var images = findImageInElement(holder); 604 if (typeof opts.callback.onBeforeLoad == 'function') 605 opts.callback.onBeforeLoad.call(iL, iL.ui, item); 606 if (typeof obj.options.onBeforeLoad == 'function') 607 obj.options.onBeforeLoad.call(iL, api); 608 iL.loadImage(images, function() { 609 if (typeof opts.callback.onAfterLoad == 'function') 610 opts.callback.onAfterLoad.call(iL, iL.ui, item); 611 if (typeof obj.options.onAfterLoad == 'function') 612 obj.options.onAfterLoad.call(iL, api); 613 holder.show().data({ 614 naturalWidth: (elWidth || container.outerWidth()), 615 naturalHeight: (elHeight || container.outerHeight()) 616 }).hide(); 617 el.remove(); 618 iL.configureHolder(obj, opt, holder) 619 }); 620 break 621 } 622 }, 623 configureHolder: function(obj, opt, holder) { 624 var iL = this, 625 vars = iL.vars, 626 opts = iL.options; 627 if (opt != "current")(opt == "next") ? holder.addClass('ilightbox-next') : holder.addClass('ilightbox-prev'); 628 if (opt == "current") 629 var item = vars.current; 630 else if (opt == "next") 631 var opacity = opts.styles.nextOpacity, 632 item = vars.next; 633 else var opacity = opts.styles.prevOpacity, 634 item = vars.prev; 635 var api = { 636 element: holder, 637 position: item 638 }; 639 iL.items[item].options.width = iL.items[item].options.width || 0, iL.items[item].options.height = iL.items[item].options.height || 0; 640 if (opt == "current") { 641 if (opts.show.effect) 642 holder.css(transform, gpuAcceleration).fadeIn(obj.speed, function() { 643 holder.css(transform, ''); 644 if (obj.caption) { 645 iL.setCaption(obj, holder); 646 var caption = $('div.ilightbox-caption', holder), 647 percent = parseInt((caption.outerHeight() / holder.outerHeight()) * 100); 648 if (opts.caption.start & percent <= 50) 649 caption.fadeIn(opts.effects.fadeSpeed) 650 } 651 var social = obj.options.social; 652 if (social) { 653 iL.setSocial(social, obj.URL, holder); 654 if (opts.social.start) 655 $('div.ilightbox-social', holder).fadeIn(opts.effects.fade
655Speed) 656 } 657 iL.generateThumbnails(); 658 if (typeof opts.callback.onShow == 'function') 659 opts.callback.onShow.call(iL, iL.ui, item); 660 if (typeof obj.options.onShow == 'function') 661 obj.options.onShow.call(iL, api) 662 }); 663 else { 664 holder.show(); 665 iL.generateThumbnails(); 666 if (typeof opts.callback.onShow == 'function') 667 opts.callback.onShow.call(iL, iL.ui, item); 668 if (typeof obj.options.onShow == 'function') 669 obj.options.onShow.call(iL, api) 670 } 671 } else { 672 if (opts.show.effect) 673 holder.fadeTo(obj.speed, opacity, function() { 674 if (opt == "next") 675 vars.nextLock = !1; 676 else vars.prevLock = !1; 677 iL.generateThumbnails(); 678 if (typeof opts.callback.onShow == 'function') 679 opts.callback.onShow.call(iL, iL.ui, item); 680 if (typeof obj.options.onShow == 'function') 681 obj.options.onShow.call(iL, api) 682 }); 683 else { 684 holder.css({ 685 opacity: opacity 686 }).show(); 687 if (opt == "next") 688 vars.nextLock = !1; 689 else vars.prevLock = !1; 690 iL.generateThumbnails(); 691 if (typeof opts.callback.onShow == 'function') 692 opts.callback.onShow.call(iL, iL.ui, item); 693 if (typeof obj.options.onShow == 'function') 694 obj.options.onShow.call(iL, api) 695 } 696 } 697 setTimeout(function() { 698 iL.repositionPhoto() 699 }, 0) 700 }, 701 generateBoxes: function() { 702 var iL = this, 703 vars = iL.vars, 704 opts = iL.options; 705 if (opts.infinite && vars.total >= 3) { 706 if (vars.current == vars.total - 1) 707 vars.next = 0; 708 if (vars.current == 0) 709 vars.prev = vars.total - 1 710 } else opts.infinite = !1; 711 iL.loadContent(iL.items[vars.current], 'current', opts.show.speed); 712 if (iL.items[vars.next]) 713 iL.loadContent(iL.items[vars.next], 'next', opts.show.speed); 714 if (iL.items[vars.prev]) 715 iL.loadContent(iL.items[vars.prev], 'prev', opts.show.speed) 716 }, 717 generateThumbnails: function() { 718 var iL = this, 719 vars = iL.vars, 720 opts = iL.options, 721 timeOut = null; 722 if (vars.thumbs && !iL.vars.dontGenerateThumbs) { 723 var thumbnails = vars.thumbnails, 724 container = $('div.ilightbox-thumbnails-container', thumbnails), 725 grid = $('div.ilightbox-thumbnails-grid', container), 726 i = 0; 727 grid.removeAttr('style').empty(); 728 $.each(iL.items, function(key, val) { 729 var isActive = (vars.current == key) ? 'ilightbox-active' : '', 730 opacity = (vars.current == key) ? opts.thumbnails.activeOpacity : opts.thumbnails.normalOpacity, 731 thumb = val.options.thumbnail, 732 thumbnail = $('<div class="ilightbox-thumbnail"></div>'), 733 icon = $('<div class="ilightbox-thumbnail-icon"></div>'); 734 thumbnail.css({ 735 opacity: 0 736 }).addClass(isActive); 737 if ((val.type == "video" || val.type == "flash") && typeof val.options.icon == 'undefined') {
738 icon.addClass('ilightbox-thumbnail-video'); 739 thumbnail.append(icon) 740 } else if (val.options.icon) { 741 icon.addClass('ilightbox-thumbnail-' + val.options.icon); 742 thumbnail.append(icon) 743 } 744 if (thumb) 745 iL.loadImage(thumb, function(img) { 746 i++; 747 if (img) 748 thumbnail.data({ 749 naturalWidth: img.width, 750 naturalHeight: img.height 751 }).append('<img src="' + thumb + '" border="0" />'); 752 else thumbnail.data({ 753 naturalWidth: opts.thumbnails.maxWidth, 754 naturalHeight: opts.thumbnails.maxHeight 755 }); 756 clearTimeout(timeOut); 757 timeOut = setTimeout(function() { 758 iL.positionThumbnails(thumbnails, container, grid) 759 }, 20); 760 setTimeout(function() { 761 thumbnail.fadeTo(opts.effects.loadedFadeSpeed, opacity) 762 }, i * 20) 763 }); 764 grid.append(thumbnail) 765 }); 766 iL.vars.dontGenerateThumbs = !0 767 } 768 }, 769 positionThumbnails: function(thumbnails, container, grid) { 770 var iL = this, 771 vars = iL.vars, 772 opts = iL.options, 773 viewport = getViewport(), 774 path = opts.path.toLowerCase(); 775 if (!thumbnails) 776 thumbnails = vars.thumbnails; 777 if (!container) 778 container = $('div.ilightbox-thumbnails-container', thumbnails); 779 if (!grid) 780 grid = $('div.ilightbox-thumbnails-grid', container); 781 var thumbs = $('.ilightbox-thumbnail', grid), 782 widthAvail = (path == 'horizontal') ? viewport.width - opts.styles.pageOffsetX : thumbs.eq(0).outerWidth() - opts.styles.pageOffsetX, 783 heightAvail = (path == 'horizontal') ? thumbs.eq(0).outerHeight() - opts.styles.pageOffsetY : viewport.height - opts.styles.pageOffsetY, 784 gridWidth = (path == 'horizontal') ? 0 : widthAvail, 785 gridHeight = (path == 'horizontal') ? heightAvail : 0, 786 active = $('.ilightbox-active', grid), 787 gridCss = {}, 788 css = {}; 789 if (arguments.length < 3) { 790 thumbs.css({ 791 opacity: opts.thumbnails.normalOpacity 792 }); 793 active.css({ 794 opacity: opts.thumbnails.activeOpacity 795 }) 796 } 797 thumbs.each(function(i) { 798 var t = $(this), 799 data = t.data(), 800 width = (path == 'horizontal') ? 0 : opts.thumbnails.maxWidth; 801 height = (path == 'horizontal') ? opts.thumbnails.maxHeight : 0; 802 dims = iL.getNewDimenstions(width, height, data.naturalWidth, data.naturalHeight, !0); 803 t.css({ 804 width: dims.width, 805 height: dims.height 806 }); 807 if (path == 'horizontal') 808 t.css({ 809 'float': 'left' 810 }); 811 (path == 'horizontal') ? (gridWidth += t.outerWidth()) : (gridHeight += t.outerHeight()) 812 }); 813 gridCss = { 814 width: gridWidth, 815 height: gridHeight 816 }; 817 grid.css(gridCss); 818 gridCss = {}; 819 var gridOffset = grid.offset(), 820 activeOffset = (active.length) ? active.offset() : { 821 top: parseInt(heightAvail / 2), 822 left: parseInt(widthAvail / 2) 823 }; 824 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()); 825 (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); 826 if (arguments.length < 3) 827 grid.stop().animate(gridCss, opts.effects.repositionSpeed, 'easeOutCirc'); 828 else grid.css(gridCss) 829 }, 830 loadImage: function(image, callback) { 831 if (!$.isArray(image)) 832 image = [image]; 833 var iL = this, 834 length = image.length; 835 if (length > 0) { 836 iL.showLoader(); 837 $.each(image, function(index, value) { 838 var img = new Image(); 839 img.onload = function() { 840 length -= 1; 841 if (length == 0) { 842 iL.hideLoader(); 843 callback(img) 844 } 845 }; 846 img.onerror = img.onabort = function() { 847 length -= 1; 848 if (length == 0) { 849 iL.hideLoader(); 850 callback(!1) 851 } 852 }; 853 img.src = image[index] 854 }) 855 } else callback(!1) 856 }, 857 patchItemsEvents: function() { 858 var iL = this, 859 vars = iL.vars, 860 clickEvent = supportTouch ? "itap.iL" : "click.iL",
861 vEvent = supportTouch ? "click.iL" : "itap.iL"; 862 if (iL.context && iL.selector) { 863 var $items = $(iL.selector, iL.context); 864 $(iL.context).on(clickEvent, iL.selector, function() { 865 var $this = $(this), 866 $key; 867 currentLigthbox = $this; 868 if (jQuery(currentLigthbox).parent().parent().parent().attr('data-sortid') != undefined) { 869 $.each($items, function(key, val) { 870 if (jQuery(currentLigthbox).parent().parent().parent().attr('data-sortid') == jQuery(val).parent().parent().parent().attr('data-sortid')) { 871 $key = key; 872 return !1 873 } 874 }) 875 } else { 876 $key = $items.index($this) 877 } 878 key = $key; 879 vars.current = key; 880 vars.next = iL.items[key + 1] ? key + 1 : null; 881 vars.prev = iL.items[key - 1] ? key - 1 : null; 882 iL.addContents(); 883 iL.patchEvents(); 884 return !1 885 }).on(vEvent, iL.selector, function() { 886 return !1 887 }) 888 } else $.each(iL.itemsObject, function(key, val) { 889 val.on(clickEvent, function() { 890 vars.current = key; 891 vars.next = iL.items[key + 1] ? key + 1 : null; 892 vars.prev = iL.items[key - 1] ? key - 1 : null; 893 iL.addContents(); 894 iL.patchEvents(); 895 return !1 896 }).on(vEvent, function() { 897 return !1 898 }) 899 }) 900 }, 901 dispatchItemsEvents: function() { 902 var iL = this, 903 vars = iL.vars, 904 opts = iL.options; 905 if (iL.context && iL.selector) 906 $(iL.context).off('.iL', iL.selector); 907 else $.each(iL.itemsObject, function(key, val) { 908 val.off('.iL') 909 }) 910 }, 911 refresh: function() { 912 var iL = this; 913 iL.dispatchItemsEvents(); 914 iL.attachItems(); 915 iL.normalizeItems(); 916 iL.patchItemsEvents() 917 }, 918 patchEvents: function() { 919 var iL = this, 920 vars = iL.vars, 921 opts = iL.options, 922 path = opts.path.toLowerCase(), 923 holders = $('.ilightbox-holder'), 924 fullscreenEvent = fullScreenApi.fullScreenEventName + '.iLightBox', 925 durationThreshold = 1000, 926 horizontalDistanceThreshold = verticalDistanceThreshold = 100, 927 buttonsArray = [vars.nextButton[0], vars.prevButton[0], vars.nextButton[0].firstChild, vars.prevButton[0].firstChild]; 928 $win.bind('resize.iLightBox', function() { 929 var viewport = getViewport(); 930 if (opts.mobileOptimizer && !opts.innerToolbar) 931 vars.isMobile = viewport.width <= vars.mobileMaxWidth; 932 vars.BODY[vars.isMobile ? 'addClass' : 'removeClass']('isMobile'); 933 iL.repositionPhoto(null); 934 if (supportTouch) { 935 clearTimeout(vars.setTime); 936 vars.setTime = setTimeout(function() { 937 var scrollTop = getScrollXY().y; 938 window.scrollTo(0, scrollTop - 30); 939 window.scrollTo(0, scrollTop + 30); 940 window.scrollTo(0, scrollTop) 941 }, 2000) 942 } 943 if (vars.thumbs) 944 iL.positionThumbnails() 945 }).bind('keydown.iLightBox', function(event) { 946 if (opts.controls.keyboard) { 947 switch (event.keyCode) { 948 case 13: 949 if (event.shiftKey && opts.keyboard.shift_enter) 950 iL.fullScreenAction(); 951 break; 952 case 27: 953 if (opts.keyboard.esc) 954 iL.closeAction(); 955 break; 956 case 37: 957 if (opts.keyboard.left && !vars.lockKey) 958 iL.moveTo('prev'); 959 break; 960 case 38: 961 if (opts.keyboard.up && !vars.lockKey) 962 iL.moveTo('prev'); 963 break; 964 case 39: 965 if (opts.keyboard.right && !vars.lockKey) 966 iL.moveTo('next'); 967 break; 968 case 40: 969 if (opts.keyboard.down && !vars.lockKey) 970 iL.moveTo('next'); 971 break 972 } 973 } 974 }); 975 if (fullScreenApi.supportsFullScreen) 976 $win.bind(fullscreenEvent, function() { 977 iL.doFullscreen() 978 }); 979 var holderEventsArr = [opts.caption.show + '.iLightBox', opts.caption.hide + '.iLightBox', opts.social.show + '.iLightBox', opts.social.hide + '.iLightBox'].filter(function(e, i, arr) { 980 return arr.lastIndexOf(e) === i 981 }), 982 holderEvents = ""; 983 $.each(holderEventsArr, function(key, val) { 984 if (key != 0) 985 holderEvents += ' '; 986 holderEvents += val 987 }); 988 $doc.on(clickEvent, '.ilightbox-overlay', function() { 989 if (opts.overlay.blur) 990 iL.closeAction() 991 }).on(clickEvent, '.ilightbox-next, .ilightbox-next-button', function() { 992 iL.moveTo('next') 993 }).on(clickEvent, '.ilightbox-prev, .ilightbox-prev-button', function() { 994 iL.moveTo('prev') 995 }
995).on(clickEvent, '.ilightbox-thumbnail', function() { 996 var t = $(this), 997 thumbs = $('.ilightbox-thumbnail', vars.thumbnails), 998 index = thumbs.index(t); 999 if (index != vars.current) 1000 iL.goTo(index) 1001 }).on(holderEvents, '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e) { 1002 var caption = $('div.ilightbox-caption', vars.holder), 1003 social = $('div.ilightbox-social', vars.holder), 1004 fadeSpeed = opts.effects.fadeSpeed; 1005 if (vars.nextLock || vars.prevLock) { 1006 if (e.type == opts.caption.show && !caption.is(':visible')) 1007 caption.fadeIn(fadeSpeed); 1008 else if (e.type == opts.caption.hide && caption.is(':visible')) 1009 caption.fadeOut(fadeSpeed); 1010 if (e.type == opts.social.show && !social.is(':visible')) 1011 social.fadeIn(fadeSpeed); 1012 else if (e.type == opts.social.hide && social.is(':visible')) 1013 social.fadeOut(fadeSpeed) 1014 } else { 1015 if (e.type == opts.caption.show && !caption.is(':visible')) 1016 caption.stop().fadeIn(fadeSpeed); 1017 else if (e.type == opts.caption.hide && caption.is(':visible')) 1018 caption.stop().fadeOut(fadeSpeed); 1019 if (e.type == opts.social.show && !social.is(':visible')) 1020 social.stop().fadeIn(fadeSpeed); 1021 else if (e.type == opts.social.hide && social.is(':visible')) 1022 social.stop().fadeOut(fadeSpeed) 1023 } 1024 }).on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-wrapper', function(e) { 1025 if (e.type == 'mouseenter') 1026 vars.lockWheel = !0; 1027 else vars.lockWheel = !1 1028 }).on(clickEvent, '.ilightbox-toolbar a.ilightbox-close, .ilightbox-toolbar a.ilightbox-fullscreen, .ilightbox-toolbar a.ilightbox-play, .ilightbox-toolbar a.ilightbox-pause', function() { 1029 var t = $(this); 1030 if (t.hasClass('ilightbox-fullscreen')) 1031 iL.fullScreenAction(); 1032 else if (t.hasClass('ilightbox-play')) { 1033 iL.resume(); 1034 t.addClass('ilightbox-pause').removeClass('ilightbox-play') 1035 } else if (t.hasClass('ilightbox-pause')) { 1036 iL.pause(); 1037 t.addClass('ilightbox-play').removeClass('ilightbox-pause') 1038 } else iL.closeAction() 1039 }).on(touchMoveEvent, '.ilightbox-overlay, .ilightbox-thumbnails-container', function(e) { 1040 e.preventDefault() 1041 }); 1042 1043 function mouseMoveHandler(e) { 1044 if (!vars.isMobile) { 1045 if (!vars.mouseID) { 1046 vars.hideableElements.show() 1047 } 1048 vars.mouseID = clearTimeout(vars.mouseID); 1049 if (buttonsArray.indexOf(e.target) === -1) 1050 vars.mouseID = setTimeout(function() { 1051 vars.hideableElements.hide(); 1052 vars.mouseID = clearTimeout(vars.mouseID) 1053 }, 3000) 1054 } 1055 } 1056 if (opts.controls.arrows && !supportTouch) 1057 $doc.on('mousemove.iLightBox', mouseMoveHandler); 1058 if (opts.controls.slideshow && opts.slideshow.pauseOnHover) 1059 $doc.on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e) { 1060 if (e.type == 'mouseenter' && vars.cycleID) 1061 iL.pause(); 1062 else if (e.type == 'mouseleave' && vars.isPaused) 1063 iL.resume() 1064 }); 1065 var switchers = $('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbn
1065ails'); 1066 if (opts.controls.mousewheel) 1067 switchers.on('mousewheel.iLightBox', function(event, delta) { 1068 if (!vars.lockWheel) { 1069 event.preventDefault(); 1070 if (delta < 0) 1071 iL.moveTo('next'); 1072 else if (delta > 0) 1073 iL.moveTo('prev') 1074 } 1075 }); 1076 if (opts.controls.swipe) 1077 holders.on(touchStartEvent, function(event) { 1078 if (vars.nextLock || vars.prevLock || vars.total == 1 || vars.lockSwipe) 1079 return; 1080 vars.BODY.addClass('ilightbox-closedhand'); 1081 var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event, 1082 scrollTop = $doc.scrollTop(), 1083 scrollLeft = $doc.scrollLeft(), 1084 offsets = [holders.eq(0).offset(), holders.eq(1).offset(), holders.eq(2).offset()], 1085 offSet = [{ 1086 top: offsets[0].top - scrollTop, 1087 left: offsets[0].left - scrollLeft 1088 }, { 1089 top: offsets[1].top - scrollTop, 1090 left: offsets[1].left - scrollLeft 1091 }, { 1092 top: offsets[2].top - scrollTop, 1093 left: offsets[2].left - scrollLeft 1094 }], 1095 start = { 1096 time: (new Date()).getTime(), 1097 coords: [data.pageX - scrollLeft, data.pageY - scrollTop] 1098 }, 1099 stop; 1100 1101 function moveEachHandler(i) { 1102 var t = $(this), 1103 offset = offSet[i], 1104 scroll = [(start.coords[0] - stop.coords[0]), (start.coords[1] - stop.coords[1])]; 1105 t[0].style[path == "horizontal" ? 'left' : 'top'] = (path == "horizontal" ? offset.left - scroll[0] : offset.top - scroll[1]) + 'px' 1106 } 1107 1108 function moveHandler(event) { 1109 if (!start) 1110 return; 1111 var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event; 1112 stop = { 1113 time: (new Date()).getTime(), 1114 coords: [data.pageX - scrollLeft, data.pageY - scrollTop] 1115 }; 1116 holders.each(moveEachHandler); 1117 event.preventDefault() 1118 } 1119 1120 function repositionHolders() { 1121 holders.each(function() { 1122 var t = $(this), 1123 offset = t.data('offset') || { 1124 top: t.offset().top - scrollTop, 1125 left: t.offset().left - scrollLeft 1126 }, 1127 top = offset.top, 1128 left = offset.left; 1129 t.css(transform, gpuAcceleration).stop().animate({ 1130 top: top, 1131 left: left 1132 }, 500, 'easeOutCirc', function() { 1133 t.css(transform, '') 1134 }) 1135 }) 1136 } 1137 holders.bind(touchMoveEvent, moveHandler); 1138 $doc.one(touchStopEvent, function(event) { 1139 holders.unbind(touchMoveEvent, moveHandler); 1140 vars.BODY.removeClass('ilightbox-closedhand'); 1141 if (start && stop) { 1142 if (path == "horizontal" && stop.time - start.time < durationThreshold && abs(start.coords[0] - stop.coords[0]) > horizontalDistanceThreshold && abs(start.coords[1] - stop.coords[1]) < verticalDistanceThreshold) { 1143 if (start.coords[0] > stop.coords[0]) { 1144 if (vars.current == vars.total - 1 && !opts.infinite) 1145 repositionHolders(); 1146 else { 1147 vars.isSwipe = !0; 1148 iL.moveTo('next') 1149 } 1150 } else { 1151 if (vars.current == 0 && !opts.infinite) 1152 repositionHolders(); 1153 else { 1154 vars.isSwipe = !0; 1155 iL.moveTo('prev') 1156 } 1157 } 1158 } 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) { 1159 if (start.coords[1] > stop.coords[1]) { 1160 if (vars.current == vars.total - 1 && !opts.infinite) 1161 repositionHolders(); 1162 else { 1163 vars.isSwipe = !0; 1164 iL.moveTo('next') 1165 } 1166 } else { 1167 if (vars.current == 0 && !opts.infinite) 1168 repositionHolders(); 1169 else { 1170 vars.isSwipe = !0; 1171 iL.moveTo('prev') 1172 } 1173 } 1174 } else repositionHolders() 1175 } 1176 start = stop = undefined 1177 }) 1178 }) 1179 }, 1180 goTo: function(index) { 1181 var iL = this, 1182 vars = iL.vars, 1183 opts = iL.options, 1184 diff = (index - vars.current); 1185 if (opts.infinite) { 1186 if (index == vars.total - 1 && vars.current == 0) 1187 diff = -1; 1188 if (vars.current == vars.total - 1 && index == 0) 1189 diff = 1 1190 } 1191 if (diff == 1) 1192 iL.moveTo('next'); 1193 else if (diff == -1) 1194 iL.moveTo('prev'); 1195 else { 1196 if (vars.nextLock || vars.prevLock) 1197 return !1; 1198 if (typeof opts.callback.onBeforeChange == 'function') 1199 opts.callback.onBeforeChange.call(iL, iL.ui); 1200 if (opts.linkId) { 1201 vars.hashLock = !0; 1202 window.location.hash = opts.linkId + '/' + index 1203 } 1204 if (iL.items[index]) { 1205 if (!iL.items[index].options.mousewheel) 1206 vars.lockWheel = !0; 1207 else iL.vars.lockWheel = !1; 1208 if (!iL.items[index].options.swipe) 1209 vars.lockSwipe = !0; 1210 else vars.lockSwipe = !1 1211 } 1212 $.each([vars.holder, vars.nextPhoto, vars.prevPhoto], function(key, val) { 1213 val.css(transform, gpuAcceleration).fadeOut(opts.effects.loadedFadeSpeed) 1214 }); 1215 vars.current = index; 1216 vars.next = index + 1; 1217 vars.prev = index - 1; 1218 iL.createUI(); 1219 setTimeout(function() { 1220 iL.generateBoxes() 1221 }, opts.effects.loadedFadeSpeed + 50);
1222 $('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(index).addClass('ilightbox-active'); 1223 iL.positionThumbnails(); 1224 if (opts.linkId) 1225 setTimeout(function() { 1226 vars.hashLock = !1 1227 }, 55); 1228 if (!opts.infinite) { 1229 vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled'); 1230 if (vars.current == 0) { 1231 vars.prevButton.add(vars.innerPrevButton).addClass('disabled') 1232 } 1233 if (vars.current >= vars.total - 1) { 1234 vars.nextButton.add(vars.innerNextButton).addClass('disabled') 1235 } 1236 } 1237 iL.resetCycle(); 1238 if (typeof opts.callback.onAfterChange == 'function') 1239 opts.callback.onAfterChange.call(iL, iL.ui) 1240 } 1241 }, 1242 moveTo: function(side) { 1243 var iL = this, 1244 vars = iL.vars, 1245 opts = iL.options, 1246 path = opts.path.toLowerCase(), 1247 viewport = getViewport(), 1248 switchSpeed = opts.effects.switchSpeed; 1249 if (vars.nextLock || vars.prevLock) 1250 return !1; 1251 else { 1252 var item = (side == "next") ? vars.next : vars.prev; 1253 if (opts.linkId) { 1254 vars.hashLock = !0; 1255 window.location.hash = opts.linkId + '/' + item 1256 } 1257 if (side == "next") { 1258 if (!iL.items[item]) 1259 return !1; 1260 var firstHolder = vars.nextPhoto, 1261 secondHolder = vars.holder, 1262 lastHolder = vars.prevPhoto, 1263 firstClass = 'ilightbox-prev', 1264 secondClass = 'ilightbox-next' 1265 } else if (side == "prev") { 1266 if (!iL.items[item]) 1267 return !1; 1268 var firstHolder = vars.prevPhoto, 1269 secondHolder = vars.holder, 1270 lastHolder = vars.nextPhoto, 1271 firstClass = 'ilightbox-next', 1272 secondClass = 'ilightbox-prev' 1273 } 1274 if (typeof opts.callback.onBeforeChange == 'function') 1275 opts.callback.onBeforeChange.call(iL, iL.ui); 1276 (side == "next") ? vars.nextLock = !0: vars.prevLock = !0; 1277 var captionFirst = $('div.ilightbox-caption', secondHolder), 1278 socialFirst = $('div.ilightbox-social', secondHolder); 1279 if (captionFirst.length) 1280 captionFirst.stop().fadeOut(switchSpeed, function() { 1281 $(this).remove() 1282 }); 1283 if (socialFirst.length) 1284 socialFirst.stop().fadeOut(switchSpeed, function() { 1285 $(this).remove() 1286 }); 1287 if (iL.items[item].caption) { 1288 iL.setCaption(iL.items[item], firstHolder); 1289 var caption = $('div.ilightbox-caption', firstHolder), 1290 percent = parseInt((caption.outerHeight() / firstHolder.outerHeight()) * 100); 1291 if (opts.caption.start && percent <= 50) 1292 caption.fadeIn(switchSpeed) 1293 } 1294 var social = iL.items[item].options.social; 1295 if (social) { 1296 iL.setSocial(social, iL.items[item].URL, firstHolder); 1297 if (opts.social.start) 1298 $('div.ilightbox-social', firstHolder).fadeIn(opts.effects.fadeSpeed) 1299 } 1300 $.each([firstHolder, secondHolder, lastHolder], function(key, val) { 1301 val.removeClass('ilightbox-next ilightbox-prev') 1302 }); 1303 var firstOffset = firstHolder.data('offset'), 1304 winW = (viewport.width - (opts.styles.pageOffsetX)), 1305 winH = (viewport.height - (opts.styles.pageOffsetY)), 1306 width = firstOffset.newDims.width, 1307 height = firstOffset.newDims.height, 1308 thumbsOffset = firstOffset.thumbsOffset, 1309 diff = firstOffset.diff, 1310 top = parseInt((winH / 2) - (height / 2) - diff.H - (thumbsOffset.H / 2)), 1311 left = parseInt((winW / 2) - (width / 2) - diff.W - (thumbsOffset.W / 2)); 1312 firstHolder.css(transform, gpuAcceleration).animate({ 1313 top: top, 1314 left: left, 1315 opacity: 1 1316 }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() { 1317 firstHolder.css(transform, '') 1318 }); 1319 $('div.ilightbox-container', firstHolder).animate({ 1320 width: width, 1321 height: height 1322 }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc'); 1323 var secondOffset = secondHolder.data('offset'), 1324 object = secondOffset.object; 1325 diff = secondOffset.diff; 1326 width = secondOffset.newDims.width, height = secondOffset.newDims.height; 1327 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)); 1328 if (side == 'prev') 1329 left = (path == 'horizontal') ? parseInt(winW - object.offsetX - diff.W - (thumbsOffset.W / 2)) : parseInt((winW / 2) - (width / 2) - diff.W - object.offsetY - (thumbsOffset.W / 2)); 1330 else { 1331 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)) 1332 } 1333 $('div.ilightbox-container', secondHolder).animate({ 1334 width: width, 1335 height: height 1336 }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc'); 1337 secondHolder.addClass(firstClass).css(transform, gpuAcceleration).animate({ 1338 top: top, 1339 left: left, 1340 opacity: opts.styles.prevOpacity 1341 }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() { 1342 secondHolder.css(transform, '');
1343 $('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(item).addClass('ilightbox-active'); 1344 iL.positionThumbnails(); 1345 if (iL.items[item]) { 1346 if (!iL.items[item].options.mousewheel) 1347 vars.lockWheel = !0; 1348 else vars.lockWheel = !1; 1349 if (!iL.items[item].options.swipe) 1350 vars.lockSwipe = !0; 1351 else vars.lockSwipe = !1 1352 } 1353 vars.isSwipe = !1; 1354 if (side == "next") { 1355 vars.nextPhoto = lastHolder, vars.prevPhoto = secondHolder, vars.holder = firstHolder; 1356 vars.nextPhoto.hide(); 1357 vars.next = vars.next + 1, vars.prev = vars.current, vars.current = vars.current + 1; 1358 if (opts.infinite) { 1359 if (vars.current > vars.total - 1) 1360 vars.current = 0; 1361 if (vars.current == vars.total - 1) 1362 vars.next = 0; 1363 if (vars.current == 0) 1364 vars.prev = vars.total - 1 1365 } 1366 iL.createUI(); 1367 if (!iL.items[vars.next]) 1368 vars.nextLock = !1; 1369 else iL.loadContent(iL.items[vars.next], 'next') 1370 } else { 1371 vars.prevPhoto = lastHolder; 1372 vars.nextPhoto = secondHolder; 1373 vars.holder = firstHolder; 1374 vars.prevPhoto.hide(); 1375 vars.next = vars.current; 1376 vars.current = vars.prev; 1377 vars.prev = vars.current - 1; 1378 if (opts.infinite) { 1379 if (vars.current == vars.total - 1) 1380 vars.next = 0; 1381 if (vars.current == 0) 1382 vars.prev = vars.total - 1 1383 } 1384 iL.createUI(); 1385 if (!iL.items[vars.prev]) 1386 vars.prevLock = !1; 1387 else iL.loadContent(iL.items[vars.prev], 'prev') 1388 } 1389 if (opts.linkId) 1390 setTimeout(function() { 1391 vars.hashLock = !1 1392 }, 55); 1393 if (!opts.infinite) { 1394 vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled'); 1395 if (vars.current == 0) 1396 vars.prevButton.add(vars.innerPrevButton).addClass('disabled'); 1397 if (vars.current >= vars.total - 1) 1398 vars.nextButton.add(vars.innerNextButton).addClass('disabled') 1399 } 1400 iL.repositionPhoto(); 1401 iL.resetCycle(); 1402 if (typeof opts.callback.onAfterChange == 'function') 1403 opts.callback.onAfterChange.call(iL, iL.ui) 1404 }); 1405 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'); 1406 lastHolder.css(transform, gpuAcceleration).animate({ 1407 top: top, 1408 left: left, 1409 opacity: opts.styles.nextOpacity 1410 }, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() { 1411 lastHolder.css(transform, '') 1412 }).addClass(secondClass) 1413 } 1414 }, 1415 setCaption: function(obj, target) { 1416 var iL = this, 1417 caption = $('<div class="ilightbox-caption"></div>'); 1418 if (obj.caption) { 1419 caption.html(obj.caption); 1420 $('div.ilightbox-container', target).append(caption) 1421 } 1422 }, 1423 normalizeSocial: function(obj, url) { 1424 var iL = this, 1425 vars = iL.vars, 1426 opts = iL.options, 1427 baseURL = window.location.href; 1428 $.each(obj, function(key, value) { 1429 if (!value) 1430 return !0; 1431 var item = key.toLowerCase(), 1432 source, text; 1433 switch (item) { 1434 case 'facebook': 1435 source = "http://www.facebook.com/share.php?v=4&src=bm&u={URL}", text = "Share on Facebook"; 1436 break; 1437 case 'twitter': 1438 source = "http://twitter.com/home?status={URL}", text = "Share on Twitter"; 1439 break; 1440 case 'googleplus': 1441 source = "https://plus.google.com/share?url={URL}", text = "Share on Google+"; 1442 break; 1443 case 'delicious': 1444 source = "http://delicious.com/post?url={URL}", text = "Share on Delicious"; 1445 break; 1446 case 'digg': 1447 source = "http://digg.com/submit?phase=2&url={URL}", text = "Share on Digg"; 1448 break; 1449 case 'reddit': 1450 source = "http://reddit.com/submit?url={URL}", text = "Share on reddit"; 1451 break 1452 } 1453 obj[key] = { 1454 URL: value.URL && absolutizeURI(baseURL, value.URL) || opts.linkId && window.location.href || typeof url !== 'string' && baseURL || url && absolutizeURI(baseURL, url) || baseURL, 1455 source: value.source || source || value.URL && absolutizeURI(baseURL, value.URL) || url && absolutizeURI(baseURL, url), 1456 text: value.text || text || "Share on " + key, 1457 width: (typeof(value.width) != 'undefined' && !isNaN(value.width)) ? parseInt(value.width) : 640, 1458 height: value.height || 360 1459 } 1460 }); 1461 return obj 1462 }, 1463 setSocial: function(obj, url, target) { 1464 var iL = this, 1465 socialBar = $('<div class="ilightbox-social"></div>'), 1466 buttons = '<ul>'; 1467 obj = iL.normalizeSocial(obj, url); 1468 $.each(obj, function(key, value) { 1469 var item = key.toLowerCase(), 1470 source = value.source.replace(/\{URL\}/g, encodeURIComponent(value.URL).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+')); 1471 buttons += '<li class="' + key + '"><a href="' + source + '" onclick="javascript:window.open(this.href' + ((value.width <= 0 || value.height <= 0) ? '' : ', \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=' + value.height + ',width=' + value.width + ',left=40,top=40\'') + ');return false;" title="' + value.text + '" target="_blank"></a></li>' 1472 }); 1473 buttons += '</ul>'; 1474 socialBar.html(buttons); 1475 $('div.ilightbox-container', target).append(socialBar) 1476 }, 1477 fullScreenAction: function() { 1478 var iL = this, 1479 vars = iL.vars; 1480 if (fullScreenApi.supportsFullScreen) { 1481 if (fullScreenApi.isFullScreen()) 1482 fullScreenApi.cancelFullScreen(document.documentElement); 1483 else fullScreenApi.requestFullScreen(document.documentElement) 1484 } else { 1485 iL.doFullscreen() 1486 } 1487 }, 1488 doFullscreen: function() { 1489 var iL = this, 1490 vars = iL.vars, 1491 viewport = getViewport(), 1492 opts = iL.options; 1493 if (opts.fullAlone) { 1494 var currentHolder = vars.holder, 1495 current = iL.items[vars.current], 1496 windowWidth = viewport.width, 1497 windowHeight = viewport.height, 1498 elements = [currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader], 1499 hideElements = [vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails]; 1500 if (!vars.isInFullScreen) { 1501 vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = !0; 1502 vars.overlay.css({ 1503 opacity: 1 1504 }); 1505 $.each(hideElements, function(i, element) { 1506 element.hide() 1507 }); 1508 vars.fullScreenButton.attr('title', opts.text.exitFullscreen); 1509 if (opts.fullStretchTypes.indexOf(current.type) != -1) 1510 currentHolder.data({
1511 naturalWidthOld: currentHolder.data('naturalWidth'), 1512 naturalHeightOld: currentHolder.data('naturalHeight'), 1513 naturalWidth: windowWidth, 1514 naturalHeight: windowHeight 1515 }); 1516 else { 1517 var viewport = current.options.fullViewPort || opts.fullViewPort || '', 1518 newWidth = windowWidth, 1519 newHeight = windowHeight, 1520 width = currentHolder.data('naturalWidth'), 1521 height = currentHolder.data('naturalHeight'); 1522 if (viewport.toLowerCase() == 'fill') { 1523 newHeight = (newWidth / width) * height; 1524 if (newHeight < windowHeight) { 1525 newWidth = (windowHeight / height) * width, newHeight = windowHeight 1526 } 1527 } else if (viewport.toLowerCase() == 'fit') { 1528 var dims = iL.getNewDimenstions(newWidth, newHeight, width, height, !0); 1529 newWidth = dims.width, newHeight = dims.height 1530 } else if (viewport.toLowerCase() == 'stretch') { 1531 newWidth = newWidth, newHeight = newHeight 1532 } else { 1533 var scale = (width > newWidth || height > newHeight) ? !0 : !1, 1534 dims = iL.getNewDimenstions(newWidth, newHeight, width, height, scale); 1535 newWidth = dims.width, newHeight = dims.height 1536 } 1537 currentHolder.data({ 1538 naturalWidthOld: currentHolder.data('naturalWidth'), 1539 naturalHeightOld: currentHolder.data('naturalHeight'), 1540 naturalWidth: newWidth, 1541 naturalHeight: newHeight 1542 }) 1543 } 1544 $.each(elements, function(key, val) { 1545 val.addClass('ilightbox-fullscreen') 1546 }); 1547 if (typeof opts.callback.onEnterFullScreen == 'function') 1548 opts.callback.onEnterFullScreen.call(iL, iL.ui) 1549 } else { 1550 vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = !1; 1551 vars.overlay.css({ 1552 opacity: iL.options.overlay.opacity 1553 }); 1554 $.each(hideElements, function(i, element) { 1555 element.show() 1556 }); 1557 vars.fullScreenButton.attr('title', opts.text.enterFullscreen); 1558 currentHolder.data({ 1559 naturalWidth: currentHolder.data('naturalWidthOld'), 1560 naturalHeight: currentHolder.data('naturalHeightOld'), 1561 naturalWidthOld: null, 1562 naturalHeightOld: null 1563 }); 1564 $.each(elements, function(key, val) { 1565 val.removeClass('ilightbox-fullscreen') 1566 }); 1567 if (typeof opts.callback.onExitFullScreen == 'function') 1568 opts.callback.onExitFullScreen.call(iL, iL.ui) 1569 } 1570 } else { 1571 if (!vars.isInFullScreen) 1572 vars.isInFullScreen = !0; 1573 else vars.isInFullScreen = !1 1574 } 1575 iL.repositionPhoto(!0) 1576 }, 1577 closeAction: function() { 1578 var iL = this, 1579 vars = iL.vars, 1580 opts = iL.options; 1581 $win.unbind('.iLightBox'); 1582 $doc.off('.iLightBox'); 1583 if (vars.isInFullScreen) 1584 fullScreenApi.cancelFullScreen(document.documentElement); 1585 $('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbn
1585ails').off('.iLightBox'); 1586 if (opts.hide.effect) 1587 vars.overlay.stop().fadeOut(opts.hide.speed, function() { 1588 vars.overlay.remove(); 1589 vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox') 1590 }); 1591 else { 1592 vars.overlay.remove(); 1593 vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox') 1594 } 1595 var fadeOuts = [vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails]; 1596 $.each(fadeOuts, function(i, element) { 1597 element.removeAttr('style').remove() 1598 }); 1599 vars.dontGenerateThumbs = vars.isInFullScreen = !1; 1600 window.iLightBox = null; 1601 if (opts.linkId) { 1602 vars.hashLock = !0; 1603 removeHash(); 1604 setTimeout(function() { 1605 vars.hashLock = !1 1606 }, 55) 1607 } 1608 if (typeof opts.callback.onHide == 'function') 1609 opts.callback.onHide.call(iL, iL.ui) 1610 }, 1611 repositionPhoto: function() { 1612 var iL = this, 1613 vars = iL.vars, 1614 opts = iL.options, 1615 path = opts.path.toLowerCase(), 1616 viewport = getViewport(), 1617 winWidth = viewport.width, 1618 winHeight = viewport.height; 1619 var thumbsOffsetW = (vars.isInFullScreen && opts.fullAlone || vars.isMobile) ? 0 : ((path == 'horizontal') ? 0 : vars.thumbnails.outerWidth()), 1620 thumbsOffsetH = vars.isMobile ? vars.toolbar.outerHeight() : ((vars.isInFullScreen && opts.fullAlone) ? 0 : ((path == 'horizontal') ? vars.thumbnails.outerHeight() : 0)), 1621 width = (vars.isInFullScreen && opts.fullAlone) ? winWidth : (winWidth - (opts.styles.pageOffsetX)), 1622 height = (vars.isInFullScreen && opts.fullAlone) ? winHeight : (winHeight - (opts.styles.pageOffsetY)), 1623 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, 1624 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))); 1625 var elObject = { 1626 type: 'current', 1627 width: width, 1628 height: height, 1629 item: iL.items[vars.current], 1630 offsetW: offsetW, 1631 offsetH: offsetH, 1632 thumbsOffsetW: thumbsOffsetW, 1633 thumbsOffsetH: thumbsOffsetH, 1634 animate: arguments.length, 1635 holder: vars.holder 1636 }; 1637 iL.repositionEl(elObject); 1638 if (iL.items[vars.next]) { 1639 elObject = $.extend(elObject, { 1640 type: 'next', 1641 item: iL.items[vars.next], 1642 offsetX: opts.styles.nextOffsetX, 1643 offsetY: opts.styles.nextOffsetY, 1644 holder: vars.nextPhoto 1645 }); 1646 iL.repositionEl(elObject) 1647 } 1648 if (iL.items[vars.prev]) { 1649 elObject = $.extend(elObject, { 1650 type: 'prev', 1651 item: iL.items[vars.prev], 1652 offsetX: opts.styles.prevOffsetX, 1653 offsetY: opts.styles.prevOffsetY, 1654 holder: vars.prevPhoto 1655 }); 1656 iL.repositionEl(elObject) 1657 } 1658 var loaderCss = (path == "horizontal") ? { 1659 left: parseInt((width / 2) - (vars.loader.outerWidth() / 2)) 1660 } : { 1661 top: parseInt((height / 2) - (vars.loader.outerHeight() / 2)) 1662 }; 1663 vars.loader.css(loaderCss) 1664 }, 1665 repositionEl: function(obj) { 1666 var iL = this, 1667 vars = iL.vars, 1668 opts = iL.options, 1669 path = opts.path.toLowerCase(), 1670 widthAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.width : (obj.width - obj.offsetW)) : (obj.width - obj.offsetW), 1671 heightAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.height : (obj.height - obj.offsetH)) : (obj.height - obj.offsetH), 1672 itemParent = obj.item, 1673 item = obj.item.options, 1674 holder = obj.holder, 1675 offsetX = obj.offsetX || 0, 1676 offsetY = obj.offsetY || 0, 1677 thumbsOffsetW = obj.thumbsOffsetW, 1678 thumbsOffsetH = obj.thumbsOffsetH; 1679 if (obj.type == 'current') { 1680 if (typeof item.width == 'number' && item.width) 1681 widthAvail = ((vars.isInFullScreen && opts.fullAlone) && (opts.fullStretchTypes.indexOf(itemParent.type) != -1 || item.fullViewPort || opts.fullViewPort)) ? widthAvail : ((item.width > widthAvail) ? widthAvail : item.width); 1682 if (typeof item.height == 'number' && item.height) 1683 heightAvail = ((vars.isInFullScreen && opts.fullAlone) && (opts.fullStretchTypes.indexOf(itemParent.type) != -1 || item.fullViewPort || opts.fullViewPort)) ? heightAvail : ((item.height > heightAvail) ? heightAvail : item.height) 1684 } else { 1685 if (typeof item.width == 'number' && item.width) 1686 widthAvail = (item.width > widthAvail) ? widthAvail : item.width; 1687 if (typeof item.height == 'number' && item.height) 1688 heightAvail = (item.height > heightAvail) ? heightAvail : item.height 1689 } 1690 heightAvail = parseInt(heightAvail - $('.ilightbox-inner-toolbar', holder).outerHeight()); 1691 var width = (typeof item.width == 'string' && item.width.indexOf('%') != -1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width) : holder.data('naturalWi
1691dth'), 1692 height = (typeof item.height == 'string' && item.height.indexOf('%') != -1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height) : holder.data('naturalHeight'); 1693 var dims = ((typeof item.width == 'string' && item.width.indexOf('%') != -1 || typeof item.height == 'string' && item.height.indexOf('%') != -1) ? { 1694 width: width, 1695 height: height 1696 } : iL.getNewDimenstions(widthAvail, heightAvail, width, height)), 1697 newDims = $.extend({}, dims, {}); 1698 if (obj.type == 'prev' || obj.type == 'next') 1699 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)); 1700 else width = dims.width, height = dims.height; 1701 var widthDiff = parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2), 1702 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()) / 2); 1703 1704 heightDiff = 0; 1705 switch (obj.type) { 1706 case 'current': 1707 var top = parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)), 1708 left = parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2)); 1709 break; 1710 case 'next': 1711 var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)), 1712 left = (path == 'horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2)); 1713 break; 1714 case 'prev': 1715 var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)), 1716 left = (path == 'horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2)); 1717 break 1718 } 1719 holder.data('offset', { 1720 top: top, 1721 left: left, 1722 newDims: newDims, 1723 diff: { 1724 W: widthDiff, 1725 H: heightDiff 1726 }, 1727 thumbsOffset: { 1728 W: thumbsOffsetW, 1729 H: thumbsOffsetH 1730 }, 1731 object: obj 1732 }); 1733 if (obj.animate > 0 && opts.effects.reposition) { 1734 holder.css(transform, gpuAcceleration).stop().animate({ 1735 top: top, 1736 left: left 1737 }, opts.effects.repositionSpeed, 'easeOutCirc', function() { 1738 holder.css(transform, '') 1739 }); 1740 $('div.ilightbox-container', holder).stop().animate({ 1741 width: width, 1742 height: height 1743 }, opts.effects.repositionSpeed, 'easeOutCirc'); 1744 $('div.ilightbox-inner-toolbar', holder).stop().animate({ 1745 width: width 1746 }, opts.effects.repositionSpeed, 'easeOutCirc', function() { 1747 $(this).css('overflow', 'visible') 1748 }) 1749 } else { 1750 holder.css({ 1751 top: top, 1752 left: left 1753 }); 1754 $('div.ilightbox-container', holder).css({ 1755 width: width, 1756 height: height 1757 }); 1758 $('div.ilightbox-inner-toolbar', holder).css({ 1759 width: width 1760 }) 1761 } 1762 }, 1763 resume: function(priority) { 1764 var iL = this, 1765 vars = iL.vars, 1766 opts = iL.options; 1767 if (!opts.slideshow.pauseTime || opts.controls.slideshow && vars.total <= 1 || priority < vars.isPaused) { 1768 return 1769 } 1770 vars.isPaused = 0; 1771 if (vars.cycleID) { 1772 vars.cycleID = clearTimeout(vars.cycleID) 1773 } 1774 vars.cycleID = setTimeout(function() { 1775 if (vars.current == vars.total - 1) 1776 iL.goTo(0); 1777 else iL.moveTo('next') 1778 }, opts.slideshow.pauseTime) 1779 }, 1780 pause: function(priority) { 1781 var iL = this, 1782 vars = iL.vars, 1783 opts = iL.options; 1784 if (priority < vars.isPaused) { 1785 return 1786 } 1787 vars.isPaused = priority || 100; 1788 if (vars.cycleID) { 1789 vars.cycleID = clearTimeout(vars.cycleID) 1790 } 1791 }, 1792 resetCycle: function() { 1793 var iL = this, 1794 vars = iL.vars, 1795 opts = iL.options; 1796 if (opts.controls.slideshow && vars.cycleID && !vars.isPaused) { 1797 iL.resume() 1798 } 1799 }, 1800 getNewDimenstions: function(width, height, width_old, height_old, thumb) { 1801 var iL = this; 1802 if (!width) 1803 factor = height / height_old; 1804 else if (!height) 1805 factor = width / width_old; 1806 else factor = min(width / width_old, height / height_old); 1807 if (!thumb) { 1808 if (factor > iL.options.maxScale) 1809 factor = iL.options.maxScale; 1810 else if (factor < iL.options.minScale) 1811 factor = iL.options.minScale 1812 } 1813 var final_width = (iL.options.keepAspectRatio) ? round(width_old * factor) : width, 1814 final_height = (iL.options.keepAspectRatio) ? round(height_old * factor) : height; 1815 return { 1816 width: final_width, 1817 height: final_height, 1818 ratio: factor 1819 } 1820 }, 1821 setOption: function(options) { 1822 var iL = this; 1823 iL.options = $.extend(!0, iL.options, options || {}); 1824 iL.refresh() 1825 }, 1826 availPlugins: function() { 1827 var iL = this, 1828 testEl = document.createElement("video"); 1829 iL.plugins = { 1830 flash: !isMobile, 1831 quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >= 0) ? !0 : !1, 1832 html5H264: !!(testEl.canPlayType && testEl.canPlayType('video/mp4').replace(/no/, '')), 1833 html5WebM: !!(testEl.canPlayType && testEl.canPlayType('video/webm').replace(/no/, '')), 1834 html5Vorbis: !!(testEl.canPlayType && testEl.canPlayType('video/ogg').replace(/no/, '')), 1835 html5QuickTime: !!(testEl.canPlayType && testEl.canPlayType('video/quicktime').replace(/no/, '')) 1836 } 1837 }, 1838 addContent: function(element, obj) { 1839 var iL = this, 1840 el; 1841 switch (obj.type) { 1842 case 'video': 1843 var HTML5 = !1, 1844 videoType = obj.videoType, 1845 html5video = obj.options.html5video; 1846 if (((videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v') || html5video.h264) && iL.plugins.html5H264) 1847 obj.ext = 'mp4', obj.URL = html5video.h264 || obj.URL; 1848 else if (html5video.webm && iL.plugins.html5WebM) 1849 obj.ext = 'webm', obj.URL = html5video.webm || obj.URL; 1850 else if (html5video.ogg && iL.plugins.html5Vorbis) 1851 obj.ext = 'ogv', obj.URL = html5video.ogg || obj.URL; 1852 if (iL.plugins.html5H264 && (videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v')) 1853 HTML5 = !0, videoType = "video/mp4"; 1854 else if (iL.plugins.html5WebM && (videoType == 'video/webm' || obj.ext == 'webm')) 1855 HTML5 = !0, videoType = "video/webm"; 1856 else if (iL.plugins.html5Vorbis && (videoType == 'video/ogg' || obj.ext == 'ogv')) 1857 HTML5 = !0, videoType = "video/ogg"; 1858 else if (iL.plugins.html5QuickTime && (videoType == 'video/quicktime' || obj.ext == 'mov' || obj.ext == 'qt')) 1859 HTML5 = !0, videoType = "video/quicktime"; 1860 if (HTML5) { 1861 el = $('<video />
1861', { 1862 "width": "100%", 1863 "height": "100%", 1864 "preload": html5video.preload, 1865 "autoplay": html5video.autoplay, 1866 "poster": html5video.poster, 1867 "controls": html5video.controls 1868 }).append($('<source />', { 1869 "src": obj.URL, 1870 "type": videoType 1871 })) 1872 } else { 1873 if (!iL.plugins.quicktime) 1874 el = $('<span />', { 1875 "class": "ilightbox-alert", 1876 html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.quicktime).replace('{type}', 'QuickTime') 1877 }); 1878 else { 1879 el = $('<object />', { 1880 "type": "video/quicktime", 1881 "pluginspage": pluginspages.quicktime 1882 }).attr({ 1883 "data": obj.URL, 1884 "width": "100%", 1885 "height": "100%" 1886 }).append($('<param />', { 1887 "name": "src", 1888 "value": obj.URL 1889 })).append($('<param />', { 1890 "name": "autoplay", 1891 "value": "false" 1892 })).append($('<param />', { 1893 "name": "loop", 1894 "value": "false" 1895 })).append($('<param />', { 1896 "name": "scale", 1897 "value": "tofit" 1898 })); 1899 if (browser.msie) 1900 el = QT_GenerateOBJECTText(obj.URL, '100%', '100%', '', 'SCALE', 'tofit', 'AUTOPLAY', 'false', 'LOOP', 'false') 1901 } 1902 } 1903 break; 1904 case 'flash': 1905 if (!iL.plugins.flash) 1906 el = $('<span />', { 1907 "class": "ilightbox-alert", 1908 html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.flash).replace('{type}', 'Adobe Flash player') 1909 }); 1910 else { 1911 var flashvars = "", 1912 i = 0; 1913 if (obj.options.flashvars) 1914 $.each(obj.options.flashvars, function(k, v) { 1915 if (i != 0) 1916 flashvars += "&"; 1917 flashvars += k + "=" + encodeURIComponent(v); 1918 i++ 1919 }); 1920 else flashvars = null; 1921 el = $('<embed />').attr({ 1922 "type": "application/x-shockwave-flash", 1923 "src": obj.URL, 1924 "width": (typeof obj.options.width == 'number' && obj.options.width && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.width : "100%", 1925 "height": (typeof obj.options.height == 'number' && obj.options.height && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.height : "100%", 1926 "quality": "high", 1927 "bgcolor": "#000000", 1928 "play": "true", 1929 "loop": "true", 1930 "menu": "true", 1931 "wmode": "transparent", 1932 "scale": "showall", 1933 "allowScriptAccess": "always", 1934 "allowFullScreen": "true", 1935 "flashvars": flashvars, 1936 "fullscreen": "yes" 1937 }) 1938 } 1939 break; 1940 case 'iframe': 1941 el = $('<iframe />').attr({ 1942 "width": (typeof obj.options.width == 'number' && obj.options.width && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.width : "100%", 1943 "height": (typeof obj.options.height == 'number' && obj.options.height && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.height : "100%", 1944 src: obj.URL, 1945 frameborder: 0, 1946 'hspace': 0, 1947 'vspace': 0, 1948 'scrolling': supportTouch ? 'auto' : 'scroll', 1949 'webkitAllowFullScreen': '', 1950 'mozallowfullscreen': '', 1951 'allowFullScreen': '' 1952 }); 1953 break; 1954 case 'inline': 1955 el = $('<div class="ilightbox-wrapper"></div>').html($(obj.URL).clone(!0)); 1956 break; 1957 case 'html': 1958 var object = obj.URL, 1959 el; 1960 if (object[0].nodeName) { 1961 el = $('<div class="ilightbox-wrapper"></div>').html(object) 1962 } else { 1963 var dom = $(obj.URL), 1964 html = (dom.selector) ? $('<div>' + dom + '</div>') : dom; 1965 el = $('<div class="ilightbox-wrapper"></div>').html(html) 1966 } 1967 break 1968 } 1969 $('div.ilightbox-container', element).empty().html(el); 1970 if (el[0].tagName.toLowerCase() === 'video' && browser.webkit) 1971 setTimeout(function() { 1972 var src = el[0].currentSrc + '?' + floor(random() * 30000); 1973 el[0].currentSrc = src; 1974 el[0].src = src 1975 }); 1976 return el 1977 }, 1978 ogpRecognition: function(obj, callback) { 1979 var iL = this, 1980 url = obj.URL; 1981 iL.showLoader(); 1982 doAjax(url, function(data) { 1983 iL.hideLoader(); 1984 if (data) { 1985 var object = new Object(); 1986 object.length = !1, object.url = data.url; 1987 if (data.status == 200) { 1988 var result = data.results, 1989 type = result.type, 1990 source = result.source; 1991 object.source = source.src, object.width = source.width && parseInt(source.width) || 0, object.height = source.height && parseInt(source.height) || 0, object.type = type, object.thumbnail = source.thumbnail || result.images[0], object.html5video = result.html5video || {}, object.length = !0; 1992 if (source.type == 'application/x-shockwave-flash') 1993 object.type = "flash"; 1994 else if (source.type.indexOf("video/") != -1) 1995 object.type = "video"; 1996 else if (source.type.indexOf("/html") != -1) 1997 object.type = "iframe"; 1998 else if (source.type.indexOf("image/") != -1) 1999 object.type = "image" 2000 } else if (typeof data.response != 'undefined') 2001 throw data.response; 2002 callback.call(this, object.length ? object : !1) 2003 } 2004 }) 2005 }, 2006 hashChangeHandler: function(url) { 2007 var iL = this, 2008 vars = iL.vars, 2009 opts = iL.options, 2010 URL = url || window.location.href, 2011 hash = parseURI(URL).hash, 2012 split = hash.split('/'), 2013 index = split[1]; 2014 if (vars.hashLock || ('#' + opts.linkId != split[0] && hash.length > 1)) 2015 return; 2016 if (index) { 2017 var target = split[1] || 0; 2018 if (iL.items[target]) {
2019 var overlay = $('.ilightbox-overlay'); 2020 if (overlay.length && overlay.attr('linkid') == opts.linkId) { 2021 iL.goTo(target) 2022 } else { 2023 iL.itemsObject[target].trigger(supportTouch ? 'itap' : 'click') 2024 } 2025 } else { 2026 var overlay = $('.ilightbox-overlay'); 2027 if (overlay.length) 2028 iL.closeAction() 2029 } 2030 } else { 2031 var overlay = $('.ilightbox-overlay'); 2032 if (overlay.length) 2033 iL.closeAction() 2034 } 2035 } 2036 }; 2037 2038 function getPixel($element, property) { 2039 return parseInt($element.css(property), 10) || 0 2040 } 2041 2042 function within(number, min, max) { 2043 return number < min ? min : number > max ? max : number 2044 } 2045 2046 function getViewport() { 2047 var e = window, 2048 a = 'inner'; 2049 if (!('innerWidth' in window)) { 2050 a = 'client'; 2051 e = document.documentElement || document.body 2052 } 2053 return { 2054 width: e[a + 'Width'], 2055 height: e[a + 'Height'] 2056 } 2057 } 2058 2059 function removeHash() { 2060 var scroll = getScrollXY(); 2061 window.location.hash = ""; 2062 window.scrollTo(scroll.x, scroll.y) 2063 } 2064 2065 function doAjax(url, callback) { 2066 var url = "//ilightbox.net/getSource/jsonp.php?url=" + encodeURIComponent(url).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A'); 2067 $.ajax({
2068 url: url, 2069 dataType: 'jsonp' 2070 }); 2071 iLCallback = function(data) { 2072 callback.call(this, data) 2073 } 2074 } 2075 2076 function findImageInElement(element) { 2077 var elements = $('*', element), 2078 imagesArr = new Array(); 2079 elements.each(function() { 2080 var url = "", 2081 element = this; 2082 if ($(element).css("background-image") != "none") { 2083 url = $(element).css("background-image") 2084 } else if (typeof($(element).attr("src")) != "undefined" && element.nodeName.toLowerCase() == "img") { 2085 url = $(element).attr("src") 2086 } 2087 if (url.indexOf("gradient") == -1) { 2088 url = url.replace(/url\(\"/g, ""); 2089 url = url.replace(/url\(/g, ""); 2090 url = url.replace(/\"\)/g, ""); 2091 url = url.replace(/\)/g, ""); 2092 var urls = url.split(","); 2093 for (var i = 0; i < urls.length; i++) { 2094 if (urls[i].length > 0 && $.inArray(urls[i], imagesArr) == -1) { 2095 var extra = ""; 2096 if (browser.msie && browser.version < 9) { 2097 extra = "?" + floor(random() * 3000) 2098 } 2099 imagesArr.push(urls[i] + extra) 2100 } 2101 } 2102 } 2103 }); 2104 return imagesArr 2105 } 2106 2107 function getExtension(URL) { 2108 var ext = URL.split('.').pop().toLowerCase(), 2109 extra = ext.indexOf('?') !== -1 ? ext.split('?').pop() : ''; 2110 return ext.replace(extra, '') 2111 } 2112 2113 function getTypeByExtension(URL) { 2114 var type, ext = getExtension(URL); 2115 if (extensions.image.indexOf(ext) !== -1) 2116 type = 'image'; 2117 else if (extensions.flash.indexOf(ext) !== -1) 2118 type = 'flash'; 2119 else if (extensions.video.indexOf(ext) !== -1) 2120 type = 'video'; 2121 else type = 'iframe'; 2122 return type 2123 } 2124 2125 function percentToValue(percent, total) { 2126 return parseInt((total / 100) * percent) 2127 } 2128 2129 function parseURI(url) { 2130 var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); 2131 return (m ? { 2132 href: m[0] || '', 2133 protocol: m[1] || '', 2134 authority: m[2] || '', 2135 host: m[3] || '', 2136 hostname: m[4] || '', 2137 port: m[5] || '', 2138 pathname: m[6] || '', 2139 search: m[7] || '', 2140 hash: m[8] || '' 2141 } : null) 2142 } 2143 2144 function absolutizeURI(base, href) { 2145 var iL = this; 2146 2147 function removeDotSegments(input) { 2148 var output = []; 2149 input.replace(/^(\.\.?(\/|$))+/, '').replace(/\/(\.(\/|$))+/g, '/').replace(/\/\.\.$/, '/../').replace(/\/?[^\/]*/g, function(p) { 2150 if (p === '/..') { 2151 output.pop() 2152 } else { 2153 output.push(p) 2154 } 2155 }); 2156 return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '') 2157 } 2158 href = parseURI(href || ''); 2159 base = parseURI(base || ''); 2160 return !href || !base ? null : (href.protocol || base.protocol) + (href.protocol || href.authority ? href.authority : base.authority) + removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) + (href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) + href.hash 2161 } 2162 2163 function version_compare(v1, v2, operator) { 2164 this.php_js = this.php_js || {}; 2165 this.php_js.ENV = this.php_js.ENV || {}; 2166 var i = 0, 2167 x = 0, 2168 compare = 0, 2169 vm = { 2170 'dev': -6, 2171 'alpha': -5, 2172 'a': -5, 2173 'beta': -4, 2174 'b': -4, 2175 'RC': -3, 2176 'rc': -3, 2177 '#': -2, 2178 'p': 1, 2179 'pl': 1 2180 }, 2181 prepVersion = function(v) { 2182 v = ('' + v).replace(/[_\-+]/g, '.'); 2183 v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.'); 2184 return (!v.length ? [-8] : v.split('.')) 2185 }, 2186 numVersion = function(v) { 2187 return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10)) 2188 }; 2189 v1 = prepVersion(v1); 2190 v2 = prepVersion(v2); 2191 x = max(v1.length, v2.length); 2192 for (i = 0; i < x; i++) { 2193 if (v1[i] == v2[i]) { 2194 continue 2195 } 2196 v1[i] = numVersion(v1[i]); 2197 v2[i] = numVersion(v2[i]); 2198 if (v1[i] < v2[i]) { 2199 compare = -1; 2200 break 2201 } else if (v1[i] > v2[i]) { 2202 compare = 1; 2203 break 2204 } 2205 } 2206 if (!operator) { 2207 return compare 2208 } 2209 switch (operator) { 2210 case '>': 2211 case 'gt': 2212 return (compare > 0); 2213 case '>=': 2214 case 'ge': 2215 return (compare >= 0); 2216 case '<=': 2217 case 'le': 2218 return (compare <= 0); 2219 case '==': 2220 case '=': 2221 case 'eq': 2222 return (compare === 0); 2223 case '<>': 2224 case '!=':
2225 case 'ne': 2226 return (compare !== 0); 2227 case '': 2228 case '<': 2229 case 'lt': 2230 return (compare < 0); 2231 default: 2232 return null 2233 } 2234 } 2235 $.fn.iLightBox = function() { 2236 var args = arguments, 2237 opt = ($.isPlainObject(args[0])) ? args[0] : args[1], 2238 items = ($.isArray(args[0]) || typeof args[0] == 'string') ? args[0] : args[1]; 2239 if (!opt) 2240 opt = {}; 2241 var options = $.extend(!0, { 2242 attr: 'href', 2243 path: 'vertical', 2244 skin: 'dark', 2245 linkId: !1, 2246 infinite: !1, 2247 startFrom: 0, 2248 randomStart: !1, 2249 keepAspectRatio: !0, 2250 maxScale: 1, 2251 minScale: .2, 2252 innerToolbar: !1, 2253 smartRecognition: !1, 2254 mobileOptimizer: !0, 2255 fullAlone: !0, 2256 fullViewPort: null, 2257 fullStretchTypes: 'flash, video', 2258 overlay: { 2259 blur: !0, 2260 opacity: .85 2261 }, 2262 controls: { 2263 arrows: !1, 2264 slideshow: !1, 2265 toolbar: !0, 2266 fullscreen: !0, 2267 thumbnail: !0, 2268 keyboard: !0, 2269 mousewheel: !0, 2270 swipe: !0 2271 }, 2272 keyboard: { 2273 left: !0, 2274 right: !0, 2275 up: !0, 2276 down: !0, 2277 esc: !0, 2278 shift_enter: !0 2279 }, 2280 show: { 2281 effect: !0, 2282 speed: 300, 2283 title: !0 2284 }, 2285 hide: { 2286 effect: !0, 2287 speed: 300 2288 }, 2289 caption: { 2290 start: !0, 2291 show: 'mouseenter', 2292 hide: 'mouseleave' 2293 }, 2294 social: { 2295 start: !0, 2296 show: 'mouseenter', 2297 hide: 'mouseleave', 2298 buttons: !1 2299 }, 2300 styles: { 2301 pageOffsetX: 0, 2302 pageOffsetY: 0, 2303 nextOffsetX: 45, 2304 nextOffsetY: 0, 2305 nextOpacity: 1, 2306 nextScale: 1, 2307 prevOffsetX: 45, 2308 prevOffsetY: 0, 2309 prevOpacity: 1, 2310 prevScale: 1 2311 }, 2312 thumbnails: { 2313 maxWidth: 120, 2314 maxHeight: 80, 2315 normalOpacity: 1, 2316 activeOpacity: .6 2317 }, 2318 effects: { 2319 reposition: !0, 2320 repositionSpeed: 200, 2321 switchSpeed: 500, 2322 loadedFadeSpeed: 180, 2323 fadeSpeed: 200 2324 }, 2325 slideshow: { 2326 pauseTime: 5000, 2327 pauseOnHover: !1, 2328 startPaused: !0 2329 }, 2330 text: { 2331 close: "Press Esc to close", 2332 enterFullscreen: "Enter Fullscreen (Shift+Enter)", 2333 exitFullscreen: "Exit Fullscreen (Shift+Enter)", 2334 slideShow: "Slideshow", 2335 next: "Next", 2336 previous: "Previous" 2337 }, 2338 errors: { 2339 loadImage: "An error occurred when trying to load photo.", 2340 loadContents: "An error occurred when trying to load contents.", 2341 missingPlugin: "The content your are attempting to view requires the <a href='{pluginspage}' target='_blank'>{type} plugin<\/a>." 2342 }, 2343 ajaxSetup: { 2344 url: '', 2345 beforeSend: function(jqXHR, settings) {}, 2346 cache: !1, 2347 complete: function(jqXHR, textStatus) {}, 2348 crossDomain: !1, 2349 error: function(jqXHR, textStatus, errorThrown) {}, 2350 success: function(data, textStatus, jqXHR) {}, 2351 global: !0, 2352 ifModified: !1, 2353 username: null, 2354 password: null, 2355 type: 'GET' 2356 }, 2357 callback: {} 2358 }, opt); 2359 var instant = ($.isArray(items) || typeof items == 'string') ? !0 : !1; 2360 items = $.isArray(items) ? items : new Array(); 2361 if (typeof args[0] == 'string') 2362 items[0] = args[0]; 2363 if (version_compare($.fn.jquery, '1.8', '>=')) { 2364 var iLB = new iLightBox($(this), options, items, instant); 2365 return { 2366 close: function() { 2367 iLB.closeAction() 2368 }, 2369 fullscreen: function() { 2370 iLB.fullScreenAction() 2371 }, 2372 moveNext: function() { 2373 iLB.moveTo('next') 2374 }, 2375 movePrev: function() { 2376 iLB.moveTo('prev') 2377 }, 2378 goTo: function(index) { 2379 iLB.goTo(index) 2380 }, 2381 refresh: function() { 2382 iLB.refresh() 2383 }, 2384 reposition: function() { 2385 (arguments.length > 0) ? iLB.repositionPhoto(!0): iLB.repositionPhoto() 2386 }, 2387 setOption: function(options) { 2388 iLB.setOption(options) 2389 }, 2390 destroy: function() { 2391 iLB.closeAction(); 2392 iLB.dispatchItemsEvents() 2393 } 2394 } 2395 } else { 2396 throw "The jQuery version that was loaded is too old. iLightBox requires jQuery 1.8+" 2397 } 2398 }; 2399 $.iLightBox = function() { 2400 return $.fn.iLightBox(arguments[0], arguments[1]) 2401 }; 2402 $.extend($.easing, { 2403 easeInCirc: function(x, t, b, c, d) { 2404 return -c * (sqrt(1 - (t /= d) * t) - 1) + b 2405 }, 2406 easeOutCirc: function(x, t, b, c, d) { 2407 return c * sqrt(1 - (t = t / d - 1) * t) + b 2408 }, 2409 easeInOutCirc: function(x, t, b, c, d) { 2410 if ((t /= d / 2) < 1) 2411 return -c / 2 * (sqrt(1 - t * t) - 1) + b; 2412 return c / 2 * (sqrt(1 - (t -= 2) * t) + 1) + b 2413 } 2414 });
2415 2416 function getScrollXY() { 2417 var scrOfX = 0, 2418 scrOfY = 0; 2419 if (typeof(window.pageYOffset) == 'number') { 2420 scrOfY = window.pageYOffset; 2421 scrOfX = window.pageXOffset 2422 } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { 2423 scrOfY = document.body.scrollTop; 2424 scrOfX = document.body.scrollLeft 2425 } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { 2426 scrOfY = document.documentElement.scrollTop; 2427 scrOfX = document.documentElement.scrollLeft 2428 } 2429 return { 2430 x: scrOfX, 2431 y: scrOfY 2432 } 2433 }(function() { 2434 $.each(("touchstart touchmove touchend " + "tap taphold " + "swipe swipeleft swiperight " + "scrollstart scrollstop").split(" "), function(i, name) { 2435 $.fn[name] = function(fn) { 2436 return fn ? this.bind(name, fn) : this.trigger(name) 2437 }; 2438 if ($.attrFn) { 2439 $.attrFn[name] = !0 2440 } 2441 }); 2442 var tapSettings = { 2443 startEvent: 'touchstart.iTap', 2444 endEvent: 'touchend.iTap' 2445 }; 2446 $.event.special.itap = { 2447 setup: function() { 2448 var self = this, 2449 $self = $(this), 2450 start, stop; 2451 $self.bind(tapSettings.startEvent, function(event) { 2452 start = getScrollXY(); 2453 $self.one(tapSettings.endEvent, function(event) { 2454 stop = getScrollXY(); 2455 var orgEvent = event || window.event; 2456 event = $.event.fix(orgEvent); 2457 event.type = "itap"; 2458 if ((start && stop) && (start.x == stop.x && start.y == stop.y))($.event.dispatch || $.event.handle).call(self, event); 2459 start = stop = undefined 2460 }) 2461 }) 2462 }, 2463 teardown: function() { 2464 $(this).unbind(tapSettings.startEvent) 2465 } 2466 } 2467 }()); 2468 (function() { 2469 fullScreenApi = { 2470 supportsFullScreen: !1, 2471 isFullScreen: function() { 2472 return !1 2473 }, 2474 requestFullScreen: function() {}, 2475 cancelFullScreen: function() {}, 2476 fullScreenEventName: '', 2477 prefix: '' 2478 }, browserPrefixes = 'webkit moz o ms khtml'.split(' '); 2479 if (typeof document.cancelFullScreen != 'undefined') { 2480 fullScreenApi.supportsFullScreen = !0 2481 } else { 2482 for (var i = 0, il = browserPrefixes.length; i < il; i++) { 2483 fullScreenApi.prefix = browserPrefixes[i]; 2484 if (typeof document[fullScreenApi.prefix + 'CancelFullScreen'] != 'undefined') { 2485 fullScreenApi.supportsFullScreen = !0; 2486 break 2487 } 2488 } 2489 } 2490 if (fullScreenApi.supportsFullScreen) { 2491 fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange'; 2492 fullScreenApi.isFullScreen = function() { 2493 switch (this.prefix) { 2494 case '': 2495 return document.fullScreen; 2496 case 'webkit': 2497 return document.webkitIsFullScreen; 2498 default: 2499 return document[this.prefix + 'FullScreen'] 2500 } 2501 } 2502 fullScreenApi.requestFullScreen = function(el) { 2503 return (this.prefix === '') ? el.requestFullScreen() : el[this.prefix + 'RequestFullScreen']() 2504 } 2505 fullScreenApi.cancelFullScreen = function(el) { 2506 return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + 'CancelFullScreen']() 2507 } 2508 } 2509 }()); 2510 (function() { 2511 function uaMatch(ua) { 2512 ua = ua.toLowerCase(); 2513 var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; 2514 return { 2515 browser: match[1] || "", 2516 version: match[2] || "0" 2517 } 2518 } 2519 var matched = uaMatch(navigator.userAgent); 2520 browser = {}; 2521 if (matched.browser) { 2522 browser[matched.browser] = !0; 2523 browser.version = matched.version 2524 } 2525 if (browser.chrome) { 2526 browser.webkit = !0 2527 } else if (browser.webkit) { 2528 browser.safari = !0 2529 } 2530 }()); 2531 (function() { 2532 var prefixes = ['', 'webkit', 'moz', 'ms', 'o']; 2533 var el = document.createElement('div'); 2534 2535 function testProp(prop) { 2536 for (var p = 0, pl = prefixes.length; p < pl; p++) { 2537 var prefixedProp = prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1) : prop; 2538 if (el.style[prefixedProp] !== undefined) { 2539 return prefixedProp 2540 } 2541 } 2542 } 2543 transform = testProp('transform') || ''; 2544 gpuAcceleration = testProp('perspective') ? 'translateZ(0) ' : '' 2545 }()); 2546 var PluginDetect = { 2547 version: "0.7.9", 2548 name: "PluginDetect", 2549 handler: function(c, b, a) { 2550 return function() { 2551 c(b, a) 2552 } 2553 }, 2554 openTag: "<", 2555 isDefined: function(b) { 2556 return typeof b != "undefined" 2557 }, 2558 isArray: function(b) { 2559 return (/array/i).test(Object.prototype.toString.call(b)) 2560 }, 2561 isFunc: function(b) { 2562 return typeof b == "function" 2563 }, 2564 isString: function(b) { 2565 return typeof b == "string" 2566 }, 2567 isNum: function(b) { 2568 return typeof b == "number" 2569 }, 2570 isStrNum: function(b) { 2571 return (typeof b == "string" && (/\d/).test(b)) 2572 }, 2573 getNumRegx: /[\d][\d\.\_,-]*/, 2574 splitNumRegx: /[\.\_,-]/g, 2575 getNum: function(b, c) { 2576 var d = this, 2577 a = d.isStrNum(b) ? (d.isDefined(c) ? new RegExp(c) : d.getNumRegx).exec(b) : null; 2578 return a ? a[0] : null 2579 }, 2580 compareNums: function(h, f, d) { 2581 var e = this, 2582 c, b, a, g = parseInt; 2583 if (e.isStrNum(h) && e.isStrNum(f)) { 2584 if (e.isDefined(d) && d.compareNums) { 2585 return d.compareNums(h, f) 2586 } 2587 c = h.split(e.splitNumRegx); 2588 b = f.split(e.splitNumRegx); 2589 for (a = 0; a < min(c.length, b.length); a++) { 2590 if (g(c[a], 10) > g(b[a], 10)) { 2591 return 1 2592 } 2593 if (g(c[a], 10) < g(b[a], 10)) { 2594 return -1 2595 } 2596 } 2597 } 2598 return 0 2599 }, 2600 formatNum: function(b, c) { 2601 var d = this, 2602 a, e; 2603 if (!d.isStrNum(b)) { 2604 return null 2605 } 2606 if (!d.isNum(c)) { 2607 c = 4 2608 } 2609 c--; 2610 e = b.replace(/\s/g, "").split(d.splitNumRegx).concat(["0", "0", "0", "0"]); 2611 for (a = 0; a < 4; a++) { 2612 if (/^(0+)(.+)$/.test(e[a])) { 2613 e[a] = RegExp.$2 2614 } 2615 if (a > c || !(/\d/).test(e[a])) { 2616 e[a] = "0" 2617 } 2618 } 2619 return e.slice(0, 4).join(",") 2620 }, 2621 $$hasMimeType: function(a) { 2622 return function(c) { 2623 if (!a.isIE && c) { 2624 var f, e, b, d = a.isArray(c) ? c : (a.isString(c) ? [c] : []); 2625 for (b = 0; b < d.length; b++) { 2626 if (a.isString(d[b]) && /[^\s]/.test(d[b])) { 2627 f = navigator.mimeTypes[d[b]]; 2628 e = f ? f.enabledPlugin : 0; 2629 if (e && (e.name || e.description)) { 2630 return f 2631 } 2632 } 2633 } 2634 } 2635 return null 2636 } 2637 }, 2638 findNavPlugin: function(l, e, c) { 2639 var j = this, 2640 h = new RegExp(l, "i"), 2641 d = (!j.isDefined(e) || e) ? /\d/ : 0, 2642 k = c ? new RegExp(c, "i") : 0, 2643 a = navigator.plugins, 2644 g = "", 2645 f, b, m; 2646 for (f = 0; f < a.length; f++) { 2647 m = a[f].description || g; 2648 b = a[f].name || g; 2649 if ((h.test(m) && (!d || d.test(RegExp.leftContext + RegExp.rightContext))) || (h.test(b) && (!d || d.test(RegExp.leftContext + RegExp.rightContext)))) { 2650 if (!k || !(k.test(m) || k.test(b))) { 2651 return a[f] 2652 } 2653 } 2654 } 2655 return null 2656 }, 2657 getMimeEnabledPlugin: function(k, m, c) { 2658 var e = this, 2659 f, b = new RegExp(m, "i"), 2660 h = "", 2661 g = c ? new RegExp(c, "i") : 0, 2662 a, l, d, j = e.isString(k) ? [k] : k; 2663 for (d = 0; d < j.length; d++) { 2664 if ((f = e.hasMimeType(j[d])) && (f = f.enabledPlugin)) { 2665 l = f.description || h; 2666 a = f.name || h; 2667 if (b.test(l) || b.test(a)) { 2668 if (!g || !(g.test(l) || g.test(a))) { 2669 return f 2670 } 2671 } 2672 } 2673 } 2674 return 0 2675 }, 2676 getPluginFileVersion: function(f, b) { 2677 var h = this, 2678 e, d, g, a, c = -1; 2679 if (h.OS > 2 || !f || !f.version || !(e = h.getNum(f.version))) { 2680 return b 2681 } 2682 if (!b) { 2683 return e 2684 }
2685 e = h.formatNum(e); 2686 b = h.formatNum(b); 2687 d = b.split(h.splitNumRegx); 2688 g = e.split(h.splitNumRegx); 2689 for (a = 0; a < d.length; a++) { 2690 if (c > -1 && a > c && d[a] != "0") { 2691 return b 2692 } 2693 if (g[a] != d[a]) { 2694 if (c == -1) { 2695 c = a 2696 } 2697 if (d[a] != "0") { 2698 return b 2699 } 2700 } 2701 } 2702 return e 2703 }, 2704 AXO: window.ActiveXObject, 2705 getAXO: function(a) { 2706 var f = null, 2707 d, b = this, 2708 c = {}; 2709 try { 2710 f = new b.AXO(a) 2711 } catch (d) {} 2712 return f 2713 }, 2714 convertFuncs: function(f) { 2715 var a, g, d, b = /^[\$][\$]/, 2716 c = this; 2717 for (a in f) { 2718 if (b.test(a)) { 2719 try { 2720 g = a.slice(2); 2721 if (g.length > 0 && !f[g]) { 2722 f[g] = f[a](f); 2723 delete f[a] 2724 } 2725 } catch (d) {} 2726 } 2727 } 2728 }, 2729 initObj: function(e, b, d) { 2730 var a, c; 2731 if (e) { 2732 if (e[b[0]] == 1 || d) { 2733 for (a = 0; a < b.length; a = a + 2) { 2734 e[b[a]] = b[a + 1] 2735 } 2736 } 2737 for (a in e) { 2738 c = e[a]; 2739 if (c && c[b[0]] == 1) { 2740 this.initObj(c, b) 2741 } 2742 } 2743 } 2744 }, 2745 initScript: function() { 2746 var d = this, 2747 a = navigator, 2748 h, i = document, 2749 l = a.userAgent || "", 2750 j = a.vendor || "", 2751 b = a.platform || "", 2752 k = a.product || ""; 2753 d.initObj(d, ["$", d]); 2754 for (h in d.Plugins) { 2755 if (d.Plugins[h]) { 2756 d.initObj(d.Plugins[h], ["$", d, "$$", d.Plugins[h]], 1) 2757 } 2758 } 2759 d.convertFuncs(d); 2760 d.OS = 100; 2761 if (b) { 2762 var g = ["Win", 1, "Mac", 2, "Linux", 3, "FreeBSD", 4, "iPhone", 21.1, "iPod", 21.2, "iPad", 21.3, "Win.*CE", 22.1, "Win.*Mobile", 22.2, "Pocket\\s*PC", 22.3, "", 100]; 2763 for (h = g.length - 2; h >= 0; h = h - 2) { 2764 if (g[h] && new RegExp(g[h], "i").test(b)) { 2765 d.OS = g[h + 1]; 2766 break 2767 } 2768 } 2769 }; 2770 d.head = i.getElementsByTagName("head")[0] || i.getElementsByTagName("body")[0] || i.body || null; 2771 d.isIE = new Function("return/*@cc_on!@*/!1")(); 2772 d.verIE = d.isIE && (/MSIE\s*(\d+\.?\d*)/i).test(l) ? parseFloat(RegExp.$1, 10) : null; 2773 d.verIEfull = null; 2774 d.docModeIE = null; 2775 if (d.isIE) { 2776 var f, n, c = document.createElement("div"); 2777 try { 2778 c.style.behavior = "url(#default#clientcaps)"; 2779 d.verIEfull = (c.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}", "componentid")).replace(/,/g, ".") 2780 } catch (f) {} 2781 n = parseFloat(d.verIEfull || "0", 10); 2782 d.docModeIE = i.documentMode || ((/back/i).test(i.compatMode || "") ? 5 : n) || d.verIE; 2783 d.verIE = n || d.docModeIE 2784 }; 2785 d.ActiveXEnabled = !1; 2786 if (d.isIE) { 2787 var h, m = ["Msxml2.XMLHTTP", "Msxml2.DOMDocument", "Microsoft.XMLDOM", "ShockwaveFlash.ShockwaveFlash", "TDCCtl.TDCCtl", "Shell.UIHelper", "Scripting.Dictionary", "wmplayer.ocx"]; 2788 for (h = 0; h < m.length; h++) { 2789 if (d.getAXO(m[h])) { 2790 d.ActiveXEnabled = !0; 2791 break 2792 } 2793 } 2794 }; 2795 d.isGecko = (/Gecko/i).test(k) && (/Gecko\s*\/\s*\d/i).test(l);
2796 d.verGecko = d.isGecko ? d.formatNum((/rv\s*\:\s*([\.\,\d]+)/i).test(l) ? RegExp.$1 : "0.9") : null; 2797 d.isChrome = (/Chrome\s*\/\s*(\d[\d\.]*)/i).test(l); 2798 d.verChrome = d.isChrome ? d.formatNum(RegExp.$1) : null; 2799 d.isSafari = ((/Apple/i).test(j) || (!j && !d.isChrome)) && (/Safari\s*\/\s*(\d[\d\.]*)/i).test(l); 2800 d.verSafari = d.isSafari && (/Version\s*\/\s*(\d[\d\.]*)/i).test(l) ? d.formatNum(RegExp.$1) : null; 2801 d.isOpera = (/Opera\s*[\/]?\s*(\d+\.?\d*)/i).test(l); 2802 d.verOpera = d.isOpera && ((/Version\s*\/\s*(\d+\.?\d*)/i).test(l) || 1) ? parseFloat(RegExp.$1, 10) : null; 2803 d.addWinEvent("load", d.handler(d.runWLfuncs, d)) 2804 }, 2805 init: function(d) { 2806 var c = this, 2807 b, d, a = { 2808 status: -3, 2809 plugin: 0 2810 }; 2811 if (!c.isString(d)) { 2812 return a 2813 } 2814 if (d.length == 1) { 2815 c.getVersionDelimiter = d; 2816 return a 2817 } 2818 d = d.toLowerCase().replace(/\s/g, ""); 2819 b = c.Plugins[d]; 2820 if (!b || !b.getVersion) { 2821 return a 2822 } 2823 a.plugin = b; 2824 if (!c.isDefined(b.installed)) { 2825 b.installed = null; 2826 b.version = null; 2827 b.version0 = null; 2828 b.getVersionDone = null; 2829 b.pluginName = d 2830 } 2831 c.garbage = !1; 2832 if (c.isIE && !c.ActiveXEnabled && d !== "java") { 2833 a.status = -2; 2834 return a 2835 } 2836 a.status = 1; 2837 return a 2838 }, 2839 fPush: function(b, a) { 2840 var c = this; 2841 if (c.isArray(a) && (c.isFunc(b) || (c.isArray(b) && b.length > 0 && c.isFunc(b[0])))) { 2842 a.push(b) 2843 } 2844 }, 2845 callArray: function(b) { 2846 var c = this, 2847 a; 2848 if (c.isArray(b)) { 2849 for (a = 0; a < b.length; a++) { 2850 if (b[a] === null) { 2851 return 2852 } 2853 c.call(b[a]); 2854 b[a] = null 2855 } 2856 } 2857 }, 2858 call: function(c) { 2859 var b = this, 2860 a = b.isArray(c) ? c.length : -1; 2861 if (a > 0 && b.isFunc(c[0])) { 2862 c[0](b, a > 1 ? c[1] : 0, a > 2 ? c[2] : 0, a > 3 ? c[3] : 0) 2863 } else { 2864 if (b.isFunc(c)) { 2865 c(b) 2866 } 2867 } 2868 }, 2869 getVersionDelimiter: ",", 2870 $$getVersion: function(a) { 2871 return function(g, d, c) { 2872 var e = a.init(g), 2873 f, b, h = {}; 2874 if (e.status < 0) { 2875 return null 2876 }; 2877 f = e.plugin; 2878 if (f.getVersionDone != 1) { 2879 f.getVersion(null, d, c); 2880 if (f.getVersionDone === null) { 2881 f.getVersionDone = 1 2882 } 2883 } 2884 a.cleanup(); 2885 b = (f.version || f.version0); 2886 b = b ? b.replace(a.splitNumRegx, a.getVersionDelimiter) : b; 2887 return b 2888 } 2889 }, 2890 cleanup: function() { 2891 var a = this; 2892 if (a.garbage && a.isDefined(window.CollectGarbage)) { 2893 window.CollectGarbage() 2894 } 2895 }, 2896 isActiveXObject: function(d, b) { 2897 var f = this, 2898 a = !1, 2899 g, c = '<object width="1" height="1" style="display:none" ' + d.getCodeBaseVersion(b) + ">" + d.HTML + f.openTag + "/object>"; 2900 if (!f.head) { 2901 return a 2902 } 2903 f.head.insertBefore(document.createElement("object"), f.head.firstChild); 2904 f.head.firstChild.outerHTML = c; 2905 try { 2906 f.head.firstChild.classid = d.classID 2907 } catch (g) {} 2908 try { 2909 if (f.head.firstChild.object) { 2910 a = !0 2911 } 2912 } catch (g) {} 2913 try { 2914 if (a && f.head.firstChild.readyState < 4) { 2915 f.garbage = !0 2916 } 2917 } catch (g) {} 2918 f.head.removeChild(f.head.firstChild); 2919 return a 2920 }, 2921 codebaseSearch: function(f, b) { 2922 var c = this; 2923 if (!c.ActiveXEnabled || !f) { 2924 return null 2925 } 2926 if (f.BIfuncs && f.BIfuncs.length && f.BIfuncs[f.BIfuncs.length - 1] !== null) { 2927 c.callArray(f.BIfuncs) 2928 } 2929 var d, o = f.SEARCH, 2930 k = {}; 2931 if (c.isStrNum(b)) { 2932 if (o.match && o.min && c.compareNums(b, o.min) <= 0) { 2933 return !0 2934 } 2935 if (o.match && o.max && c.compareNums(b, o.max) >= 0) { 2936 return !1 2937 } 2938 d = c.isActiveXObject(f, b); 2939 if (d && (!o.min || c.compareNums(b, o.min) > 0)) { 2940 o.min = b 2941 } 2942 if (!d && (!o.max || c.compareNums(b, o.max) < 0)) { 2943 o.max = b 2944 } 2945 return d 2946 }; 2947 var e = [0, 0, 0, 0], 2948 l = [].concat(o.digits), 2949 a = o.min ? 1 : 0, 2950 j, i, h, g, m, n = function(p, r) { 2951 var q = [].concat(e); 2952 q[p] = r;
2953 return c.isActiveXObject(f, q.join(",")) 2954 }; 2955 if (o.max) { 2956 g = o.max.split(c.splitNumRegx); 2957 for (j = 0; j < g.length; j++) { 2958 g[j] = parseInt(g[j], 10) 2959 } 2960 if (g[0] < l[0]) { 2961 l[0] = g[0] 2962 } 2963 } 2964 if (o.min) { 2965 m = o.min.split(c.splitNumRegx); 2966 for (j = 0; j < m.length; j++) { 2967 m[j] = parseInt(m[j], 10) 2968 } 2969 if (m[0] > e[0]) { 2970 e[0] = m[0] 2971 } 2972 } 2973 if (m && g) { 2974 for (j = 1; j < m.length; j++) { 2975 if (m[j - 1] != g[j - 1]) { 2976 break 2977 } 2978 if (g[j] < l[j]) { 2979 l[j] = g[j] 2980 } 2981 if (m[j] > e[j]) { 2982 e[j] = m[j] 2983 } 2984 } 2985 } 2986 if (o.max) { 2987 for (j = 1; j < l.length; j++) { 2988 if (g[j] > 0 && l[j] == 0 && l[j - 1] < o.digits[j - 1]) { 2989 l[j - 1] += 1; 2990 break 2991 } 2992 } 2993 }; 2994 for (j = 0; j < l.length; j++) { 2995 h = {}; 2996 for (i = 0; i < 20; i++) { 2997 if (l[j] - e[j] < 1) { 2998 break 2999 } 3000 d = round((l[j] + e[j]) / 2); 3001 if (h["a" + d]) { 3002 break 3003 } 3004 h["a" + d] = 1; 3005 if (n(j, d)) { 3006 e[j] = d; 3007 a = 1 3008 } else { 3009 l[j] = d 3010 } 3011 } 3012 l[j] = e[j]; 3013 if (!a && n(j, e[j])) { 3014 a = 1 3015 }; 3016 if (!a) { 3017 break 3018 } 3019 }; 3020 return a ? e.join(",") : null 3021 }, 3022 addWinEvent: function(d, c) { 3023 var e = this, 3024 a = window, 3025 b; 3026 if (e.isFunc(c)) { 3027 if (a.addEventListener) { 3028 a.addEventListener(d, c, !1) 3029 } else { 3030 if (a.attachEvent) { 3031 a.attachEvent("on" + d, c) 3032 } else { 3033 b = a["on" + d]; 3034 a["on" + d] = e.winHandler(c, b) 3035 } 3036 } 3037 } 3038 }, 3039 winHandler: function(d, c) { 3040 return function() { 3041 d(); 3042 if (typeof c == "function") { 3043 c() 3044 } 3045 } 3046 }, 3047 WLfuncs0: [], 3048 WLfuncs: [], 3049 runWLfuncs: function(a) { 3050 var b = {}; 3051 a.winLoaded = !0; 3052 a.callArray(a.WLfuncs0); 3053 a.callArray(a.WLfuncs); 3054 if (a.onDoneEmptyDiv) { 3055 a.onDoneEmptyDiv() 3056 } 3057 }, 3058 winLoaded: !1, 3059 $$onWindowLoaded: function(a) { 3060 return function(b) { 3061 if (a.winLoaded) { 3062 a.call(b) 3063 } else { 3064 a.fPush(b, a.WLfuncs) 3065 } 3066 } 3067 }, 3068 div: null, 3069 divID: "plugindetect", 3070 divWidth: 50, 3071 pluginSize: 1, 3072 emptyDiv: function() { 3073 var d = this, 3074 b, h, c, a, f, g; 3075 if (d.div && d.div.childNodes) { 3076 for (b = d.div.childNodes.length - 1; b >= 0; b--) { 3077 c = d.div.childNodes[b]; 3078 if (c && c.childNodes) { 3079 for (h = c.childNodes.length - 1; h >= 0; h--) { 3080 g = c.childNodes[h]; 3081 try { 3082 c.removeChild(g) 3083 } catch (f) {} 3084 } 3085 } 3086 if (c) { 3087 try { 3088 d.div.removeChild(c) 3089 } catch (f) {} 3090 } 3091 } 3092 } 3093 if (!d.div) { 3094 a = document.getElementById(d.divID); 3095 if (a) { 3096 d.div = a 3097 } 3098 } 3099 if (d.div && d.div.parentNode) { 3100 try { 3101 d.div.parentNode.removeChild(d.div) 3102 } catch (f) {} 3103 d.div = null 3104 } 3105 }, 3106 DONEfuncs: [], 3107 onDoneEmptyDiv: function() { 3108 var c = this, 3109 a, b; 3110 if (!c.winLoaded) { 3111 return 3112 } 3113 if (c.WLfuncs && c.WLfuncs.length && c.WLfuncs[c.WLfuncs.length - 1] !== null) { 3114 return 3115 } 3116 for (a in c) { 3117 b = c[a]; 3118 if (b && b.funcs) { 3119 if (b.OTF == 3) { 3120 return 3121 } 3122 if (b.funcs.length && b.funcs[b.funcs.length - 1] !== null) { 3123 return 3124 } 3125 } 3126 } 3127 for (a = 0; a < c.DONEfuncs.length; a++) { 3128 c.callArray(c.DONEfuncs) 3129 } 3130 c.emptyDiv() 3131 }, 3132 getWidth: function(c) { 3133 if (c) { 3134 var a = c.scrollWidth || c.offsetWidth, 3135 b = this; 3136 if (b.isNum(a)) { 3137 return a 3138 } 3139 } 3140 return -1 3141 }, 3142 getTagStatus: function(m, g, a, b) { 3143 var c = this, 3144 f, k = m.span, 3145 l = c.getWidth(k), 3146 h = a.span, 3147 j = c.getWidth(h), 3148 d = g.span, 3149 i = c.getWidth(d); 3150 if (!k || !h || !d || !c.getDOMobj(m)) { 3151 return -2 3152 } 3153 if (j < i || l < 0 || j < 0 || i < 0 || i <= c.pluginSize || c.pluginSize < 1) { 3154 return 0 3155 } 3156 if (l >= i) { 3157 return -1 3158 } 3159 try { 3160 if (l == c.pluginSize && (!c.isIE || c.getDOMobj(m).readyState == 4)) { 3161 if (!m.winLoaded && c.winLoaded) { 3162 return 1 3163 } 3164 if (m.winLoaded && c.isNum(b)) { 3165 if (!c.isNum(m.count)) { 3166 m.count = b 3167 } 3168 if (b - m.count >= 10) { 3169 return 1 3170 } 3171 } 3172 } 3173 } catch (f) {} 3174 return 0 3175 }, 3176 getDOMobj: function(g, a) { 3177 var f, d = this, 3178 c = g ? g.span : 0, 3179 b = c && c.firstChild ? 1 : 0; 3180 try { 3181 if (b && a) { 3182 d.div.focus() 3183 } 3184 } catch (f) {} 3185 return b ? c.firstChild : null 3186 }, 3187 setStyle: function(b, g) { 3188 var f = b.style, 3189 a, d, c = this; 3190 if (f && g) { 3191 for (a = 0; a < g.length; a = a + 2) { 3192 try { 3193 f[g[a]] = g[a + 1] 3194 } catch (d) {} 3195 } 3196 } 3197 }, 3198 insertDivInBody: function(i, g) { 3199 var f, c = this, 3200 h = "pd33993399", 3201 b = null, 3202 d = g ? window.top.document : window.document, 3203 a = d.getElementsByTagName("body")[0] || d.body; 3204 if (!a) { 3205 try { 3206 d.write('<div id="' + h + '">.' + c.openTag + "/div>"); 3207 b = d.getElementById(h) 3208 } catch (f) {} 3209 } 3210 a = d.getElementsByTagName("body")[0] || d.body; 3211 if (a) { 3212 a.insertBefore(i, a.firstChild); 3213 if (b) { 3214 a.removeChild(b) 3215 } 3216 } 3217 }, 3218 insertHTML: function(f, b, g, a, k) { 3219 var l, m = document, 3220 j = this, 3221 p, o = m.createElement("span"), 3222 n, i; 3223 var c = ["outlineStyle", "none", "borderStyle", "none", "padding", "0px", "margin", "0px", "visibility", "visible"]; 3224 var h = "outline-style:none;border-style:none;padding:0px;margin:0px;visibility:visible;"; 3225 if (!j.isDefined(a)) { 3226 a = "" 3227 } 3228 if (j.isString(f) && (/[^\s]/).test(f)) { 3229 f = f.toLowerCase().replace(/\s/g, ""); 3230 p = j.openTag + f + ' width="' + j.pluginSize + '" height="' + j.pluginSize + '" '; 3231 p += 'style="' + h + 'display:inline;" '; 3232 for (n = 0; n < b.length; n = n + 2) { 3233 if (/[^\s]/.test(b[n + 1])) { 3234 p += b[n] + '="' + b[n + 1] + '" ' 3235 } 3236 } 3237 p += ">"; 3238 for (n = 0; n < g.length; n = n + 2) { 3239 if (/[^\s]/.test(g[n + 1])) { 3240 p += j.openTag + 'param name="' + g[n] + '" value="' + g[n + 1] + '" />' 3241 } 3242 } 3243 p += a + j.openTag + "/" + f + ">" 3244 } else { 3245 p = a 3246 } 3247 if (!j.div) { 3248 i = m.getElementById(j.divID); 3249 if (i) { 3250 j.div = i 3251 } else { 3252 j.div = m.createElement("div"); 3253 j.div.id = j.divID 3254 } 3255 j.setStyle(j.div, c.concat(["width", j.divWidth + "px", "height", (j.pluginSize + 3) + "px", "fontSize", (j.pluginSize + 3) + "px", "lineHeight", (j.pluginSize + 3) + "px", "verticalAlign", "baseline", "display", "block"])); 3256 if (!i) { 3257 j.setStyle(j.div, ["position", "absolute", "right", "0px", "top", "0px"]);
3258 j.insertDivInBody(j.div) 3259 } 3260 } 3261 if (j.div && j.div.parentNode) { 3262 j.setStyle(o, c.concat(["fontSize", (j.pluginSize + 3) + "px", "lineHeight", (j.pluginSize + 3) + "px", "verticalAlign", "baseline", "display", "inline"])); 3263 try { 3264 o.innerHTML = p 3265 } catch (l) {}; 3266 try { 3267 j.div.appendChild(o) 3268 } catch (l) {}; 3269 return { 3270 span: o, 3271 winLoaded: j.winLoaded, 3272 tagName: f, 3273 outerHTML: p 3274 } 3275 } 3276 return { 3277 span: null, 3278 winLoaded: j.winLoaded, 3279 tagName: "", 3280 outerHTML: p 3281 } 3282 }, 3283 Plugins: { 3284 quicktime: { 3285 mimeType: ["video/quicktime", "application/x-quicktimeplayer", "image/x-macpaint", "image/x-quicktime"], 3286 progID: "QuickTimeCheckObject.QuickTimeCheck.1", 3287 progID0: "QuickTime.QuickTime", 3288 classID: "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B", 3289 minIEver: 7, 3290 HTML: '<param name="src" value="" /><param name="controller" value="false" />', 3291 getCodeBaseVersion: function(a) { 3292 return 'codebase="#version=' + a + '"' 3293 }, 3294 SEARCH: { 3295 min: 0, 3296 max: 0, 3297 match: 0, 3298 digits: [16, 128, 128, 0] 3299 }, 3300 getVersion: function(c) { 3301 var f = this, 3302 d = f.$, 3303 a = null, 3304 e = null, 3305 b; 3306 if (!d.isIE) { 3307 if (d.hasMimeType(f.mimeType)) { 3308 e = d.OS != 3 ? d.findNavPlugin("QuickTime.*Plug-?in", 0) : null; 3309 if (e && e.name) { 3310 a = d.getNum(e.name) 3311 } 3312 } 3313 } else { 3314 if (d.isStrNum(c)) { 3315 b = c.split(d.splitNumRegx); 3316 if (b.length > 3 && parseInt(b[3], 10) > 0) { 3317 b[3] = "9999" 3318 } 3319 c = b.join(",") 3320 } 3321 if (d.isStrNum(c) && d.verIE >= f.minIEver && f.canUseIsMin() > 0) { 3322 f.installed = f.isMin(c); 3323 f.getVersionDone = 0; 3324 return 3325 } 3326 f.getVersionDone = 1; 3327 if (!a && d.verIE >= f.minIEver) { 3328 a = f.CDBASE2VER(d.codebaseSearch(f)) 3329 } 3330 if (!a) { 3331 e = d.getAXO(f.progID); 3332 if (e && e.QuickTimeVersion) { 3333 a = e.QuickTimeVersion.toString(16); 3334 a = parseInt(a.charAt(0), 16) + "." + parseInt(a.charAt(1), 16) + "." + parseInt(a.charAt(2), 16) 3335 } 3336 } 3337 } 3338 f.installed = a ? 1 : (e ? 0 : -1);
3339 f.version = d.formatNum(a, 3) 3340 }, 3341 cdbaseUpper: ["7,60,0,0", "0,0,0,0"], 3342 cdbaseLower: ["7,50,0,0", null], 3343 cdbase2ver: [function(c, b) { 3344 var a = b.split(c.$.splitNumRegx); 3345 return [a[0], a[1].charAt(0), a[1].charAt(1), a[2]].join(",") 3346 }, null], 3347 CDBASE2VER: function(f) { 3348 var e = this, 3349 c = e.$, 3350 b, a = e.cdbaseUpper, 3351 d = e.cdbaseLower; 3352 if (f) { 3353 f = c.formatNum(f); 3354 for (b = 0; b < a.length; b++) { 3355 if (a[b] && c.compareNums(f, a[b]) < 0 && d[b] && c.compareNums(f, d[b]) >= 0 && e.cdbase2ver[b]) { 3356 return e.cdbase2ver[b](e, f) 3357 } 3358 } 3359 } 3360 return f 3361 }, 3362 canUseIsMin: function() { 3363 var f = this, 3364 d = f.$, 3365 b, c = f.canUseIsMin, 3366 a = f.cdbaseUpper, 3367 e = f.cdbaseLower; 3368 if (!c.value) { 3369 c.value = -1; 3370 for (b = 0; b < a.length; b++) { 3371 if (a[b] && d.codebaseSearch(f, a[b])) { 3372 c.value = 1; 3373 break 3374 } 3375 if (e[b] && d.codebaseSearch(f, e[b])) { 3376 c.value = -1; 3377 break 3378 } 3379 } 3380 } 3381 f.SEARCH.match = c.value == 1 ? 1 : 0; 3382 return c.value 3383 }, 3384 isMin: function(c) { 3385 var b = this, 3386 a = b.$; 3387 return a.codebaseSearch(b, c) ? 0.7 : -1 3388 } 3389 }, 3390 flash: { 3391 mimeType: "application/x-shockwave-flash", 3392 progID: "ShockwaveFlash.ShockwaveFlash", 3393 classID: "clsid:D27CDB6E-AE6D-11CF-96B8-444553540000", 3394 getVersion: function() { 3395 var b = function(i) { 3396 if (!i) { 3397 return null 3398 } 3399 var e = /[\d][\d\,\.\s]*[rRdD]{0,1}[\d\,]*/.exec(i); 3400 return e ? e[0].replace(/[rRdD\.]/g, ",").replace(/\s/g, "") : null 3401 }; 3402 var j = this, 3403 g = j.$, 3404 k, h, l = null, 3405 c = null, 3406 a = null, 3407 f, m, d; 3408 if (!g.isIE) { 3409 m = g.hasMimeType(j.mimeType); 3410 if (m) { 3411 f = g.getDOMobj(g.insertHTML("object", ["type", j.mimeType], [], "", j)); 3412 try { 3413 l = g.getNum(f.GetVariable("$version")) 3414 } catch (k) {} 3415 } 3416 if (!l) { 3417 d = m ? m.enabledPlugin : null; 3418 if (d && d.description) { 3419 l = b(d.description) 3420 } 3421 if (l) { 3422 l = g.getPluginFileVersion(d, l) 3423 } 3424 } 3425 } else { 3426 for (h = 15; h > 2; h--) { 3427 c = g.getAXO(j.progID + "." + h); 3428 if (c) { 3429 a = h.toString(); 3430 break 3431 } 3432 } 3433 if (!c) { 3434 c = g.getAXO(j.progID) 3435 } 3436 if (a == "6") { 3437 try { 3438 c.AllowScriptAccess = "always" 3439 } catch (k) { 3440 return "6,0,21,0" 3441 } 3442 } 3443 try { 3444 l = b(c.GetVariable("$version")) 3445 } catch (k) {} 3446 if (!l && a) { 3447 l = a 3448 } 3449 } 3450 j.installed = l ? 1 : -1;
3451 j.version = g.formatNum(l); 3452 return !0 3453 } 3454 }, 3455 shockwave: { 3456 mimeType: "application/x-director", 3457 progID: "SWCtl.SWCtl", 3458 classID: "clsid:166B1BCA-3F9C-11CF-8075-444553540000", 3459 getVersion: function() { 3460 var a = null, 3461 b = null, 3462 g, f, d = this, 3463 c = d.$; 3464 if (!c.isIE) { 3465 f = c.findNavPlugin("Shockwave\\s*for\\s*Director"); 3466 if (f && f.description && c.hasMimeType(d.mimeType)) { 3467 a = c.getNum(f.description) 3468 } 3469 if (a) { 3470 a = c.getPluginFileVersion(f, a) 3471 } 3472 } else { 3473 try { 3474 b = c.getAXO(d.progID).ShockwaveVersion("") 3475 } catch (g) {} 3476 if (c.isString(b) && b.length > 0) { 3477 a = c.getNum(b) 3478 } else { 3479 if (c.getAXO(d.progID + ".8")) { 3480 a = "8" 3481 } else { 3482 if (c.getAXO(d.progID + ".7")) { 3483 a = "7" 3484 } else { 3485 if (c.getAXO(d.progID + ".1")) { 3486 a = "6" 3487 } 3488 } 3489 } 3490 } 3491 } 3492 d.installed = a ? 1 : -1; 3493 d.version = c.formatNum(a) 3494 } 3495 }, 3496 zz: 0 3497 } 3498 }; 3499 PluginDetect.initScript(); 3500 var gArgCountErr = 'The "%%" function requires an even number of arguments.\nArguments should be in the form "atttributeName", "attributeValue", ...', 3501 gTagAttrs = null, 3502 gQTGeneratorVersion = 1; 3503 3504 function AC_QuickTimeVersion() { 3505 return gQTGeneratorVersion 3506 } 3507 3508 function _QTComplain(a, b) { 3509 b = b.replace("%%", a); 3510 alert(b) 3511 } 3512 3513 function _QTAddAttribute(a, b, c) { 3514 var d; 3515 d = gTagAttrs[a + b]; 3516 null == d && (d = gTagAttrs[b]); 3517 return null != d ? (0 == b.indexOf(a) && null == c && (c = b.substring(a.length)), null == c && (c = b), c + '="' + d + '" ') : "" 3518 } 3519 3520 function _QTAddObjectAttr(a, b) { 3521 if (0 == a.indexOf("emb#")) 3522 return ""; 3523 0 == a.indexOf("obj#") && null == b && (b = a.substring(4)); 3524 return _QTAddAttribute("obj#", a, b) 3525 } 3526 3527 function _QTAddEmbedAttr(a, b) { 3528 if (0 == a.indexOf("obj#")) 3529 return ""; 3530 0 == a.indexOf("emb#") && null == b && (b = a.substring(4)); 3531 return _QTAddAttribute("emb#", a, b) 3532 } 3533 3534 function _QTAddObjectParam(a, b) { 3535 var c, d = "", 3536 e = b ? " />" : ">"; - 1 == a.indexOf("emb#") && (c = gTagAttrs["obj#" + a], null == c && (c = gTagAttrs[a]), 0 == a.indexOf("obj#") && (a = a.substring(4)), null != c && (d = ' <param name="' + a + '" value="' + c + '"' + e + "\n")); 3537 return d 3538 } 3539 3540 function _QTDeleteTagAttrs() { 3541 for (var a = 0; a < arguments.length; a++) { 3542 var b = arguments[a]; 3543 delete gTagAttrs[b]; 3544 delete gTagAttrs["emb#" + b]; 3545 delete gTagAttrs["obj#" + b] 3546 } 3547 } 3548 3549 function _QTGenerate(a, b, c) { 3550 if (4 > c.length || 0 != c.length % 2) 3551 return _QTComplain(a, gArgCountErr), ""; 3552 gTagAttrs = []; 3553 gTagAttrs.src = c[0]; 3554 gTagAttrs.width = c[1]; 3555 gTagAttrs.height = c[2]; 3556 gTagAttrs.classid = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"; 3557 gTagAttrs.pluginspage = "http://www.apple.com/quicktime/download/"; 3558 a = c[3]; 3559 if (null == a || "" == a) 3560 a = "6,0,2,0"; 3561 gTagAttrs.codebase = "http://www.apple.com/qtactivex/qtplugin.cab#ver
3561sion=" + a; 3562 for (var d, e = 4; e < c.length; e += 2) 3563 d = c[e].toLowerCase(), a = c[e + 1], "name" == d || "id" == d ? gTagAttrs.name = a : gTagAttrs[d] = a; 3564 c = "<object " + _QTAddObjectAttr("classid") + _QTAddObjectAttr("width") + _QTAddObjectAttr("height") + _QTAddObjectAttr("codebase") + _QTAddObjectAttr("name", "id") + _QTAddObjectAttr("tabindex") + _QTAddObjectAttr("hspace") + _QTAddObjectAttr("vspace") + _QTAddObjectAttr("border") + _QTAddObjectAttr("align") + _QTAddObjectAttr("class") + _QTAddObjectAttr("title") + _QTAddObjectAttr("accesskey") + _QTAddObjectAttr("noexternaldata") + ">\n" + _QTAddObjectParam("src", b); 3565 e = " <embed " + _QTAddEmbedAttr("src") + _QTAddEmbedAttr("width") + _QTAddEmbedAttr("height") + _QTAddEmbedAttr("pluginspage") + _QTAddEmbedAttr("name") + _QTAddEmbedAttr("align") + _QTAddEmbedAttr("tabindex"); 3566 _QTDeleteTagAttrs("src", "width", "height", "pluginspage", "classid", "codebase", "name", "tabindex", "hspace", "vspace", "border", "align", "noexternaldata", "class", "title", "accesskey"); 3567 for (d in gTagAttrs) 3568 a = gTagAttrs[d], null != a && (e += _QTAddEmbedAttr(d), c += _QTAddObjectParam(d, b)); 3569 return c + e + "> </embed>\n</object>" 3570 } 3571 3572 function QT_GenerateOBJECTText() { 3573 return _QTGenerate("QT_GenerateOBJECTText", !1, arguments) 3574 }; 3575 (function() { 3576 function e(a) { 3577 a = a || location.href; 3578 return "#" + a.replace(/^[^#]*#?(.*)$/, "$1") 3579 } 3580 var k = document, 3581 b, f = $.event.special, 3582 p = k.documentMode, 3583 m = "oniLightBoxHashChange" in window && (void 0 === p || 7 < p); 3584 $.fn.iLightBoxHashChange = function(a) { 3585 return a ? this.bind("iLightBoxHashChange", a) : this.trigger("iLightBoxHashChange") 3586 }; 3587 $.fn.iLightBoxHashChange.delay = 50; 3588 f.iLightBoxHashChange = $.extend(f.iLightBoxHashChange, { 3589 setup: function() { 3590 if (m) 3591 return !1; 3592 $(b.start) 3593 }, 3594 teardown: function() { 3595 if (m) 3596 return !1; 3597 $(b.stop) 3598 } 3599 }); 3600 b = function() { 3601 function a() { 3602 var c = e(), 3603 d = f(l); 3604 c !== l ? (n(l = c, d), $(window).trigger("iLightBoxHashChange")) : d !== l && (location.href = location.href.replace(/#.*/, "") + d); 3605 g = setTimeout(a, $.fn.iLightBoxHashChange.delay) 3606 } 3607 var h = {}, 3608 g, l = e(), 3609 b = function(c) { 3610 return c 3611 }, 3612 n = b, 3613 f = b; 3614 h.start = function() { 3615 g || a() 3616 }; 3617 h.stop = function() { 3618 g && clearTimeout(g); 3619 g = void 0 3620 }; 3621 browser.msie && !m && function() { 3622 var c, d; 3623 h.start = function() { 3624 c || (d = (d = $.fn.iLightBoxHashChange.src) && d + e(), c = $('<iframe tabindex="-1" title="empty"/>').hide().one("load", function() { 3625 d || n(e()); 3626 a() 3627 }).attr("src", d || "javascript:0").insertAfter("body")[0].contentWindow, k.onpropertychange = function() { 3628 try { 3629 "title" === event.propertyName && (c.document.title = k.title) 3630 } catch (a) {} 3631 }) 3632 }; 3633 h.stop = b; 3634 f = function() { 3635 return e(c.location.href) 3636 }; 3637 n = function(a, d) { 3638 var b = c.document, 3639 e = $.fn.iLightBoxHashChange.domain; 3640 a !== d && (b.title = k.title, b.open(), e && b.write('<script>document.domain="' + e + '"\x3c/script>'), b.close(), c.location.hash = a) 3641 } 3642 }(); 3643 return h 3644 }() 3645 })(); 3646 if (!Array.prototype.filter) { 3647 Array.prototype.filter = function(fun) { 3648 "use strict"; 3649 if (this == null) 3650 throw new TypeError(); 3651 var t = Object(this); 3652 var len = t.length >>> 0; 3653 if (typeof fun != "function") 3654 throw new TypeError(); 3655 var res = []; 3656 var thisp = arguments[1]; 3657 for (var i = 0; i < len; i++) { 3658 if (i in t) { 3659 var val = t[i]; 3660 if (fun.call(thisp, val, i, t)) 3661 res.push(val) 3662 } 3663 } 3664 return res 3665 } 3666 } 3667 if (!Array.prototype.indexOf) { 3668 Array.prototype.indexOf = function(searchElement, fromIndex) { 3669 var k; 3670 if (this == null) { 3671 throw new TypeError('"this" is null or not defined') 3672 } 3673 var O = Object(this); 3674 var len = O.length >>> 0; 3675 if (len === 0) { 3676 return -1 3677 } 3678 var n = +fromIndex || 0; 3679 if (abs(n) === Infinity) { 3680 n = 0 3681 } 3682 if (n >= len) { 3683 return -1 3684 } 3685 k = max(n >= 0 ? n : len - abs(n), 0); 3686 while (k < len) { 3687 var kValue; 3688 if (k in O && O[k] === searchElement) { 3689 return k 3690 } 3691 k++ 3692 } 3693 return -1 3694 } 3695 } 3696 if (!Array.prototype.lastIndexOf) { 3697 Array.prototype.lastIndexOf = function(searchElement) { 3698 "use strict"; 3699 if (this == null) 3700 throw new TypeError(); 3701 var t = Object(this); 3702 var len = t.length >>> 0; 3703 if (len === 0) 3704 return -1; 3705 var n = len; 3706 if (arguments.length > 1) { 3707 n = Number(arguments[1]); 3708 if (n != n) 3709 n = 0; 3710 else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) 3711 n = (n > 0 || -1) * floor(abs(n)) 3712 } 3713 var k = n >= 0 ? min(n, len - 1) : len - abs(n); 3714 for (; k >= 0; k--) { 3715 if (k in t && t[k] === searchElement) 3716 return k 3717 } 3718 return -1 3719 } 3720 } 3721})(jQuery, this);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.