1/* 2 * VenoBox - jQuery Plugin 3 * version: 1.8.6 4 * @requires jQuery >= 1.7.0 5 * 6 * Examples at http://veno.es/venobox/ 7 * License: MIT License 8 * License URI: https://github.com/nicolafranchini/VenoBox/blob/master/LICENSE 9 * Copyright 2013-2019 Nicola Franchini - @nicolafranchini 10 * 11 */ 12 13/* global jQuery */ 14 15(function($){ 16 "use strict"; 17 var autoplay, bgcolor, blocknum, blocktitle, border, core, container, content, dest, extraCss, 18 framewidth, frameheight, gallItems, infinigall, items, keyNavigationDisabled, margine, numeratio, 19 overlayColor, overlay, title, thisgall, thenext, theprev, nextok, prevok, preloader, $preloader, navigation, 20 obj, gallIndex, startouch, vbheader, images, startY, startX, endY, endX, diff, diffX, diffY, threshold; 21 22 $.fn.extend({ 23 //plugin name - venobox 24 venobox: function(options) { 25 var plugin = this; 26 // default options 27 var defaults = { 28 arrowsColor : '#B6B6B6', 29 autoplay : false, // same as data-autoplay - thanks @codibit 30 bgcolor: '#fff', 31 border: '0', 32 closeBackground : '#161617', 33 closeColor : "#d2d2d2", 34 framewidth: '', 35 frameheight: '', 36 gallItems: false, 37 infinigall: false, 38 htmlClose : '×', 39 htmlNext : '<span>Next</span>', 40 htmlPrev : '<span>Prev</span>', 41 numeratio: false, 42 numerationBackground : '#161617', 43 numerationColor : '#d2d2d2', 44 numerationPosition : 'top', // 'top' || 'bottom' 45 overlayClose: true, // disable overlay click-close - thanx @martybalandis 46 overlayColor : 'rgba(23,23,23,0.85)', 47 spinner : 'double-bounce', // available: 'rotating-plane' | 'double-bounce' | 'wave' | 'wandering-cubes' | 'spinner-pulse' | 'chasing-dots' | 'three-bounce' | 'circle' | 'cube-grid' | 'fading-circle' | 'folding-cube' 48 spinColor : '#d2d2d2', 49 titleattr: 'title', // specific attribute to get a title (e.g. [data-title]) - thanx @mendezcode 50 titleBackground: '#161617', 51 titleColor: '#d2d2d2', 52 titlePosition : 'top', // 'top' || 'bottom' 53 cb_pre_open: function(){ return true; }, // Callbacks - thanx @garyee 54 cb_post_open: function(){}, 55 cb_pre_close: function(){ return true; }, 56 cb_post_close: function(){}, 57 cb_post_resize: function(){}, 58 cb_after_nav: function(){}, 59 cb_content_loaded: function(){}, 60 cb_init: function(){} 61 }; 62 63 var option = $.extend(defaults, options); 64 65 // callback plugin initialization 66 option.cb_init(plugin); 67 68 return this.each(function() { 69 70 obj = $(this); 71 72 // Prevent double initialization - thanx @matthistuff 73 if (obj.data('venobox')) { 74 return true; 75 } 76 77 // method to be used outside the plugin 78 plugin.VBclose = function() { 79 closeVbox(); 80 }; 81 obj.addClass('vbox-item'); 82 obj.data('framewidth', option.framewidth); 83 obj.data('frameheight', option.frameheight); 84 obj.data('border', option.border); 85 obj.data('bgcolor', option.bgcolor); 86 obj.data('numeratio', option.numeratio); 87 obj.data('gallItems', option.gallItems); 88 obj.data('infinigall', option.infinigall); 89 obj.data('overlaycolor', option.overlayColor); 90 obj.data('titleattr', option.titleattr); 91 92 obj.data('venobox', true); 93 94 obj.on('click', function(e){ 95 96 e.preventDefault(); 97 obj = $(this); 98 99 // callback plugin initialization 100 var cb_pre_open = option.cb_pre_open(obj); 101 102 if (cb_pre_open === false) { 103 return false;
104 } 105 106 // methods to be used outside the plugin 107 plugin.VBnext = function() { 108 navigateGall(thenext); 109 }; 110 plugin.VBprev = function() { 111 navigateGall(theprev); 112 }; 113 114 overlayColor = obj.data('overlay') || obj.data('overlaycolor'); 115 116 framewidth = obj.data('framewidth'); 117 frameheight = obj.data('frameheight'); 118 // set data-autoplay="true" for vimeo and youtube videos - thanx @zehfernandes 119 autoplay = obj.data('autoplay') || option.autoplay; 120 border = obj.data('border'); 121 bgcolor = obj.data('bgcolor'); 122 nextok = false; 123 prevok = false; 124 keyNavigationDisabled = false; 125 126 // set a different url to be loaded using data-href="" - thanx @pixeline 127 dest = obj.data('href') || obj.attr('href'); 128 extraCss = obj.data( 'css' ) || ''; 129 title = obj.attr(obj.data('titleattr')) || ''; 130 131 preloader = '<div class="vbox-preloader">'; 132 133 switch (option.spinner) { 134 135 case 'rotating-plane': 136 preloader += '<div class="sk-rotating-plane"></div>'; 137 break; 138 case 'double-bounce': 139 preloader += '<div class="sk-double-bounce">'+ 140 '<div class="sk-child sk-double-bounce1"></div>'+ 141 '<div class="sk-child sk-double-bounce2"></div>'+ 142 '</div>'; 143 break; 144 case 'wave': 145 preloader += '<div class="sk-wave">'+ 146 '<div class="sk-rect sk-rect1"></div>'+ 147 '<div class="sk-rect sk-rect2"></div>'+ 148 '<div class="sk-rect sk-rect3"></div>'+ 149 '<div class="sk-rect sk-rect4"></div>'+ 150 '<div class="sk-rect sk-rect5"></div>'+ 151 '</div>'; 152 break; 153 case 'wandering-cubes': 154 preloader += '<div class="sk-wandering-cubes">'+ 155 '<div class="sk-cube sk-cube1"></div>'+ 156 '<div class="sk-cube sk-cube2"></div>'+ 157 '</div>'; 158 break; 159 case 'spinner-pulse': 160 preloader += '<div class="sk-spinner sk-spinner-pulse"></div>'; 161 break; 162 case 'chasing-dots': 163 preloader += '<div class="sk-chasing-dots">'+ 164 '<div class="sk-child sk-dot1"></div>'+ 165 '<div class="sk-child sk-dot2"></div>'+ 166 '</div>'; 167 break; 168 case 'three-bounce': 169 preloader += '<div class="sk-three-bounce">'+ 170 '<div class="sk-child sk-bounce1"></div>'+ 171 '<div class="sk-child sk-bounce2"></div>'+ 172 '<div class="sk-child sk-bounce3"></div>'+ 173 '</div>'; 174 break; 175 case 'circle': 176 preloader += '<div class="sk-circle">'+ 177 '<div class="sk-circle1 sk-child"></div>'+ 178 '<div class="sk-circle2 sk-child"></div>'+ 179 '<div class="sk-circle3 sk-child"></div>'+ 180 '<div class="sk-circle4 sk-child"></div>'+ 181 '<div class="sk-circle5 sk-child"></div>'+ 182 '<div class="sk-circle6 sk-child"></div>'+ 183 '<div class="sk-circle7 sk-child"></div>'+ 184 '<div class="sk-circle8 sk-child"></div>'+ 185 '<div class="sk-circle9 sk-child"></div>'+ 186 '<div class="sk-circle10 sk-child"></div>'+ 187 '<div class="sk-circle11 sk-child"></div>'+ 188 '<div class="sk-circle12 sk-child"></div>'+ 189 '</div>'; 190 break; 191 case 'cube-grid': 192 preloader += '<div class="sk-cube-grid">'+ 193 '<div class="sk-cube sk-cube1"></div>'+ 194 '<div class="sk-cube sk-cube2"></div>'+ 195 '<div class="sk-cube sk-cube3"></div>'+ 196 '<div class="sk-cube sk-cube4"></div>'+ 197 '<div class="sk-cube sk-cube5"></div>'+ 198 '<div class="sk-cube sk-cube6"></div>'+ 199 '<div class="sk-cube sk-cube7"></div>'+ 200 '<div class="sk-cube sk-cube8"></div>'+ 201 '<div class="sk-cube sk-cube9"></div>'+ 202 '</div>'; 203 break; 204 case 'fading-circle': 205 preloader += '<div class="sk-fading-circle">'+ 206 '<div class="sk-circle1 sk-circle"></div>'+ 207 '<div class="sk-circle2 sk-circle"></div>'+ 208 '<div class="sk-circle3 sk-circle"></div>'+ 209 '<div class="sk-circle4 sk-circle"></div>'+ 210 '<div class="sk-circle5 sk-circle"></div>'+ 211 '<div class="sk-circle6 sk-circle"></div>'+ 212 '<div class="sk-circle7 sk-circle"></div>'+ 213 '<div class="sk-circle8 sk-circle"></div>'+ 214 '<div class="sk-circle9 sk-circle"></div>'+ 215 '<div class="sk-circle10 sk-circle"></div>'+ 216 '<div class="sk-circle11 sk-circle"></div>'+ 217 '<div class="sk-circle12 sk-circle"></div>'+ 218 '</div>'; 219 break; 220 case 'folding-cube': 221 preloader += '<div class="sk-folding-cube">'+ 222 '<div class="sk-cube1 sk-cube"></div>'+ 223 '<div class="sk-cube2 sk-cube"></div>'+ 224 '<div class="sk-cube4 sk-cube"></div>'+ 225 '<div class="sk-cube3 sk-cube"></div>'+ 226 '</div>'; 227 break; 228 } 229 preloader += '</div>'; 230 231 navigation = '<a class="vbox-next">' + option.htmlNext + '</a><a class="vbox-prev">' + option.htmlPrev + '</a>'; 232 vbheader = '<div class="vbox-title"></div><div class="vbox-num">0/0</div><div class="vbox-close">' + option.htmlClose + '</div>'; 233 234 core = '<div class="vbox-overlay ' + extraCss + '" style="background:'+ overlayColor +'">'+ 235 preloader + '<div class="vbox-container"><div class="vbox-content"></div></div>' + vbheader + navigation + '</div>'; 236 237 $('body').append(core).addClass('vbox-open'); 238 239 $('.vbox-preloader div:not(.sk-circle) .sk-child, .vbox-preloader .sk-rotating-plane, .vbox-preloader .sk-rect, .vbox-preloader div:not(.sk-folding-cube) .sk-cube, .vbox-preloader .sk-spinner-pulse').css('background-color', option.spinColor); 240
241 overlay = $('.vbox-overlay'); 242 container = $('.vbox-container'); 243 content = $('.vbox-content'); 244 blocknum = $('.vbox-num'); 245 blocktitle = $('.vbox-title'); 246 $preloader = $('.vbox-preloader'); 247 248 $preloader.show(); 249 250 blocktitle.css(option.titlePosition, '-1px'); 251 blocktitle.css({ 252 'color' : option.titleColor, 253 'background-color' : option.titleBackground 254 }); 255 256 $('.vbox-close').css({ 257 'color' : option.closeColor, 258 'background-color' : option.closeBackground 259 }); 260 261 $('.vbox-num').css(option.numerationPosition, '-1px'); 262 $('.vbox-num').css({ 263 'color' : option.numerationColor, 264 'background-color' : option.numerationBackground 265 }); 266 267 $('.vbox-next span, .vbox-prev span').css({ 268 'border-top-color' : option.arrowsColor, 269 'border-right-color' : option.arrowsColor 270 }); 271 272 content.html(''); 273 content.css('opacity', '0'); 274 overlay.css('opacity', '0'); 275 276 checknav(); 277 278 // fade in overlay 279 overlay.animate({opacity:1}, 250, function(){ 280 281 if (obj.data('vbtype') == 'iframe') { 282 loadIframe(); 283 } else if (obj.data('vbtype') == 'inline') { 284 loadInline(); 285 } else if (obj.data('vbtype') == 'ajax') { 286 loadAjax(); 287 } else if (obj.data('vbtype') == 'video') { 288 loadVid(autoplay); 289 } else { 290 content.html('<img src="'+dest+'">'); 291 preloadFirst(); 292 } 293 option.cb_post_open(obj, gallIndex, thenext, theprev); 294 }); 295 296 /* -------- KEYBOARD ACTIONS -------- */ 297 $('body').keydown(keyboardHandler); 298 299 /* -------- PREVGALL -------- */ 300 $('.vbox-prev').on('click', function(){
301 navigateGall(theprev); 302 }); 303 /* -------- NEXTGALL -------- */ 304 $('.vbox-next').on('click', function(){ 305 navigateGall(thenext); 306 }); 307 308 return false; 309 310 }); // click 311 312 /* -------- CHECK NEXT / PREV -------- */ 313 function checknav(){ 314 315 thisgall = obj.data('gall'); 316 numeratio = obj.data('numeratio'); 317 gallItems = obj.data('gallItems'); 318 infinigall = obj.data('infinigall'); 319 320 if (gallItems) { 321 items = gallItems; 322 } else { 323 items = $('.vbox-item[data-gall="' + thisgall + '"]'); 324 } 325 326 thenext = items.eq( items.index(obj) + 1 ); 327 theprev = items.eq( items.index(obj) - 1 ); 328 329 if (!thenext.length && infinigall === true) { 330 thenext = items.eq(0); 331 } 332 333 // update gall numeration 334 if (items.length >= 1) { 335 gallIndex = items.index(obj)+1; 336 blocknum.html(gallIndex + ' / ' + items.length); 337 } else { 338 gallIndex = 1; 339 } 340 if (numeratio === true) { 341 blocknum.show(); 342 } else { 343 blocknum.hide(); 344 } 345 346 // update title 347 if (title !== '') { 348 blocktitle.show(); 349 } else { 350 blocktitle.hide(); 351 } 352 353 // update navigation arrows 354 if (!thenext.length && infinigall !== true) { 355 $('.vbox-next').css('display', 'none'); 356 nextok = false; 357 } else { 358 $('.vbox-next').css('display', 'block'); 359 nextok = true; 360 } 361 362 if (items.index(obj) > 0 || infinigall === true) { 363 $('.vbox-prev').css('display', 'block'); 364 prevok = true; 365 } else { 366 $('.vbox-prev').css('display', 'none'); 367 prevok = false; 368 } 369 // activate swipe 370 if (prevok === true || nextok === true) { 371 content.on(TouchMouseEvent.DOWN, onDownEvent); 372 content.on(TouchMouseEvent.MOVE, onMoveEvent); 373 content.on(TouchMouseEvent.UP, onUpEvent); 374 } 375 } 376 377 /* -------- gallery navigation -------- */
378 function navigateGall(destination) { 379 380 if (destination.length < 1) { 381 return false; 382 } 383 if (keyNavigationDisabled) { 384 return false; 385 } 386 keyNavigationDisabled = true; 387 388 overlayColor = destination.data('overlay') || destination.data('overlaycolor'); 389 390 framewidth = destination.data('framewidth'); 391 frameheight = destination.data('frameheight'); 392 border = destination.data('border'); 393 bgcolor = destination.data('bgcolor'); 394 dest = destination.data('href') || destination.attr('href'); 395 396 autoplay = destination.data('autoplay'); 397 398 title = (destination.data('titleattr') && destination.attr(destination.data('titleattr'))) || ''; 399 400 // swipe out item 401 if (destination === theprev) { 402 content.addClass('vbox-animated').addClass('swipe-right'); 403 } 404 if (destination === thenext) { 405 content.addClass('vbox-animated').addClass('swipe-left'); 406 } 407 408 $preloader.show(); 409 410 content.animate({ 411 opacity : 0, 412 }, 500, function(){ 413 414 overlay.css('background',overlayColor); 415 416 content 417 .removeClass('vbox-animated') 418 .removeClass('swipe-left') 419 .removeClass('swipe-right') 420 .css({'margin-left': 0,'margin-right': 0}); 421 422 if (destination.data('vbtype') == 'iframe') { 423 loadIframe(); 424 } else if (destination.data('vbtype') == 'inline') { 425 loadInline(); 426 } else if (destination.data('vbtype') == 'ajax') { 427 loadAjax(); 428 } else if (destination.data('vbtype') == 'video') { 429 loadVid(autoplay); 430 } else { 431 content.html('<img src="'+dest+'">'); 432 preloadFirst(); 433 } 434 obj = destination; 435 checknav(); 436 keyNavigationDisabled = false; 437 option.cb_after_nav(obj, gallIndex, thenext, theprev); 438 }); 439 } 440 441 /* -------- KEYBOARD HANDLER -------- */ 442 function keyboardHandler(e) { 443 if (e.keyCode === 27) { // esc 444 closeVbox(); 445 } 446 447 if (e.keyCode == 37 && prevok === true) { // left
448 navigateGall(theprev); 449 } 450 451 if (e.keyCode == 39 && nextok === true) { // right 452 navigateGall(thenext); 453 } 454 } 455 456 /* -------- CLOSE VBOX -------- */ 457 function closeVbox(){ 458 459 var cb_pre_close = option.cb_pre_close(obj, gallIndex, thenext, theprev); 460 461 if (cb_pre_close === false) { 462 return false; 463 } 464 465 $('body').off('keydown', keyboardHandler).removeClass('vbox-open'); 466 467 obj.focus(); 468 469 overlay.animate({opacity:0}, 500, function(){ 470 overlay.remove(); 471 keyNavigationDisabled = false; 472 option.cb_post_close(); 473 }); 474 } 475 476 /* -------- CLOSE CLICK -------- */ 477 var closeclickclass = '.vbox-overlay'; 478 if(!option.overlayClose){ 479 closeclickclass = '.vbox-close'; // close only on X 480 } 481 482 $('body').on('click touchstart', closeclickclass, function(e){ 483 if ($(e.target).is('.vbox-overlay') || 484 $(e.target).is('.vbox-content') || 485 $(e.target).is('.vbox-close') || 486 $(e.target).is('.vbox-preloader') || 487 $(e.target).is('.vbox-container') 488 ) { 489 closeVbox(); 490 } 491 }); 492 493 startX = 0; 494 endX = 0; 495 496 diff = 0; 497 threshold = 50; 498 startouch = false; 499 500 function onDownEvent(e){ 501 content.addClass('vbox-animated'); 502 startY = endY = e.pageY; 503 startX = endX = e.pageX; 504 startouch = true; 505 } 506 507 function onMoveEvent(e){ 508 if (startouch === true) { 509 endX = e.pageX; 510 endY = e.pageY; 511 512 diffX = endX - startX; 513 diffY = endY - startY; 514 515 var absdiffX = Math.abs(diffX); 516 var absdiffY = Math.abs(diffY); 517 518 if ((absdiffX > absdiffY) && (absdiffX <= 100)) { 519 e.preventDefault(); 520 content.css('margin-left', diffX); 521 } 522 } 523 } 524 525 function onUpEvent(e){ 526 if (startouch === true) { 527 startouch = false; 528 var subject = obj; 529 var change = false; 530 diff = endX - startX; 531 532 if (diff < 0 && nextok === true) { 533 subject = thenext; 534 change = true; 535 } 536 if (diff > 0 && prevok === true) { 537 subject = theprev; 538 change = true; 539 } 540 541 if (Math.abs(diff) >= threshold && change === true) {
542 navigateGall(subject); 543 } else { 544 content.css({'margin-left': 0,'margin-right': 0}); 545 } 546 } 547 } 548 549 /* == GLOBAL DECLERATIONS == */ 550 var TouchMouseEvent = { 551 DOWN: "touchmousedown", 552 UP: "touchmouseup", 553 MOVE: "touchmousemove" 554 }; 555 556 /* == EVENT LISTENERS == */ 557 var onMouseEvent = function(event) { 558 var type; 559 switch (event.type) { 560 case "mousedown": type = TouchMouseEvent.DOWN; break; 561 case "mouseup": type = TouchMouseEvent.UP; break; 562 case "mouseout": type = TouchMouseEvent.UP; break; 563 case "mousemove": type = TouchMouseEvent.MOVE; break; 564 default: 565 return; 566 } 567 var touchMouseEvent = normalizeEvent(type, event, event.pageX, event.pageY); 568 $(event.target).trigger(touchMouseEvent); 569 }; 570 571 var onTouchEvent = function(event) { 572 var type; 573 switch (event.type) { 574 case "touchstart": type = TouchMouseEvent.DOWN; break; 575 case "touchend": type = TouchMouseEvent.UP; break; 576 case "touchmove": type = TouchMouseEvent.MOVE; break; 577 default: 578 return; 579 } 580 581 var touch = event.originalEvent.touches[0]; 582 var touchMouseEvent; 583 584 if (type == TouchMouseEvent.UP) { 585 touchMouseEvent = normalizeEvent(type, event, null, null); 586 } else { 587 touchMouseEvent = normalizeEvent(type, event, touch.pageX, touch.pageY); 588 } 589 $(event.target).trigger(touchMouseEvent); 590 }; 591 592 /* == NORMALIZE == */ 593 var normalizeEvent = function(type, original, x, y) { 594 return $.Event(type, { 595 pageX: x, 596 pageY: y, 597 originalEvent: original 598 }); 599 }; 600 601 /* == LISTEN TO ORIGINAL EVENT == */ 602 if ("ontouchstart" in window) { 603 $(document).on("touchstart", onTouchEvent); 604 $(document).on("touchmove", onTouchEvent); 605 $(document).on("touchend", onTouchEvent); 606 } else { 607 $(document).on("mousedown", onMouseEvent); 608 $(document).on("mouseup", onMouseEvent); 609 $(document).on("mouseout", onMouseEvent); 610 $(document).on("mousemove", onMouseEvent); 611 } 612 613 /* -------- LOAD AJAX -------- */ 614 function loadAjax(){ 615 $.ajax({ 616 url: dest, 617 cache: false 618 }).done(function( msg ) { 619 content.html('<div class="vbox-inline">'+ msg +'</div>'); 620 preloadFirst(); 621 622 }).fail(function() { 623 content.html('<div class="vbox-inline"><p>Error retrieving contents, please retry</div>'); 624 updateoverlay(); 625 }); 626 } 627 628 /* -------- LOAD IFRAME -------- */ 629 function loadIframe(){ 630 content.html('<iframe class="venoframe" src="'+dest+'"></iframe>'); 631 // $('.venoframe').load(function(){ // valid only for iFrames in same domain 632 updateoverlay(); 633 // }); 634 } 635 636 /* -------- LOAD VIDEOs -------- */ 637 function loadVid(autoplay){ 638 639 var player; 640 var videoObj = parseVideo(dest); 641 642 // set rel=0 to hide related videos at the end of YT + optional autoplay 643 var stringAutoplay = autoplay ? "?rel=0&autoplay=1" : "?rel=0"; 644 var queryvars = stringAutoplay + getUrlParameter(dest); 645 646 if (videoObj.type == 'vimeo') { 647 player = 'https://player.vimeo.com/video/'; 648 } else if (videoObj.type == 'youtube') { 649 player = 'https://www.youtube.com/embed/'; 650 } 651 content.html('<iframe class="venoframe vbvid" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="autoplay" frameborder="0" src="'+player+videoObj.id+queryvars+'"></iframe>'); 652 updateoverlay(); 653 } 654 655 /** 656 * Parse Youtube or Vimeo videos and get host & ID 657 */ 658 function parseVideo (url) { 659 url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); 660 var type; 661 if (RegExp.$3.indexOf('youtu') > -1) { 662 type = 'youtube'; 663 } else if (RegExp.$3.indexOf('vimeo') > -1) { 664 type = 'vimeo'; 665 } 666 return { 667 type: type, 668 id: RegExp.$6 669 }; 670 } 671 672 /** 673 * get additional video url parameters 674 */ 675 function getUrlParameter(name) { 676 var result = ''; 677 var sPageURL = decodeURIComponent(name); 678 var firstsplit = sPageURL.split('?'); 679 680 if (firstsplit[1] !== undefined) { 681 var sURLVariables = firstsplit[1].split('&'); 682 var sParameterName; 683 var i; 684 for (i = 0; i < sURLVariables.length; i++) { 685 sParameterName = sURLVariables[i].split('='); 686 result = result + '&'+ sParameterName[0]+'='+ sParameterName[1]; 687 } 688 } 689 return encodeURI(result); 690 } 691 692 /* -------- LOAD INLINE -------- */ 693 function loadInline(){ 694 content.html('<div class="vbox-inline">'+$(dest).html()+'</div>'); 695 updateoverlay(); 696 } 697 698 /* -------- PRELOAD IMAGE -------- */ 699 function preloadFirst(){ 700 images = content.find('img'); 701 702 if (images.length) { 703 images.each(function(){ 704 $(this).one('load', function() { 705 updateoverlay(); 706 }); 707 }); 708 } else { 709 updateoverlay(); 710 } 711 } 712 713 /* -------- FADE-IN THE NEW CONTENT -------- */ 714 function updateoverlay(){ 715 716 blocktitle.html(title); 717 718 content.find(">:first-child").addClass('vbox-figlio').css({ 719 'width': framewidth, 720 'height': frameheight, 721 'padding': border, 722 'background': bgcolor 723 }); 724 725 $('img.vbox-figlio').on('dragstart', function(event) { 726 event.preventDefault(); 727 }); 728 729 updateOL(); 730 731 content.animate({ 732 'opacity': '1' 733 },'slow', function(){ 734 $preloader.hide(); 735 }); 736 option.cb_content_loaded(obj, gallIndex, thenext, theprev); 737 } 738 739 /* -------- CENTER FRAME -------- */ 740 function updateOL(){ 741 742 var sonH = content.outerHeight(); 743 var finH = $(window).height(); 744 745 if (sonH + 60 < finH) { 746 margine = (finH - sonH)/2; 747 } else { 748 margine = '30px'; 749 } 750 content.css('margin-top', margine); 751 content.css('margin-bottom', margine); 752 option.cb_post_resize(); 753 } 754 755 $(window).resize(function(){ 756 if($('.vbox-content').length){ 757 setTimeout(updateOL(), 800); 758 } 759 }); 760 }); // each 761 } // venobox 762 }); // extend 763})(jQuery);
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.