1function modula_pro_get_url_parameters(name) { 2 return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || false 3} 4 5(function( $ ){ 6 "use strict"; 7 8 function ModulaPRO( modula ) { 9 10 this.instance = modula; 11 this.filter = '*'; 12 this.hiddenItems = modula.$element.find( '.hidden-items .modula-hidden-item' ) 13 14 if ( this.instance.options.haveFilters ) { 15 this.initFilters(); 16 } 17 18 if ( 'fancybox' == this.instance.options['lightbox'] ) { 19 this.initLightbox(); 20 } 21 22 } 23 24 ModulaPRO.prototype.initLightbox = function () { 25 var self = this, 26 inst = self.instance; 27 28 inst.$element.on( 'click', '.modula-item-link:not( .modula-simple-link )', function(evt){ 29 30 evt.preventDefault(); 31 32 var items = inst.$items.filter( self.filter ).filter(':not( .modula-simple-link )'), 33 links = jQuery.map( items, function(o) { 34 var link = jQuery(o).find('.modula-item-link'), 35 image = jQuery(o).find('.pic'); 36 return { 'src' : link.attr( 'href' ), 'opts': { 'caption': link.data( 'caption' ), 'alt': image.attr( 'alt' ),'thumb':link.attr('data-thumb') } } 37 }); 38 39 if ( self.hiddenItems.length > 0 ) { 40 var hiddenLinks = jQuery.map( self.hiddenItems.filter( self.filter ), function(o) { 41 var link = jQuery(o); 42 return { 'src' : link.attr( 'href' ), 'opts': { 'caption': link.data( 'caption' ), 'alt': '','thumb':link.attr('data-thumb') } } 43 }); 44 45 links = links.concat( hiddenLinks ); 46 } 47 48 var index = items.index( jQuery(this).parents( '.modula-item' ) ); 49 50 inst.options.lightboxOpts['beforeLoad'] = function () { 51 jQuery(document).trigger('modula_fancybox_lightbox_before_load', [inst, this]); 52 }; 53 inst.options.lightboxOpts['afterLoad'] = function () { 54 jQuery(document).trigger('modula_fancybox_lightbox_after_load', [inst, this]); 55 }; 56 inst.options.lightboxOpts['beforeShow'] = function () { 57 jQuery(document).trigger('modula_fancybox_lightbox_before_show', [inst, this]); 58 }; 59 inst.options.lightboxOpts['afterShow'] = function () { 60 jQuery(document).trigger('modula_fancybox_lightbox_after_show', [inst, this]); 61 }; 62 inst.options.lightboxOpts['beforeClose'] = function () { 63 jQuery(document).trigger('modula_fancybox_lightbox_before_close', [inst, this]); 64 }; 65 inst.options.lightboxOpts['afterClose'] = function () { 66 jQuery(document).trigger('modula_fancybox_lightbox_after_close', [inst, this]); 67 }; 68 inst.options.lightboxOpts['onInit'] = function () { 69 jQuery(document).trigger('modula_fancybox_lightbox_on_init', [inst, this]); 70 }; 71 inst.options.lightboxOpts['onActivate'] = function () { 72 jQuery(document).trigger('modula_fancybox_lightbox_on_activate', [inst, this]); 73 }; 74 inst.options.lightboxOpts['onDeactivate'] = function () { 75 jQuery(document).trigger('modula_fancybox_lightbox_on_deactivate', [inst, this]); 76 }; 77 78 jQuery.modulaFancybox.open( links, inst.options.lightboxOpts, index ); 79 80 }); 81 82 } 83 84 ModulaPRO.prototype.initFilters = function () { 85 var self = this, 86 inst = self.instance; 87 88 if ( 'undefined' != typeof inst.options.defaultActiveFilter ) { 89 if ( 'All' == inst.options.defaultActiveFilter ) { 90 self.filter = '*'; 91 }else{ 92 self.filter = '.jtg-filter-' + inst.options.defaultActiveFilter; 93 } 94 } 95 96 // Check url to see if we have a filter 97 if ( '1' == inst.options.filterClick ) { 98 var urlFilter = modula_pro_get_url_parameters('jtg-filter'); 99 if ( urlFilter ) { 100 self.filter = '.jtg-filter-' + urlFilter; 101 } 102 } 103 104 inst.$element.on( 'click', '.filters a', function (e) { 105 106 if ('0' == inst.options.filterClick) { 107 e.preventDefault(); 108 }else{ 109 return true; 110 } 111 112 if ( jQuery(this).parent().hasClass( "menu__item--current" ) ) { 113 return; 114 } 115 116 self.filter = '.jtg-filter-' + jQuery(this).data('filter'); 117 118 inst.$element.find( '.filters .menu__item--current' ).removeClass( 'menu__item--current' ); 119 inst.$element.find(".filters a[data-filter='" + jQuery(this).attr('data-filter') + "']").parent().addClass( 'menu__item--current' ); 120 121 if ( inst.isIsotope ) { 122
123 inst.$items.removeClass( 'jtg-hidden' ); 124 inst.$items.not( self.filter ).addClass( 'jtg-hidden' ); 125 inst.reset(); 126 127 inst.$itemsCnt.modulaisotope({ filter: self.filter }); 128 }else{ 129 inst.$itemsCnt.justifiedGallery({ filter: self.filter }); 130 } 131 132 }); 133 134 inst.$element.find('.filter-by-wrapper').click(function () { 135 var wrapper = jQuery(this); 136 if (inst.$element.find('.filters').hasClass('active')) { 137 inst.$element.find('.filters').hide(600).removeClass('active'); 138 wrapper.removeClass('opened'); 139 } else { 140 inst.$element.find('.filters').show(600).addClass('active'); 141 wrapper.addClass('opened'); 142 } 143 }); 144 145 if ( '*' != self.filter && '' != self.filter ) { 146 if ( inst.isIsotope ) { 147 inst.$items.removeClass( 'jtg-hidden' ); 148 inst.$items.not( self.filter ).addClass( 'jtg-hidden' ); 149 inst.reset(); 150 151 inst.$itemsCnt.modulaisotope({ filter: self.filter }); 152 }else{ 153 inst.$itemsCnt.justifiedGallery({ filter: self.filter }); 154 } 155 } 156 157 } 158 159 $(document).on( 'modula_api_after_init', function ( event, inst ) { 160 new ModulaPRO( inst ); 161 }); 162 163})(jQuery); 164 165
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.