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 $.magnificPopup.instance.prev = function() { 83 var self = this; 84 self.wrap.removeClass('mfp-image-loaded'); 85 setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); 86 } 87 88 //add custom css class for different styling 89 if( this.st.el && this.st.el.data('av-extra-class') ) 90 { 91 this.wrap.addClass( this.currItem.el.data('av-extra-class') ); 92 } 93 94 95 }, 96 imageLoadComplete: function() 97 { 98 var self = this; 99 setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16); 100 }, 101 change: function() { 102 103 if( this.currItem.el ) 104 { 105 var current = this.currItem.el; 106 107 this.content.find( '.av-extra-modal-content, .av-extra-modal-markup' ).remove(); 108 109 if( current.data('av-extra-content') ) 110 { 111 var extra = current.data('av-extra-content'); 112 this.content.append( "<div class='av-extra-modal-content'>" + extra + "</div>" ); 113 } 114 115 if( current.data('av-extra-markup') ) 116 { 117 var markup = current.data('av-extra-markup'); 118 this.wrap.append( "<div class='av-extra-modal-markup'>" + markup + "</div>" ); 119 } 120 } 121 }, 122 } 123 }, 124 125 126 $.fn.avia_activate_lightbox = function(variables) 127 { 128 129 var defaults = { 130 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'], 131 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"]', 132 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"]',
133 exclude : '.noLightbox, .noLightbox a, .fakeLightbox, .lightbox-added, a[href*="dropbox.com"]', 134 }, 135 136 options = $.extend({}, defaults, variables), 137 138 active = !$('html').is('.av-custom-lightbox'); 139 140 if(!active) return this; 141 142 return this.each(function() 143 { 144 var container = $(this), 145 videos = $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/ 146 ajaxed = !container.is('body') && !container.is('.ajax_slide'); 147 for (var i = 0; i < options.groups.length; i++) 148 { 149 container.find(options.groups[i]).each(function() 150 { 151 var links = $(options.autolinkElements, this); 152 if(ajaxed) links.removeClass('lightbox-added'); 153 links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); 154 }); 155 } 156 157 }); 158 } 159})(jQuery); 160 161
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.