1(function($) 2{ 3 "use strict"; 4 5 // ------------------------------------------------------------------------------------------- 6 // Ligthbox activation 7 // ------------------------------------------------------------------------------------------- 8 9 $.avia_utilities = $.avia_utilities || {}; 10 11 $.avia_utilities.av_popup = { 12 type: 'image', 13 mainClass: 'avia-popup mfp-zoom-in', 14 tLoading: '', 15 tClose: '', 16 removalDelay: 300, //delay removal by X to allow out-animation 17 closeBtnInside: true, 18 closeOnContentClick:false, 19 midClick: true, 20 fixedContentPos: false, // allows scrolling when lightbox is open but also removes any jumping because of scrollbar removal 21 iframe: { 22 patterns: { 23 youtube: { 24 index: 'youtube.com/watch', 25 id: function(url) { 26 27 //fetch the id 28 var m = url.match(/[\\?\\&]v=([^\\?\\&]+)/), id, params; 29 if ( !m || !m[1] ) return null; 30 31 id = m[1]; 32 33 //fetch params 34 params = url.split('/watch'); 35 params = params[1]; 36 37 return id + params; 38 }, 39 src: '//www.youtube.com/embed/%id%' 40 } 41 } 42 }, 43 image: { 44 titleSrc: function(item){ 45 var title = item.el.attr('title'); 46 if(!title) title = item.el.find('img').attr('title'); 47 if(!title) title = item.el.parent().next('.wp-caption-text').html(); 48 if(typeof title == "undefined") return ""; 49 return title; 50 } 51 }, 52 53 gallery: { 54 // delegate: options.autolinkElements, 55 tPrev: '', 56 tNext: '', 57 tCounter: '%curr% / %total%', 58 enabled: true, 59 preload: [1,1] // Will preload 1 - before current, and 1 after the current image 60 }, 61 62 callbacks: 63 { 64 beforeOpen: function() 65 { 66 //add custom css class for different styling 67 if( this.st.el && this.st.el.data('fixed-content') ) 68 { 69 this.fixedContentPos = true; 70 } 71 }, 72 73 74 open: function() 75 { 76 //overwrite default prev + next function. Add timeout for crossfade animation 77 $.magnificPopup.instance.next = function() { 78 var self = this; 79 self.wrap.removeClass('mfp-image-loaded'); 80 setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); 81 }; 82 83 $.magnificPopup.instance.prev = function() { 84 var self = this; 85 self.wrap.removeClass('mfp-image-loaded'); 86 setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); 87 }; 88 89 //add custom css class for different styling 90 if( this.st.el && this.st.el.data('av-extra-class') ) 91 { 92 this.wrap.addClass( this.currItem.el.data('av-extra-class') ); 93 } 94 95 96 }, 97 imageLoadComplete: function() 98 { 99 var self = this; 100 setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16); 101 }, 102 change: function() { 103 104 if( this.currItem.el ) 105 { 106 var current = this.currItem.el; 107 108 this.content.find( '.av-extra-modal-content, .av-extra-modal-markup' ).remove(); 109 110 if( current.data('av-extra-content') ) 111 { 112 var extra = current.data('av-extra-content'); 113 this.content.append( "<div class='av-extra-modal-content'>" + extra + "</div>" ); 114 } 115 116 if( current.data('av-extra-markup') ) 117 { 118 var markup = current.data('av-extra-markup'); 119 this.wrap.append( "<div class='av-extra-modal-markup'>" + markup + "</div>" ); 120 } 121 } 122 } 123 } 124 }, 125 126 127 $.fn.avia_activate_lightbox = function(variables) 128 { 129 130 var defaults = { 131 groups : ['.avia-slideshow', '.avia-gallery', '.av-horizontal-gallery', '.av-instagram-pics', '.portfolio-preview-image', '.portfolio-preview-content', '.isotope', '.post-entry', '.sidebar', '#main', '.main_menu', '.woocommerce-product-gallery'], 132 autolinkElements: 'a.lightbox, a[rel^="prettyPhoto"], a[rel^="lightbox"], a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg], a[href*=".jpg?"], a[href*=".png?"], a[href*=".gif?"], a[href*=".jpeg?"], a[href$=".mov"] , a[href$=".swf"] , a:regex(href, .vimeo\.com/[0-9]) , a[href*="youtube.com/watch"] , a[href*="screenr.com"], a[href*="iframe=true"]', 133 videoElements : 'a[href$=".mov"] , a[href$=".swf"] , a:regex(href, .vimeo\.com/[0-9]) , a[href*="youtube.com/watch"] , a[href*="screenr.com"], a[href*="iframe=true"]',
134 exclude : '.noLightbox, .noLightbox a, .fakeLightbox, .lightbox-added, a[href*="dropbox.com"]' 135 }, 136 137 options = $.extend({}, defaults, variables), 138 139 active = !$('html').is('.av-custom-lightbox'); 140 141 if(!active) return this; 142 143 return this.each(function() 144 { 145 var container = $(this), 146 videos = $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/ 147 ajaxed = !container.is('body') && !container.is('.ajax_slide'); 148 for (var i = 0; i < options.groups.length; i++) 149 { 150 container.find(options.groups[i]).each(function() 151 { 152 var links = $(options.autolinkElements, this); 153 if(ajaxed) links.removeClass('lightbox-added'); 154 links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); 155 }); 156 } 157 158 }); 159 }; 160})(jQuery); 161 162
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.