1/*global jQuery:false */ 2/* notre test */ 3jQuery(document).ready(function($) { 4"use strict"; 5 6 7 //add some elements with animate effect 8 9 $(".big-cta").hover( 10 function () { 11 $('.cta a').addClass("animated shake"); 12 }, 13 function () { 14 $('.cta a').removeClass("animated shake"); 15 } 16 ); 17 $(".box").hover( 18 function () { 19 $(this).find('.icon').addClass("animated fadeInDown"); 20 $(this).find('p').addClass("animated fadeInUp"); 21 }, 22 function () { 23 $(this).find('.icon').removeClass("animated fadeInDown"); 24 $(this).find('p').removeClass("animated fadeInUp"); 25 } 26 ); 27 28 29 $('.accordion').on('show', function (e) { 30 31 $(e.target).prev('.accordion-heading').find('.accordion-toggle').addClass('active'); 32 $(e.target).prev('.accordion-heading').find('.accordion-toggle i').removeClass('icon-plus'); 33 $(e.target).prev('.accordion-heading').find('.accordion-toggle i').addClass('icon-minus'); 34 }); 35 36 $('.accordion').on('hide', function (e) { 37 $(this).find('.accordion-toggle').not($(e.target)).removeClass('active'); 38 $(this).find('.accordion-toggle i').not($(e.target)).removeClass('icon-minus'); 39 $(this).find('.accordion-toggle i').not($(e.target)).addClass('icon-plus'); 40 }); 41 42 43 //register/login form 44$(function () { 45 $('.button-checkbox').each(function () { 46 47 // Settings 48 var $widget = $(this), 49 $button = $widget.find('button'), 50 $checkbox = $widget.find('input:checkbox'), 51 color = $button.data('color'), 52 settings = { 53 on: { 54 icon: 'glyphicon glyphicon-check' 55 }, 56 off: { 57 icon: 'glyphicon glyphicon-unchecked' 58 } 59 }; 60 61 // Event Handlers 62 $button.on('click', function () { 63 $checkbox.prop('checked', !$checkbox.is(':checked')); 64 $checkbox.triggerHandler('change'); 65 updateDisplay(); 66 }); 67 $checkbox.on('change', function () { 68 updateDisplay(); 69 }); 70 71 // Actions 72 function updateDisplay() { 73 var isChecked = $checkbox.is(':checked'); 74 75 // Set the button's state 76 $button.data('state', (isChecked) ? "on" : "off"); 77 78 // Set the button's icon 79 $button.find('.state-icon') 80 .removeClass() 81 .addClass('state-icon ' + settings[$button.data('state')].icon); 82 83 // Update the button's color 84 if (isChecked) { 85 $button 86 .removeClass('btn-default') 87 .addClass('btn-' + color + ' active'); 88 } 89 else { 90 $button 91 .removeClass('btn-' + color + ' active') 92 .addClass('btn-default'); 93 } 94 } 95 96 // Initialization 97 function init() { 98 99 updateDisplay(); 100 101 // Inject the icon if applicable 102 if ($button.find('.state-icon').length == 0) { 103 $button.prepend('<i class="state-icon ' + settings[$button.data('state')].icon + '"></i> '); 104 } 105 } 106 init(); 107 }); 108}); 109 110 111 // tooltip 112 $('.social-network li a, .options_box .color a').tooltip(); 113 114 115 //stats 116 jQuery('.appear').appear(); 117 var runOnce = true; 118 jQuery(".stats").on("appear", function(data) { 119 var counters = {}; 120 var i = 0; 121 if (runOnce){ 122 jQuery('.number').each(function(){ 123 counters[this.id] = $(this).html(); 124 i++; 125 }); 126 jQuery.each( counters, function( i, val ) { 127 //console.log(i + ' - ' +val); 128 jQuery({countNum: 0}).animate({countNum: val}, { 129 duration: 3000, 130 easing:'linear', 131 step: function() { 132 jQuery('#'+i).text(Math.floor(this.countNum)); 133 } 134 }); 135 }); 136 runOnce = false; 137 } 138 }); 139 140 //parallax 141 if ($('.parallax').length) 142 { 143 $(window).stellar({ 144 responsive:true, 145 scrollProperty: 'scroll', 146 parallaxElements: false, 147 horizontalScrolling: false, 148 horizontalOffset: 0, 149 verticalOffset: 0 150 }); 151 152 } 153 154 155 156 //scroll to top 157 $(window).scroll(function(){ 158 if ($(this).scrollTop() > 100) { 159 $('.scrollup').fadeIn(); 160 } else { 161 $('.scrollup').fadeOut(); 162 } 163 }); 164 $('.scrollup').click(function(){ 165 $("html, body").animate({ scrollTop: 0 }, 1500, 'easeInSine'); 166 return false; 167 }); 168 169 170 //search 171 new UISearch( document.getElementById( 'sb-search' ) ); 172 173 174 175 176 177}); 178//cube portfolio 179 var gridContainer = jQuery('#grid-container'), 180 filtersContainer = jQuery('#filters-container'); 181 182 // init cubeportfolio 183 gridContainer.cubeportfolio({ 184 185 defaultFilter: '*', 186 187 animationType: 'flipOutDelay', 188 189 gapHorizontal: 45, 190 191 gapVertical: 30, 192 193 gridAdjustment: 'responsive', 194 195 caption: 'overlayBottomReveal', 196 197 displayType: 'lazyLoading', 198 199 displayTypeSpeed: 100, 200 201 // lightbox 202 lightboxDelegate: '.cbp-lightbox', 203 lightboxGallery: true, 204 lightboxTitleSrc: 'data-title', 205 lightboxShowCounter: true 206 207 }); 208 209 // add listener for filters click 210 filtersContainer.on('click', '.cbp-filter-item', function (e) { 211 212 var me = jQuery(this), wrap; 213 214 // get cubeportfolio data and check if is still animating (reposition) the items. 215 if ( !$.data(gridContainer[0], 'cubeportfolio').isAnimating ) { 216 217 if ( filtersContainer.hasClass('cbp-l-filters-dropdown') ) { 218 wrap = $('.cbp-l-filters-dropdownWrap'); 219 220 wrap.find('.cbp-filter-item').removeClass('cbp-filter-item-active'); 221 222 wrap.find('.cbp-l-filters-dropdownHeader').text(me.text()); 223 224 me.addClass('cbp-filter-item-active'); 225 } else { 226 me.addClass('cbp-filter-item-active').siblings().removeClass('cbp-filter-item-active'); 227 } 228 229 } 230 231 // filter the items 232 gridContainer.cubeportfolio('filter', me.data('filter'), function () {}); 233 234 });
vendor: 40,169 bytes, lines 235-1372
235 236 // activate counters 237 gridContainer.cubeportfolio('showCounter', filtersContainer.find('.cbp-filter-item')); 238 239/*! Magnific Popup - v1.1.0 - 2016-02-20 240 * http://dimsemenov.com/plugins/magnific-popup/ 241 * Copyright (c) 2016 Dmitry Semenov; */ 242(function (factory) { 243 if (typeof define === 'function' && define.amd) { 244 // AMD. Register as an anonymous module. 245 define(['jquery'], factory); 246 } else if (typeof exports === 'object') { 247 // Node/CommonJS 248 factory(require('jquery')); 249 } else { 250 // Browser globals 251 factory(window.jQuery || window.Zepto); 252 } 253}( 254 function ($) { 255 256 /*>>core*/ 257 /** 258 * 259 * Magnific Popup Core JS file 260 * 261 */ 262 263 264 265 /** 266 * Private static constants 267 */ 268 var CLOSE_EVENT = 'Close', 269 BEFORE_CLOSE_EVENT = 'BeforeClose', 270 AFTER_CLOSE_EVENT = 'AfterClose', 271 BEFORE_APPEND_EVENT = 'BeforeAppend', 272 MARKUP_PARSE_EVENT = 'MarkupParse', 273 OPEN_EVENT = 'Open', 274 CHANGE_EVENT = 'Change', 275 NS = 'mfp', 276 EVENT_NS = '.' + NS, 277 READY_CLASS = 'mfp-ready', 278 REMOVING_CLASS = 'mfp-removing', 279 PREVENT_CLOSE_CLASS = 'mfp-prevent-close'; 280 281 282 /** 283 * Private vars 284 */ 285 /*jshint -W079 */ 286 var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this' 287 MagnificPopup = function () { 288 }, 289 _isJQ = !!(window.jQuery), 290 _prevStatus, 291 _window = $(window), 292 _document, 293 _prevContentType, 294 _wrapClasses, 295 _currPopupType; 296 297 298 /** 299 * Private functions 300 */ 301 var _mfpOn = function (name, f) { 302 mfp.ev.on(NS + name + EVENT_NS, f); 303 }, 304 _getEl = function (className, appendTo, html, raw) { 305 var el = document.createElement('div'); 306 el.className = 'mfp-' + className; 307 if (html) { 308 el.innerHTML = html; 309 } 310 if (!raw) { 311 el = $(el); 312 if (appendTo) { 313 el.appendTo(appendTo); 314 } 315 } else if (appendTo) { 316 appendTo.appendChild(el); 317 } 318 return el; 319 }, 320 _mfpTrigger = function (e, data) { 321 mfp.ev.triggerHandler(NS + e, data); 322 323 if (mfp.st.callbacks) { 324 // converts "mfpEventName" to "eventName" callback and triggers it if it's present 325 e = e.charAt(0).toLowerCase() + e.slice(1); 326 if (mfp.st.callbacks[e]) { 327 mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]); 328 } 329 } 330 }, 331 _getCloseBtn = function (type) { 332 if (type !== _currPopupType || !mfp.currTemplate.closeBtn) { 333 mfp.currTemplate.closeBtn = $(mfp.st.closeMarkup.replace('%title%', mfp.st.tClose)); 334 _currPopupType = type; 335 } 336 return mfp.currTemplate.closeBtn; 337 }, 338 // Initialize Magnific Popup only when called at least once 339 _checkInstance = function () { 340 if (!$.magnificPopup.instance) { 341 /*jshint -W020 */ 342 mfp = new MagnificPopup(); 343 mfp.init(); 344 $.magnificPopup.instance = mfp; 345 } 346 }, 347 // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr 348 supportsTransitions = function () { 349 var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist 350 v = ['ms', 'O', 'Moz', 'Webkit']; // 'v' for vendor 351 352 if (s['transition'] !== undefined) { 353 return true; 354 } 355 356 while (v.length) { 357 if (v.pop() + 'Transition' in s) { 358 return true; 359 } 360 } 361 362 return false; 363 }; 364 365 366 /** 367 * Public functions 368 */ 369 MagnificPopup.prototype = { 370 371 constructor: MagnificPopup, 372 373 /** 374 * Initializes Magnific Popup plugin. 375 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed 376 */ 377 init: function () { 378 var appVersion = navigator.appVersion; 379 mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener; 380 mfp.isAndroid = (/android/gi).test(appVersion); 381 mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion); 382 mfp.supportsTransition = supportsTransitions(); 383 384 // We disable fixed positioned lightbox on devices that don't handle it nicely. 385 // If you know a better way of detecting this - let me know. 386 mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent)); 387 _document = $(document); 388 389 mfp.popupsCache = {}; 390 }, 391 392 /** 393 * Opens popup 394 * @param data [description] 395 */ 396 open: function (data) { 397 398 var i; 399 400 if (data.isObj === false) { 401 // convert jQuery collection to array to avoid conflicts later 402 mfp.items = data.items.toArray(); 403 404 mfp.index = 0; 405 var items = data.items, 406 item; 407 for (i = 0; i < items.length; i++) { 408 item = items[i]; 409 if (item.parsed) { 410 item = item.el[0]; 411 } 412 if (item === data.el[0]) { 413 mfp.index = i; 414 break; 415 } 416 } 417 } else { 418 mfp.items = $.isArray(data.items) ? data.items : [data.items]; 419 mfp.index = data.index || 0; 420 } 421 422 // if popup is already opened - we just update the content 423 if (mfp.isOpen) { 424 mfp.updateItemHTML(); 425 return; 426 } 427 428 mfp.types = []; 429 _wrapClasses = ''; 430 if (data.mainEl && data.mainEl.length) { 431 mfp.ev = data.mainEl.eq(0); 432 } else { 433 mfp.ev = _document; 434 } 435 436 if (data.key) { 437 if (!mfp.popupsCache[data.key]) { 438 mfp.popupsCache[data.key] = {}; 439 } 440 mfp.currTemplate = mfp.popupsCache[data.key]; 441 } else { 442 mfp.currTemplate = {}; 443 } 444 445 446 mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data); 447 mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos; 448 449 if (mfp.st.modal) { 450 mfp.st.closeOnContentClick = false; 451 mfp.st.closeOnBgClick = false; 452 mfp.st.showCloseBtn = false; 453 mfp.st.enableEscapeKey = false; 454 } 455 456 457 // Building markup 458 // main containers are created only once 459 if (!mfp.bgOverlay) { 460 461 // Dark overlay 462 mfp.bgOverlay = _getEl('bg').on('click' + EVENT_NS, function () { 463 mfp.close(); 464 }); 465 466 mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click' + EVENT_NS, function (e) { 467 if (mfp._checkIfClose(e.target)) { 468 mfp.close(); 469 } 470 }); 471 472 mfp.container = _getEl('container', mfp.wrap); 473 } 474 475 mfp.contentContainer = _getEl('content'); 476 if (mfp.st.preloader) { 477 mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading); 478 } 479 480 481 // Initializing modules 482 var modules = $.magnificPopup.modules; 483 for (i = 0; i < modules.length; i++) { 484 var n = modules[i]; 485 n = n.charAt(0).toUpperCase() + n.slice(1); 486 mfp['init' + n].call(mfp); 487 } 488 _mfpTrigger('BeforeOpen'); 489 490 491 if (mfp.st.showCloseBtn) { 492 // Close button 493 if (!mfp.st.closeBtnInside) { 494 mfp.wrap.append(_getCloseBtn()); 495 } else { 496 _mfpOn(MARKUP_PARSE_EVENT, function (e, template, values, item) { 497 values.close_replaceWith = _getCloseBtn(item.type); 498 }); 499 _wrapClasses += ' mfp-close-btn-in'; 500 } 501 } 502 503 if (mfp.st.alignTop) { 504 _wrapClasses += ' mfp-align-top'; 505 } 506 507 508 if (mfp.fixedContentPos) { 509 mfp.wrap.css({ 510 overflow: mfp.st.overflowY, 511 overflowX: 'hidden', 512 overflowY: mfp.st.overflowY 513 }); 514 } else { 515 mfp.wrap.css({ 516 top: _window.scrollTop(), 517 position: 'absolute' 518 }); 519 } 520 if (mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos)) { 521 mfp.bgOverlay.css({ 522 height: _document.height(), 523 position: 'absolute' 524 }); 525 } 526 527 528 if (mfp.st.enableEscapeKey) { 529 // Close on ESC key 530 _document.on('keyup' + EVENT_NS, function (e) { 531 if (e.keyCode === 27) { 532 mfp.close(); 533 } 534 }); 535 } 536 537 _window.on('resize' + EVENT_NS, function () { 538 mfp.updateSize(); 539 }); 540 541 542 if (!mfp.st.closeOnContentClick) { 543 _wrapClasses += ' mfp-auto-cursor'; 544 } 545 546 if (_wrapClasses) 547 mfp.wrap.addClass(_wrapClasses); 548 549 550 // this triggers recalculation of layout, so we get it once to not to trigger twice 551 var windowHeight = mfp.wH = _window.height(); 552 553 554 var windowStyles = {}; 555 556 if (mfp.fixedContentPos) { 557 if (mfp._hasScrollBar(windowHeight)) { 558 var s = mfp._getScrollbarSize(); 559 if (s) { 560 windowStyles.marginRight = s; 561 } 562 } 563 } 564 565 if (mfp.fixedContentPos) { 566 if (!mfp.isIE7) { 567 windowStyles.overflow = 'hidden'; 568 } else { 569 // ie7 double-scroll bug 570 $('body, html').css('overflow', 'hidden'); 571 } 572 } 573 574 575 var classesToadd = mfp.st.mainClass; 576 if (mfp.isIE7) { 577 classesToadd += ' mfp-ie7'; 578 } 579 if (classesToadd) { 580 mfp._addClassToMFP(classesToadd); 581 } 582 583 // add content 584 mfp.updateItemHTML(); 585 586 _mfpTrigger('BuildControls'); 587 588 // remove scrollbar, add margin e.t.c 589 $('html').css(windowStyles); 590 591 // add everything to DOM 592 mfp.bgOverlay.add(mfp.wrap).prependTo(mfp.st.prependTo || $(document.body)); 593 594 // Save last focused element 595 mfp._lastFocusedEl = document.activeElement; 596 597 // Wait for next cycle to allow CSS transition 598 setTimeout(function () { 599 600 if (mfp.content) { 601 mfp._addClassToMFP(READY_CLASS); 602 mfp._setFocus(); 603 } else { 604 // if content is not defined (not loaded e.t.c) we add class only for BG 605 mfp.bgOverlay.addClass(READY_CLASS); 606 } 607 608 // Trap the focus in popup 609 _document.on('focusin' + EVENT_NS, mfp._onFocusIn); 610 611 }, 16); 612 613 mfp.isOpen = true; 614 mfp.updateSize(windowHeight); 615 _mfpTrigger(OPEN_EVENT); 616 617 return data; 618 }, 619 620 /** 621 * Closes the popup 622 */ 623 close: function () { 624 if (!mfp.isOpen) return; 625 _mfpTrigger(BEFORE_CLOSE_EVENT); 626 627 mfp.isOpen = false; 628 // for CSS3 animation 629 if (mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition) { 630 mfp._addClassToMFP(REMOVING_CLASS); 631 setTimeout(function () { 632 mfp._close(); 633 }, mfp.st.removalDelay); 634 } else { 635 mfp._close(); 636 } 637 }, 638 639 /** 640 * Helper for close() function 641 */ 642 _close: function () { 643 _mfpTrigger(CLOSE_EVENT); 644 645 var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' '; 646 647 mfp.bgOverlay.detach(); 648 mfp.wrap.detach(); 649 mfp.container.empty(); 650 651 if (mfp.st.mainClass) { 652 classesToRemove += mfp.st.mainClass + ' '; 653 } 654 655 mfp._removeClassFromMFP(classesToRemove); 656 657 if (mfp.fixedContentPos) { 658 var windowStyles = {marginRight: ''}; 659 if (mfp.isIE7) { 660 $('body, html').css('overflow', ''); 661 } else { 662 windowStyles.overflow = ''; 663 } 664 $('html').css(windowStyles); 665 } 666 667 _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS); 668 mfp.ev.off(EVENT_NS); 669 670 // clean up DOM elements that aren't removed 671 mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style'); 672 mfp.bgOverlay.attr('class', 'mfp-bg'); 673 mfp.container.attr('class', 'mfp-container'); 674 675 // remove close button from target element 676 if (mfp.st.showCloseBtn && 677 (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) { 678 if (mfp.currTemplate.closeBtn) 679 mfp.currTemplate.closeBtn.detach(); 680 } 681 682 683 if (mfp.st.autoFocusLast && mfp._lastFocusedEl) { 684 $(mfp._lastFocusedEl).focus(); // put tab focus back 685 } 686 mfp.currItem = null; 687 mfp.content = null; 688 mfp.currTemplate = null; 689 mfp.prevHeight = 0; 690 691 _mfpTrigger(AFTER_CLOSE_EVENT); 692 }, 693 694 updateSize: function (winHeight) { 695 696 if (mfp.isIOS) { 697 // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2 698 var zoomLevel = document.documentElement.clientWidth / window.innerWidth; 699 var height = window.innerHeight * zoomLevel; 700 mfp.wrap.css('height', height); 701 mfp.wH = height; 702 } else { 703 mfp.wH = winHeight || _window.height(); 704 } 705 // Fixes #84: popup incorrectly positioned with position:relative on body 706 if (!mfp.fixedContentPos) { 707 mfp.wrap.css('height', mfp.wH); 708 } 709 710 _mfpTrigger('Resize'); 711 712 }, 713 714 /** 715 * Set content of popup based on current index 716 */ 717 updateItemHTML: function () { 718 var item = mfp.items[mfp.index]; 719 720 // Detach and perform modifications 721 mfp.contentContainer.detach(); 722 723 if (mfp.content) 724 mfp.content.detach(); 725 726 if (!item.parsed) { 727 item = mfp.parseEl(mfp.index); 728 } 729 730 var type = item.type; 731 732 _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]); 733 // BeforeChange event works like so: 734 // _mfpOn('BeforeChange', function(e, prevType, newType) { }); 735 736 mfp.currItem = item; 737 738 if (!mfp.currTemplate[type]) { 739 var markup = mfp.st[type] ? mfp.st[type].markup : false; 740 741 // allows to modify markup 742 _mfpTrigger('FirstMarkupParse', markup); 743 744 if (markup) { 745 mfp.currTemplate[type] = $(markup); 746 } else { 747 // if there is no markup found we just define that template is parsed 748 mfp.currTemplate[type] = true; 749 } 750 } 751 752 if (_prevContentType && _prevContentType !== item.type) { 753 mfp.container.removeClass('mfp-' + _prevContentType + '-holder'); 754 } 755 756 var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]); 757 mfp.appendContent(newContent, type); 758 759 item.preloaded = true; 760 761 _mfpTrigger(CHANGE_EVENT, item); 762 _prevContentType = item.type; 763 764 // Append container back after its content changed 765 mfp.container.prepend(mfp.contentContainer); 766 767 _mfpTrigger('AfterChange'); 768 }, 769 770 771 /** 772 * Set HTML content of popup 773 */ 774 appendContent: function (newContent, type) { 775 mfp.content = newContent; 776 777 if (newContent) { 778 if (mfp.st.showCloseBtn && mfp.st.closeBtnInside && 779 mfp.currTemplate[type] === true) { 780 // if there is no markup, we just append close button element inside 781 if (!mfp.content.find('.mfp-close').length) { 782 mfp.content.append(_getCloseBtn()); 783 } 784 } else { 785 mfp.content = newContent; 786 } 787 } else { 788 mfp.content = ''; 789 } 790 791 _mfpTrigger(BEFORE_APPEND_EVENT); 792 mfp.container.addClass('mfp-' + type + '-holder'); 793 794 mfp.contentContainer.append(mfp.content); 795 }, 796 797 798 /** 799 * Creates Magnific Popup data object based on given data 800 * @param {int} index Index of item to parse 801 */ 802 parseEl: function (index) { 803 var item = mfp.items[index], 804 type; 805 806 if (item.tagName) { 807 item = {el: $(item)}; 808 } else { 809 type = item.type; 810 item = {data: item, src: item.src}; 811 } 812 813 if (item.el) { 814 var types = mfp.types; 815 816 // check for 'mfp-TYPE' class 817 for (var i = 0; i < types.length; i++) { 818 if (item.el.hasClass('mfp-' + types[i])) { 819 type = types[i]; 820 break; 821 } 822 } 823 824 item.src = item.el.attr('data-mfp-src'); 825 if (!item.src) { 826 item.src = item.el.attr('href'); 827 } 828 } 829 830 item.type = type || mfp.st.type || 'inline'; 831 item.index = index; 832 item.parsed = true; 833 mfp.items[index] = item; 834 _mfpTrigger('ElementParse', item); 835 836 return mfp.items[index]; 837 }, 838 839 840 /** 841 * Initializes single popup or a group of popups 842 */ 843 addGroup: function (el, options) { 844 var eHandler = function (e) { 845 e.mfpEl = this; 846 mfp._openClick(e, el, options); 847 }; 848 849 if (!options) { 850 options = {}; 851 } 852 853 var eName = 'click.magnificPopup'; 854 options.mainEl = el; 855 856 if (options.items) { 857 options.isObj = true; 858 el.off(eName).on(eName, eHandler); 859 } else { 860 options.isObj = false; 861 if (options.delegate) { 862 el.off(eName).on(eName, options.delegate, eHandler); 863 } else { 864 options.items = el; 865 el.off(eName).on(eName, eHandler); 866 } 867 } 868 }, 869 _openClick: function (e, el, options) { 870 var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick; 871 872 873 if (!midClick && (e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey)) { 874 return; 875 } 876 877 var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; 878 879 if (disableOn) { 880 if ($.isFunction(disableOn)) { 881 if (!disableOn.call(mfp)) { 882 return true; 883 } 884 } else { // else it's number 885 if (_window.width() < disableOn) { 886 return true; 887 } 888 } 889 } 890 891 if (e.type) { 892 e.preventDefault(); 893 894 // This will prevent popup from closing if element is inside and popup is already opened 895 if (mfp.isOpen) { 896 e.stopPropagation(); 897 } 898 } 899 900 options.el = $(e.mfpEl); 901 if (options.delegate) { 902 options.items = el.find(options.delegate); 903 } 904 mfp.open(options); 905 }, 906 907 908 /** 909 * Updates text on preloader 910 */ 911 updateStatus: function (status, text) { 912 913 if (mfp.preloader) { 914 if (_prevStatus !== status) { 915 mfp.container.removeClass('mfp-s-' + _prevStatus); 916 } 917 918 if (!text && status === 'loading') { 919 text = mfp.st.tLoading; 920 } 921 922 var data = { 923 status: status, 924 text: text 925 }; 926 // allows to modify status 927 _mfpTrigger('UpdateStatus', data); 928 929 status = data.status; 930 text = data.text; 931 932 mfp.preloader.html(text); 933 934 mfp.preloader.find('a').on('click', function (e) { 935 e.stopImmediatePropagation(); 936 }); 937 938 mfp.container.addClass('mfp-s-' + status); 939 _prevStatus = status; 940 } 941 }, 942 943 944 /* 945 "Private" helpers that aren't private at all 946 */ 947 // Check to close popup or not 948 // "target" is an element that was clicked 949 _checkIfClose: function (target) { 950 951 if ($(target).hasClass(PREVENT_CLOSE_CLASS)) { 952 return; 953 } 954 955 var closeOnContent = mfp.st.closeOnContentClick; 956 var closeOnBg = mfp.st.closeOnBgClick; 957 958 if (closeOnContent && closeOnBg) { 959 return true; 960 } else { 961 962 // We close the popup if click is on close button or on preloader. Or if there is no content. 963 if (!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0])) { 964 return true; 965 } 966 967 // if click is outside the content 968 if ((target !== mfp.content[0] && !$.contains(mfp.content[0], target))) { 969 if (closeOnBg) { 970 // last check, if the clicked element is in DOM, (in case it's removed onclick) 971 if ($.contains(document, target)) { 972 return true; 973 } 974 } 975 } else if (closeOnContent) { 976 return true; 977 } 978 979 } 980 return false; 981 }, 982 _addClassToMFP: function (cName) { 983 mfp.bgOverlay.addClass(cName); 984 mfp.wrap.addClass(cName); 985 }, 986 _removeClassFromMFP: function (cName) { 987 this.bgOverlay.removeClass(cName); 988 mfp.wrap.removeClass(cName); 989 }, 990 _hasScrollBar: function (winHeight) { 991 return ((mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height())); 992 }, 993 _setFocus: function () { 994 (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); 995 }, 996 _onFocusIn: function (e) { 997 if (e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target)) { 998 mfp._setFocus(); 999 return false; 1000 } 1001 }, 1002 _parseMarkup: function (template, values, item) { 1003 var arr; 1004 if (item.data) { 1005 values = $.extend(item.data, values); 1006 } 1007 _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item]); 1008 1009 $.each(values, function (key, value) { 1010 if (value === undefined || value === false) { 1011 return true; 1012 } 1013 arr = key.split('_'); 1014 if (arr.length > 1) { 1015 var el = template.find(EVENT_NS + '-' + arr[0]); 1016 1017 if (el.length > 0) { 1018 var attr = arr[1]; 1019 if (attr === 'replaceWith') { 1020 if (el[0] !== value[0]) { 1021 el.replaceWith(value); 1022 } 1023 } else if (attr === 'img') { 1024 if (el.is('img')) { 1025 el.attr('src', value); 1026 } else { 1027 el.replaceWith($('<img>').attr('src', value).attr('class', el.attr('class'))); 1028 } 1029 } else { 1030 el.attr(arr[1], value); 1031 } 1032 } 1033 1034 } else { 1035 template.find(EVENT_NS + '-' + key).html(value); 1036 } 1037 }); 1038 }, 1039 1040 _getScrollbarSize: function () { 1041 // thx David 1042 if (mfp.scrollbarSize === undefined) { 1043 var scrollDiv = document.createElement("div"); 1044 scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; 1045 document.body.appendChild(scrollDiv); 1046 mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; 1047 document.body.removeChild(scrollDiv); 1048 } 1049 return mfp.scrollbarSize; 1050 } 1051 1052 }; 1053 /* MagnificPopup core prototype end */ 1054 1055 1056 /** 1057 * Public static functions 1058 */ 1059 $.magnificPopup = { 1060 1061 instance: null, 1062 proto: MagnificPopup.prototype, 1063 modules: [], 1064 1065 open: function (options, index) { 1066 _checkInstance(); 1067 1068 if (!options) { 1069 options = {}; 1070 } else { 1071 options = $.extend(true, {}, options); 1072 } 1073 1074 options.isObj = true; 1075 options.index = index || 0; 1076 return this.instance.open(options); 1077 }, 1078 1079 close: function () { 1080 return $.magnificPopup.instance && $.magnificPopup.instance.close(); 1081 }, 1082 1083 registerModule: function (name, module) { 1084 if (module.options) { 1085 $.magnificPopup.defaults[name] = module.options; 1086 } 1087 $.extend(this.proto, module.proto); 1088 this.modules.push(name); 1089 }, 1090 1091 defaults: { 1092 1093 // Info about options is in docs: 1094 // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options 1095 1096 disableOn: 0, 1097 1098 key: null, 1099 1100 midClick: false, 1101 1102 mainClass: '', 1103 1104 preloader: true, 1105 1106 focus: '', // CSS selector of input to focus after popup is opened 1107 1108 closeOnContentClick: false, 1109 1110 closeOnBgClick: true, 1111 1112 closeBtnInside: true, 1113 1114 showCloseBtn: true, 1115 1116 enableEscapeKey: true, 1117 1118 modal: false, 1119 1120 alignTop: false, 1121 1122 removalDelay: 0, 1123 1124 prependTo: null, 1125 1126 fixedContentPos: 'auto', 1127 1128 fixedBgPos: 'auto', 1129 1130 overflowY: 'auto', 1131 1132 closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', 1133 1134 tClose: 'Close (Esc)', 1135 1136 tLoading: 'Loading...', 1137 1138 autoFocusLast: true 1139 1140 } 1141 }; 1142 1143 1144 $.fn.magnificPopup = function (options) { 1145 _checkInstance(); 1146 1147 var jqEl = $(this); 1148 1149 1150 // We call some API method of first param is a string 1151 if (typeof options === "string") { 1152 1153 if (options === 'open') { 1154 var items, 1155 itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, 1156 index = parseInt(arguments[1], 10) || 0; 1157 1158 if (itemOpts.items) { 1159 items = itemOpts.items[index]; 1160 } else { 1161 items = jqEl; 1162 if (itemOpts.delegate) { 1163 items = items.find(itemOpts.delegate); 1164 } 1165 items = items.eq(index); 1166 } 1167 mfp._openClick({mfpEl: items}, jqEl, itemOpts); 1168 } else { 1169 if (mfp.isOpen) 1170 mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); 1171 } 1172 1173 } else { 1174 // clone options obj 1175 options = $.extend(true, {}, options); 1176 1177 /* 1178 * As Zepto doesn't support .data() method for objects 1179 * and it works only in normal browsers 1180 * we assign "options" object directly to the DOM element. FTW! 1181 */ 1182 if (_isJQ) { 1183 jqEl.data('magnificPopup', options); 1184 } else { 1185 jqEl[0].magnificPopup = options; 1186 } 1187 1188 mfp.addGroup(jqEl, options); 1189 1190 } 1191 return jqEl; 1192 }; 1193 1194 /*>>core*/ 1195 1196 /*>>inline*/ 1197 1198 var INLINE_NS = 'inline', 1199 _hiddenClass, 1200 _inlinePlaceholder, 1201 _lastInlineElement, 1202 _putInlineElementsBack = function () { 1203 if (_lastInlineElement) { 1204 _inlinePlaceholder.after(_lastInlineElement.addClass(_hiddenClass)).detach(); 1205 _lastInlineElement = null; 1206 } 1207 }; 1208 1209 $.magnificPopup.registerModule(INLINE_NS, { 1210 options: { 1211 hiddenClass: 'hide', // will be appended with `mfp-` prefix 1212 markup: '', 1213 tNotFound: 'Content not found' 1214 }, 1215 proto: { 1216 1217 initInline: function () { 1218 mfp.types.push(INLINE_NS); 1219 1220 _mfpOn(CLOSE_EVENT + '.' + INLINE_NS, function () { 1221 _putInlineElementsBack(); 1222 }); 1223 }, 1224 1225 getInline: function (item, template) { 1226 1227 _putInlineElementsBack(); 1228 1229 if (item.src) { 1230 var inlineSt = mfp.st.inline, 1231 el = $(item.src); 1232 1233 if (el.length) { 1234 1235 // If target element has parent - we replace it with placeholder and put it back after popup is closed 1236 var parent = el[0].parentNode; 1237 if (parent && parent.tagName) { 1238 if (!_inlinePlaceholder) { 1239 _hiddenClass = inlineSt.hiddenClass; 1240 _inlinePlaceholder = _getEl(_hiddenClass); 1241 _hiddenClass = 'mfp-' + _hiddenClass; 1242 } 1243 // replace target inline element with placeholder 1244 _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass); 1245 } 1246 1247 mfp.updateStatus('ready'); 1248 } else { 1249 mfp.updateStatus('error', inlineSt.tNotFound); 1250 el = $('<div>'); 1251 } 1252 1253 item.inlineElement = el; 1254 return el; 1255 } 1256 1257 mfp.updateStatus('ready'); 1258 mfp._parseMarkup(template, {}, item); 1259 return template; 1260 } 1261 } 1262 }); 1263 1264 /*>>inline*/ 1265 1266 /*>>ajax*/ 1267 var AJAX_NS = 'ajax', 1268 _ajaxCur, 1269 _removeAjaxCursor = function () { 1270 if (_ajaxCur) { 1271 $(document.body).removeClass(_ajaxCur); 1272 } 1273 }, 1274 _destroyAjaxRequest = function () { 1275 _removeAjaxCursor(); 1276 if (mfp.req) { 1277 mfp.req.abort(); 1278 } 1279 }; 1280 1281 $.magnificPopup.registerModule(AJAX_NS, { 1282 1283 options: { 1284 settings: null, 1285 cursor: 'mfp-ajax-cur', 1286 tError: '<a href="%url%">The content</a> could not be loaded.' 1287 }, 1288 1289 proto: { 1290 initAjax: function () { 1291 mfp.types.push(AJAX_NS); 1292 _ajaxCur = mfp.st.ajax.cursor; 1293 1294 _mfpOn(CLOSE_EVENT + '.' + AJAX_NS, _destroyAjaxRequest); 1295 _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest); 1296 }, 1297 getAjax: function (item) { 1298 1299 if (_ajaxCur) { 1300 $(document.body).addClass(_ajaxCur); 1301 } 1302 1303 mfp.updateStatus('loading'); 1304 1305 var opts = $.extend({ 1306 url: item.src, 1307 success: function (data, textStatus, jqXHR) { 1308 var temp = { 1309 data: data, 1310 xhr: jqXHR 1311 }; 1312 1313 _mfpTrigger('ParseAjax', temp); 1314 1315 mfp.appendContent($(temp.data), AJAX_NS); 1316 1317 item.finished = true; 1318 1319 _removeAjaxCursor(); 1320 1321 mfp._setFocus(); 1322 1323 setTimeout(function () { 1324 mfp.wrap.addClass(READY_CLASS); 1325 }, 16); 1326 1327 mfp.updateStatus('ready'); 1328 1329 _mfpTrigger('AjaxContentAdded'); 1330 }, 1331 error: function () { 1332 _removeAjaxCursor(); 1333 item.finished = item.loadError = true; 1334 mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src)); 1335 } 1336 }, mfp.st.ajax.settings); 1337 1338 mfp.req = $.ajax(opts); 1339 1340 return ''; 1341 } 1342 } 1343 }); 1344 1345 /*>>ajax*/ 1346 1347 /*>>image*/ 1348 var _imgInterval, 1349 _getTitle = function (item) { 1350 1351 if (item.data && item.data.title !== undefined) 1352 return item.data.title; 1353 1354 var src = mfp.st.image.titleSrc; 1355 1356 if (src) { 1357 if ($.isFunction(src)) { 1358 return src.call(mfp, item); 1359 } else if (item.el) { 1360 return item.el.attr(src) || ''; 1361 } 1362 } 1363 return ''; 1364 }; 1365 1366 $.magnificPopup.registerModule('image', { 1367 options: { 1368 markup: '<div class="mfp-figure">' + 1369 '<div class="mfp-close"></div>' + 1370 '<figure>' + 1371 '<div class="mfp-img"></div>' + 1372 '<div style="border-radius:35px;float: left;position: absolute;
1372left: 5px;top: 45px;z-index: 1000;background-color: rgba(255, 255, 255, 0.7);padding: 5px;color: #000000;font-weight: bold;"><li class="social" style="margin-top:0px!important;"><a class="btnsocial" href="#" alt=""><i class="fa fa-facebook" id="facebook"></i></a><a class="btnsocial" href="#" alt=""><i class="fa fa-twitter" id="twitter"></i></a><a class="btnsocial" href="#" alt=""><i class="fa fa-linkedin" id="linkedin"></i></a><a class="btnsocial" href="#" alt=""><i class="fa fa-google-plus" id="google"></i></a></li></div>' + 1373 '<figcaption>' + 1374 '<div class="mfp-bottom-bar">' + 1375 '<div class="mfp-title"></div>' + 1376 '<div class="mfp-counter"></div>' + 1377 '</div>' + 1378 '</figcaption>' + 1379 '</figure>' + 1380 '</div>+' + 1381 '', 1382 cursor: 'mfp-zoom-out-cur', 1383 titleSrc: 'title', 1384 verticalFit: true, 1385 tError: '<a href="%url%">The image</a> could not be loaded.' 1386 }, 1387 1388 proto: { 1389 initImage: function () { 1390 1391 1392 var imgSt = mfp.st.image, 1393 ns = '.image'; 1394 1395 mfp.types.push('image'); 1396 1397 _mfpOn(OPEN_EVENT + ns, function () { 1398 if (mfp.currItem.type === 'image' && imgSt.cursor) { 1399 $(document.body).addClass(imgSt.cursor); 1400 } 1401 }); 1402 1403 _mfpOn(CLOSE_EVENT + ns, function () { 1404 if (imgSt.cursor) { 1405 $(document.body).removeClass(imgSt.cursor); 1406 } 1407 _window.off('resize' + EVENT_NS); 1408 }); 1409 1410 _mfpOn('Resize' + ns, mfp.resizeImage); 1411 if (mfp.isLowIE) { 1412 _mfpOn('AfterChange', mfp.resizeImage); 1413 } 1414 }, 1415 resizeImage: function () { 1416 var item = mfp.currItem; 1417 if (!item || !item.img) return; 1418 1419 if (mfp.st.image.verticalFit) { 1420 var decr = 0; 1421 // fix box-sizing in ie7/8 1422 if (mfp.isLowIE) { 1423 decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'), 10); 1424 } 1425 item.img.css('max-height', mfp.wH - decr); 1426 } 1427 }, 1428 _onImageHasSize: function (item) { 1429 if (item.img) { 1430 1431 item.hasSize = true; 1432 1433 if (_imgInterval) { 1434 clearInterval(_imgInterval); 1435 } 1436 1437 item.isCheckingImgSize = false; 1438 1439 _mfpTrigger('ImageHasSize', item); 1440 1441 if (item.imgHidden) { 1442 if (mfp.content) 1443 mfp.content.removeClass('mfp-loading'); 1444 1445 item.imgHidden = false; 1446 } 1447 1448 } 1449 }, 1450 1451 /** 1452 * Function that loops until the image has size to display elements that rely on it asap 1453 */ 1454 findImageSize: function (item) { 1455 1456 var counter = 0, 1457 img = item.img[0], 1458 mfpSetInterval = function (delay) { 1459 1460 if (_imgInterval) { 1461 clearInterval(_imgInterval); 1462 } 1463 // decelerating interval that checks for size of an image 1464 _imgInterval = setInterval(function () { 1465 if (img.naturalWidth > 0) { 1466 mfp._onImageHasSize(item); 1467 return; 1468 } 1469 1470 if (counter > 200) { 1471 clearInterval(_imgInterval); 1472 } 1473 1474 counter++; 1475 if (counter === 3) { 1476 mfpSetInterval(10); 1477 } else if (counter === 40) { 1478 mfpSetInterval(50);
1479 } else if (counter === 100) { 1480 mfpSetInterval(500); 1481 } 1482 }, delay); 1483 }; 1484 1485 mfpSetInterval(1); 1486 }, 1487 1488 getImage: function (item, template) { 1489 1490 var guard = 0, 1491 1492 // image load complete handler 1493 onLoadComplete = function () { 1494 if (item) { 1495 if (item.img[0].complete) { 1496 item.img.off('.mfploader'); 1497 1498 if (item === mfp.currItem) { 1499 mfp._onImageHasSize(item); 1500 1501 mfp.updateStatus('ready'); 1502 } 1503 1504 item.hasSize = true; 1505 item.loaded = true; 1506 1507 _mfpTrigger('ImageLoadComplete'); 1508 1509 } 1510 else { 1511 // if image complete check fails 200 times (20 sec), we assume that there was an error. 1512 guard++; 1513 if (guard < 200) { 1514 setTimeout(onLoadComplete, 100); 1515 } else { 1516 onLoadError(); 1517 } 1518 } 1519 } 1520 }, 1521 1522 // image error handler 1523 onLoadError = function () { 1524 if (item) { 1525 item.img.off('.mfploader'); 1526 if (item === mfp.currItem) { 1527 mfp._onImageHasSize(item); 1528 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src)); 1529 } 1530 1531 item.hasSize = true; 1532 item.loaded = true; 1533 item.loadError = true; 1534 } 1535 }, 1536 imgSt = mfp.st.image; 1537 1538 1539 var el = template.find('.mfp-img'); 1540 if (el.length) { 1541 var img = document.createElement('img'); 1542 img.className = 'mfp-img'; 1543 if (item.el && item.el.find('img').length) { 1544 img.alt = item.el.find('img').attr('alt'); 1545 } 1546 item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError); 1547 img.src = item.src; 1548 1549 // without clone() "error" event is not firing when IMG is replaced by new IMG
1550 // TODO: find a way to avoid such cloning 1551 if (el.is('img')) { 1552 item.img = item.img.clone(); 1553 } 1554 1555 img = item.img[0]; 1556 if (img.naturalWidth > 0) { 1557 item.hasSize = true; 1558 } else if (!img.width) { 1559 item.hasSize = false; 1560 } 1561 } 1562 1563 mfp._parseMarkup(template, { 1564 title: _getTitle(item), 1565 img_replaceWith: item.img 1566 }, item); 1567 1568 mfp.resizeImage(); 1569 /** facebook sharing **/ 1570 mfp.currTemplate.image.children("figure").children("div").children("li").children("a:eq(0)").on("click", function () { 1571 if(mfp.currItem.img.context.src==item.el.context.href){ 1572 window.open('http://facebook.com/sharer.php?u=' + item.el.attr("urlsite")+'/photoshare/'+item.el.attr("id-img"), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); 1573 } 1574 return false; 1575 }); 1576 1577 /** twitter sharing **/ 1578 https://twitter.com/home?status= 1579 mfp.currTemplate.image.children("figure").children("div").children("li").children("a:eq(1)").on("click", function () { 1580 if(mfp.currItem.img.context.src==item.el.context.href){ 1581 window.open('https://twitter.com/home?status=' + item.el.attr("urlsite")+'/photoshare/'+item.el.attr("id-img") , '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); 1582 } 1583 return false; 1584 }); 1585 1586 /** linkedin sharing **/ 1587 mfp.currTemplate.image.children("figure").children("div").children("li").children("a:eq(2)").on("click", function () { 1588 if(mfp.currItem.img.context.src==item.el.context.href){ 1589 window.open('https://www.linkedin.com/shareArticle?mini=true&url=' + item.el.attr("urlsite")+'/photoshare/'+item.el.attr("id-img") + "&title=&summary=&source=", '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); 1590 } 1591 return false; 1592 }); 1593 1594 /** google sharing **/ 1595 mfp.currTemplate.image.children("figure").children("div").children("li").children("a:eq(3)").on("click", function () { 1596 if(mfp.currItem.img.context.src==item.el.context.href){ 1597 window.open('https://plus.google.com/share?url=' + item.el.attr("urlsite")+'/photoshare/'+item.el.attr("id-img") , '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); 1598 } 1599 return false; 1600 }); 1601 1602 if (item.hasSize) { 1603 if (_imgInterval) clearInterval(_imgInterval); 1604 1605 if (item.loadError) { 1606 template.addClass('mfp-loading'); 1607 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src)); 1608 } else { 1609 template.removeClass('mfp-loading'); 1610 mfp.updateStatus('ready'); 1611 } 1612 return template; 1613 } 1614 1615 mfp.updateStatus('loading'); 1616 item.loading = true; 1617 1618 if (!item.hasSize) { 1619 item.imgHidden = true; 1620 template.addClass('mfp-loading'); 1621 mfp.findImageSize(item); 1622 } 1623 1624 return template; 1625 } 1626 } 1627 }); 1628 1629 /*>>image*/ 1630 1631 /*>>zoom*/ 1632 var hasMozTransform, 1633 getHasMozTransform = function () { 1634 if (hasMozTransform === undefined) { 1635 hasMozTransform = document.createElement('p').style.MozTransform !== undefined; 1636 } 1637 return hasMozTransform; 1638 }; 1639 1640 $.magnificPopup.registerModule('zoom', { 1641 1642 options: { 1643 enabled: false, 1644 easing: 'ease-in-out', 1645 duration: 300, 1646 opener: function (element) { 1647 return element.is('img') ? element : element.find('img'); 1648 } 1649 }, 1650 1651 proto: { 1652 1653 initZoom: function () { 1654 var zoomSt = mfp.st.zoom, 1655 ns = '.zoom', 1656 image; 1657 1658 if (!zoomSt.enabled || !mfp.supportsTransition) { 1659 return; 1660 } 1661 1662 var duration = zoomSt.duration, 1663 getElToAnimate = function (image) { 1664 var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'), 1665 transition = 'all ' + (zoomSt.duration / 1000) + 's ' + zoomSt.easing, 1666 cssObj = { 1667 position: 'fixed', 1668 zIndex: 9999, 1669 left: 0, 1670 top: 0,
vendor: 11,462 bytes, lines 1671-1969
1671 '-webkit-backface-visibility': 'hidden' 1672 }, 1673 t = 'transition'; 1674 1675 cssObj['-webkit-' + t] = cssObj['-moz-' + t] = cssObj['-o-' + t] = cssObj[t] = transition; 1676 1677 newImg.css(cssObj); 1678 return newImg; 1679 }, 1680 showMainContent = function () { 1681 mfp.content.css('visibility', 'visible'); 1682 }, 1683 openTimeout, 1684 animatedImg; 1685 1686 _mfpOn('BuildControls' + ns, function () { 1687 if (mfp._allowZoom()) { 1688 1689 clearTimeout(openTimeout); 1690 mfp.content.css('visibility', 'hidden'); 1691 1692 // Basically, all code below does is clones existing image, puts in on top of the current one and animated it 1693 1694 image = mfp._getItemToZoom(); 1695 1696 if (!image) { 1697 showMainContent(); 1698 return; 1699 } 1700 1701 animatedImg = getElToAnimate(image); 1702 1703 animatedImg.css(mfp._getOffset()); 1704 1705 mfp.wrap.append(animatedImg); 1706 1707 openTimeout = setTimeout(function () { 1708 animatedImg.css(mfp._getOffset(true)); 1709 openTimeout = setTimeout(function () { 1710 1711 showMainContent(); 1712 1713 setTimeout(function () { 1714 animatedImg.remove(); 1715 image = animatedImg = null; 1716 _mfpTrigger('ZoomAnimationEnded'); 1717 }, 16); // avoid blink when switching images 1718 1719 }, duration); // this timeout equals animation duration 1720 1721 }, 16); // by adding this timeout we avoid short glitch at the beginning of animation 1722 1723 1724 // Lots of timeouts... 1725 } 1726 }); 1727 _mfpOn(BEFORE_CLOSE_EVENT + ns, function () { 1728 if (mfp._allowZoom()) { 1729 1730 clearTimeout(openTimeout); 1731 1732 mfp.st.removalDelay = duration; 1733 1734 if (!image) { 1735 image = mfp._getItemToZoom(); 1736 if (!image) { 1737 return; 1738 } 1739 animatedImg = getElToAnimate(image); 1740 } 1741 1742 animatedImg.css(mfp._getOffset(true)); 1743 mfp.wrap.append(animatedImg); 1744 mfp.content.css('visibility', 'hidden'); 1745 1746 setTimeout(function () { 1747 animatedImg.css(mfp._getOffset()); 1748 }, 16); 1749 } 1750 1751 }); 1752 1753 _mfpOn(CLOSE_EVENT + ns, function () { 1754 if (mfp._allowZoom()) { 1755 showMainContent(); 1756 if (animatedImg) { 1757 animatedImg.remove(); 1758 } 1759 image = null; 1760 } 1761 }); 1762 }, 1763 1764 _allowZoom: function () { 1765 return mfp.currItem.type === 'image'; 1766 }, 1767 1768 _getItemToZoom: function () { 1769 if (mfp.currItem.hasSize) { 1770 return mfp.currItem.img; 1771 } else { 1772 return false; 1773 } 1774 }, 1775 1776 // Get element postion relative to viewport 1777 _getOffset: function (isLarge) { 1778 var el; 1779 if (isLarge) { 1780 el = mfp.currItem.img; 1781 } else { 1782 el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); 1783 } 1784 1785 var offset = el.offset(); 1786 var paddingTop = parseInt(el.css('padding-top'), 10); 1787 var paddingBottom = parseInt(el.css('padding-bottom'), 10); 1788 offset.top -= ($(window).scrollTop() - paddingTop); 1789 1790 1791 /* 1792 1793 Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa. 1794 1795 */ 1796 var obj = { 1797 width: el.width(), 1798 // fix Zepto height+padding issue 1799 height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop 1800 }; 1801 1802 // I hate to do this, but there is no another option 1803 if (getHasMozTransform()) { 1804 obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)'; 1805 } else { 1806 obj.left = offset.left; 1807 obj.top = offset.top; 1808 } 1809 return obj; 1810 } 1811 1812 } 1813 }); 1814 1815 1816 /*>>zoom*/ 1817 1818 /*>>iframe*/ 1819 1820 var IFRAME_NS = 'iframe', 1821 _emptyPage = '//about:blank', 1822 1823 _fixIframeBugs = function (isShowing) { 1824 if (mfp.currTemplate[IFRAME_NS]) { 1825 var el = mfp.currTemplate[IFRAME_NS].find('iframe'); 1826 if (el.length) { 1827 // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug 1828 if (!isShowing) { 1829 el[0].src = _emptyPage; 1830 } 1831 1832 // IE8 black screen bug fix 1833 if (mfp.isIE8) { 1834 el.css('display', isShowing ? 'block' : 'none'); 1835 } 1836 } 1837 } 1838 }; 1839 1840 $.magnificPopup.registerModule(IFRAME_NS, { 1841 1842 options: { 1843 markup: '<div class="mfp-iframe-scaler">' + 1844 '<div class="mfp-close"></div>' + 1845 '<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>' + 1846 '</div>', 1847 1848 srcAction: 'iframe_src', 1849 1850 // we don't care and support only one default type of URL by default 1851 patterns: { 1852 youtube: { 1853 index: 'youtube.com', 1854 id: 'v=', 1855 src: '//www.youtube.com/embed/%id%?autoplay=1' 1856 }, 1857 vimeo: { 1858 index: 'vimeo.com/', 1859 id: '/', 1860 src: '//player.vimeo.com/video/%id%?autoplay=1' 1861 }, 1862 gmaps: { 1863 index: '//maps.google.', 1864 src: '%id%&output=embed' 1865 } 1866 } 1867 }, 1868 1869 proto: { 1870 initIframe: function () { 1871 mfp.types.push(IFRAME_NS); 1872 1873 _mfpOn('BeforeChange', function (e, prevType, newType) { 1874 if (prevType !== newType) { 1875 if (prevType === IFRAME_NS) { 1876 _fixIframeBugs(); // iframe if removed 1877 } else if (newType === IFRAME_NS) { 1878 _fixIframeBugs(true); // iframe is showing 1879 } 1880 }// else { 1881 // iframe source is switched, don't do anything 1882 //} 1883 }); 1884 1885 _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function () { 1886 _fixIframeBugs(); 1887 }); 1888 }, 1889 1890 getIframe: function (item, template) { 1891 var embedSrc = item.src; 1892 var iframeSt = mfp.st.iframe; 1893 1894 $.each(iframeSt.patterns, function () { 1895 if (embedSrc.indexOf(this.index) > -1) { 1896 if (this.id) { 1897 if (typeof this.id === 'string') { 1898 embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id) + this.id.length, embedSrc.length); 1899 } else { 1900 embedSrc = this.id.call(this, embedSrc); 1901 } 1902 } 1903 embedSrc = this.src.replace('%id%', embedSrc); 1904 return false; // break; 1905 } 1906 }); 1907 1908 var dataObj = {}; 1909 if (iframeSt.srcAction) { 1910 dataObj[iframeSt.srcAction] = embedSrc; 1911 } 1912 mfp._parseMarkup(template, dataObj, item); 1913 1914 mfp.updateStatus('ready'); 1915 1916 return template; 1917 } 1918 } 1919 }); 1920 1921 1922 /*>>iframe*/ 1923 1924 /*>>gallery*/ 1925 /** 1926 * Get looped index depending on number of slides 1927 */ 1928 var _getLoopedId = function (index) { 1929 var numSlides = mfp.items.length; 1930 if (index > numSlides - 1) { 1931 return index - numSlides; 1932 } else if (index < 0) { 1933 return numSlides + index; 1934 } 1935 return index; 1936 }, 1937 _replaceCurrTotal = function (text, curr, total) { 1938 return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total); 1939 }; 1940 1941 $.magnificPopup.registerModule('gallery', { 1942 1943 options: { 1944 enabled: false, 1945 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 1946 preload: [0, 2], 1947 navigateByImgClick: true, 1948 arrows: true, 1949 1950 tPrev: 'Previous (Left arrow key)', 1951 tNext: 'Next (Right arrow key)', 1952 tCounter: '%curr% of %total%' 1953 }, 1954 1955 proto: { 1956 initGallery: function () { 1957 1958 var gSt = mfp.st.gallery, 1959 ns = '.mfp-gallery'; 1960 1961 mfp.direction = true; // true - next, false - prev 1962 1963 if (!gSt || !gSt.enabled) return false; 1964 1965 _wrapClasses += ' mfp-gallery'; 1966 1967 _mfpOn(OPEN_EVENT + ns, function () { 1968 1969 if (gSt.navigateByImgClick) {
1970 mfp.wrap.on('click' + ns, '.mfp-img', function () { 1971 if (mfp.items.length > 1) { 1972 mfp.next(); 1973 return false; 1974 } 1975 }); 1976 } 1977 1978 _document.on('keydown' + ns, function (e) { 1979 if (e.keyCode === 37) { 1980 mfp.prev(); 1981 } else if (e.keyCode === 39) { 1982 mfp.next(); 1983 } 1984 }); 1985 }); 1986 1987 _mfpOn('UpdateStatus' + ns, function (e, data) { 1988 if (data.text) { 1989 data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length); 1990 } 1991 }); 1992 1993 _mfpOn(MARKUP_PARSE_EVENT + ns, function (e, element, values, item) { 1994 var l = mfp.items.length; 1995 values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : ''; 1996 }); 1997 1998 _mfpOn('BuildControls' + ns, function () { 1999 if (mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) { 2000 var markup = gSt.arrowMarkup, 2001 arrowLeft = mfp.arrowLeft = $(markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left')).addClass(PREVENT_CLOSE_CLASS), 2002 arrowRight = mfp.arrowRight = $(markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right')).addClass(PREVENT_CLOSE_CLASS); 2003 2004 arrowLeft.click(function () { 2005 mfp.prev(); 2006 }); 2007 arrowRight.click(function () { 2008 mfp.next(); 2009 }); 2010 2011 mfp.container.append(arrowLeft.add(arrowRight)); 2012 } 2013 }); 2014 2015 _mfpOn(CHANGE_EVENT + ns, function () { 2016 if (mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout); 2017 2018 mfp._preloadTimeout = setTimeout(function () { 2019 mfp.preloadNearbyImages(); 2020 mfp._preloadTimeout = null; 2021 }, 16); 2022 }); 2023 2024 2025 _mfpOn(CLOSE_EVENT + ns, function () { 2026 _document.off(ns); 2027 mfp.wrap.off('click' + ns); 2028 mfp.arrowRight = mfp.arrowLeft = null; 2029 }); 2030 2031 }, 2032 next: function () { 2033 mfp.direction = true; 2034 mfp.index = _getLoopedId(mfp.index + 1); 2035 mfp.updateItemHTML(); 2036 }, 2037 prev: function () { 2038 mfp.direction = false; 2039 mfp.index = _getLoopedId(mfp.index - 1); 2040 mfp.updateItemHTML(); 2041 }, 2042 goTo: function (newIndex) { 2043 mfp.direction = (newIndex >= mfp.index); 2044 mfp.index = newIndex; 2045 mfp.updateItemHTML(); 2046 }, 2047 preloadNearbyImages: function () { 2048 var p = mfp.st.gallery.preload, 2049 preloadBefore = Math.min(p[0], mfp.items.length), 2050 preloadAfter = Math.min(p[1], mfp.items.length), 2051 i; 2052 2053 for (i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) { 2054 mfp._preloadItem(mfp.index + i); 2055 } 2056 for (i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) { 2057 mfp._preloadItem(mfp.index - i); 2058 } 2059 }, 2060 _preloadItem: function (index) { 2061 index = _getLoopedId(index); 2062 2063 if (mfp.items[index].preloaded) { 2064 return; 2065 } 2066 2067 var item = mfp.items[index]; 2068 if (!item.parsed) { 2069 item = mfp.parseEl(index); 2070 } 2071 2072 _mfpTrigger('LazyLoad', item); 2073 2074 if (item.type === 'image') { 2075 item.img = $('<img class="mfp-img" />').on('load.mfploader', function () { 2076 item.hasSize = true; 2077 }).on('error.mfploader', function () { 2078 item.hasSize = true; 2079 item.loadError = true; 2080 _mfpTrigger('LazyLoadError', item); 2081 }).attr('src', item.src); 2082 } 2083 2084 2085 item.preloaded = true; 2086 } 2087 } 2088 }); 2089 2090 /*>>gallery*/ 2091 2092 /*>>retina*/ 2093 2094 var RETINA_NS = 'retina'; 2095 2096 $.magnificPopup.registerModule(RETINA_NS, { 2097 options: { 2098 replaceSrc: function (item) { 2099 return item.src.replace(/\.\w+$/, function (m) { 2100 return '@2x' + m; 2101 }); 2102 }, 2103 ratio: 1 // Function or number. Set to 1 to disable. 2104 }, 2105 proto: { 2106 initRetina: function () { 2107 if (window.devicePixelRatio > 1) { 2108 2109 var st = mfp.st.retina, 2110 ratio = st.ratio; 2111
2112 ratio = !isNaN(ratio) ? ratio : ratio(); 2113 2114 if (ratio > 1) { 2115 _mfpOn('ImageHasSize' + '.' + RETINA_NS, function (e, item) { 2116 item.img.css({ 2117 'max-width': item.img[0].naturalWidth / ratio, 2118 'width': '100%' 2119 }); 2120 }); 2121 _mfpOn('ElementParse' + '.' + RETINA_NS, function (e, item) { 2122 item.src = st.replaceSrc(item, ratio); 2123 }); 2124 } 2125 } 2126 2127 } 2128 } 2129 }); 2130 2131 /*>>retina*/ 2132 _checkInstance(); 2133 }));
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.