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 vimeo: { 42 index: 'vimeo.com/', 43 id: function(url) { 44 45 //fetch the id 46 var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/), id, params; 47 if ( !m || !m[5] ) return null; 48 49 id = m[5]; 50 51 //fetch params 52 params = url.split('?'); 53 params = params[1]; 54 55 return id + '?' + params; 56 }, 57 src: '//player.vimeo.com/video/%id%' 58 } 59 } 60 }, 61 image: { 62 titleSrc: function(item){ 63 var title = item.el.attr('title'); 64 if(!title) title = item.el.find('img').attr('title'); 65 if(!title) title = item.el.parent().next('.wp-caption-text').html(); 66 if(typeof title == "undefined") return ""; 67 return title; 68 } 69 }, 70 71 gallery: { 72 // delegate: options.autolinkElements, 73 tPrev: '', 74 tNext: '', 75 tCounter: '%curr% / %total%', 76 enabled: true, 77 preload: [1,1] // Will preload 1 - before current, and 1 after the current image 78 }, 79 80 callbacks: 81 { 82 beforeOpen: function() 83 { 84 //add custom css class for different styling 85 if( this.st.el && this.st.el.data('fixed-content') ) 86 { 87 this.fixedContentPos = true; 88 } 89 }, 90 91 92 open: function() 93 { 94 //overwrite default prev + next function. Add timeout for crossfade animation 95 $.magnificPopup.instance.next = function() { 96 var self = this; 97 self.wrap.removeClass('mfp-image-loaded'); 98 setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); 99 }; 100 101 $.magnificPopup.instance.prev = function() { 102 var self = this; 103 self.wrap.removeClass('mfp-image-loaded'); 104 setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); 105 }; 106 107 //add custom css class for different styling 108 if( this.st.el && this.st.el.data('av-extra-class') ) 109 { 110 this.wrap.addClass( this.currItem.el.data('av-extra-class') ); 111 } 112 113 114 }, 115 imageLoadComplete: function() 116 { 117 var self = this; 118 setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16); 119 }, 120 change: function() { 121 122 if( this.currItem.el ) 123 { 124 var current = this.currItem.el; 125 126 this.content.find( '.av-extra-modal-content, .av-extra-modal-markup' ).remove(); 127 128 if( current.data('av-extra-content') ) 129 { 130 var extra = current.data('av-extra-content'); 131 this.content.append( "<div class='av-extra-modal-content'>" + extra + "</div>" ); 132 } 133 134 if( current.data('av-extra-markup') ) 135 { 136 var markup = current.data('av-extra-markup'); 137 this.wrap.append( "<div class='av-extra-modal-markup'>" + markup + "</div>" ); 138 } 139 } 140 } 141 } 142 }, 143 144 145 $.fn.avia_activate_lightbox = function(variables) 146 { 147 148 var defaults = { 149 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'], 150 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"]', 151 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"]',
152 exclude : '.noLightbox, .noLightbox a, .fakeLightbox, .lightbox-added, a[href*="dropbox.com"]' 153 }, 154 155 options = $.extend({}, defaults, variables), 156 157 active = !$('html').is('.av-custom-lightbox'); 158 159 if(!active) return this; 160 161 return this.each(function() 162 { 163 var container = $(this), 164 videos = $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/ 165 ajaxed = !container.is('body') && !container.is('.ajax_slide'); 166 for (var i = 0; i < options.groups.length; i++) 167 { 168 container.find(options.groups[i]).each(function() 169 { 170 var links = $(options.autolinkElements, this); 171 if(ajaxed) links.removeClass('lightbox-added'); 172 links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); 173 }); 174 } 175 176 }); 177 }; 178})(jQuery); 179 180
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.