1/** 2 * Petr HladÃk <[email protected]> 3 * PÅevod xeditorpopupu a popupu galerie na magnific - aktualizace popupu 4 * 2016-07-04 5 */ 6 7 8// safari fix 9/*(function($){ 10 11 $(window).load(function() { 12 13 // pÅevÄ xeditorpopup 14 convertXEditorpopupToMagnific(); 15 16 // pÅeveÄ xGalerii 17 convertXGalleryToMagnific(); 18 19 // init magnific 20 initMagnific($); 21 22 }); 23})(jQuery);*/ 24 25 26jQuery(document).ready(function($){ 27 28 // pÅevÄ xeditorpopup 29 convertXEditorpopupToMagnific(); 30 31 // pÅeveÄ xGalerii 32 convertXGalleryToMagnific(); 33 34 // init magnific 35 initMagnific($); 36 37}); 38 39 40 41/** 42 * pÅevede xeditorpopup na magnific 43 * 44 * @return 45 */ 46function convertXEditorpopupToMagnific() 47{ 48 (function($) { 49 $('a.xeditorpopup, a.magnific').each(function(index, el) { 50 var i = $(this); 51 52 // pÅevod tÅÃdy xeditorpopup na magnific 53 i.removeClass('xeditorpopup').addClass('magnific'); 54 55 // pÅevod parametrů xeditoru na magnific 56 var rel = i.attr('rel'); 57 58 rel = (typeof rel != 'undefined')? i.attr('data-mediabox') : rel + ";" + i.attr('data-mediabox'); 59 60 61 if (typeof rel != 'undefined') 62 { 63 rel = rel.split(';'); 64 $.each( rel, function( key, value ) { 65 value = value.replace(']', '').split('['); 66 if (value.length == 2) 67 { 68 i.attr('data-' + value[0], value[1]); 69 } 70 }); 71 } 72 73 // skupina obrázků 74 i.attr('rel', i.attr('data-group')); 75 76 // zarovnánà 77 if (i.find('img').hasClass('img-right')) 78 { 79 i.css('float', 'right'); 80 } 81 }); 82 })(jQuery); 83 return; 84} 85 86 87/** 88 * pÅevede xGalerii na magnific 89 * 90 * @return 91 */ 92function convertXGalleryToMagnific() 93{ 94 (function($) { 95 $('.gall_items').each(function(index, el) { 96 $(this).prop('id', ''); 97 98 // projdi vÅ¡echny gal_item 99 $(this).find('.gall_item').each(function(index, el) { 100 $a = $(this).find('a'); 101 $a.addClass('magnific'); 102 $a.off(); 103 }); 104 105 }); 106 })(jQuery); 107 return; 108} 109 110 111/** 112 * inicializuje magnific 113 * 114 * @param {function} $ objekt jQuery 115 * 116 * @return 117 */ 118function initMagnific($) 119{ 120 $('.magnific').off(); 121 $('.magnific').magnificPopup({ 122 123 type: 'image', 124 mainClass: 'magnific-popup mfp-zoom-in', 125 tLoading: '', 126 tClose: '', 127 removalDelay: 300, //delay removal by X to allow out-animation 128 closeBtnInside: true, 129 closeOnContentClick:true, 130 midClick: true, 131 fixedContentPos: false, // allows scrolling when lightbox is open but also removes any jumping because of scrollbar removal 132 133 image: { 134 titleSrc: function(item){ 135 var title = item.el.attr('data-caption'); 136 if(!title) title = item.el.find('img').attr('data-caption'); 137 if(typeof title == "undefined") return ""; 138 return title; 139 } 140 }, 141 142 gallery: { 143 // delegate: options.autolinkElements, 144 tPrev: '', 145 tNext: '', 146 tCounter: '%curr% / %total%', 147 enabled: true, 148 preload: [1,1] // Will preload 1 - before current, and 1 after the current image 149 }, 150 151 callbacks: 152 { 153 open: function() 154 { 155 //overwrite default prev + next function. Add timeout for css3 crossfade animation 156 $.magnificPopup.instance.next = function() { 157 var self = this; 158 self.wrap.removeClass('mfp-image-loaded'); 159 setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); 160 } 161 $.magnificPopup.instance.prev = function() { 162 var self = this; 163 self.wrap.removeClass('mfp-image-loaded'); 164 setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); 165 } 166 }, 167 imageLoadComplete: function() 168 { 169 var self = this; 170 setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16); 171 } 172 } 173 }); 174 return; 175}
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.