1jQuery(function($) { 2 3 var wpa_block_list_drag = false; 4 document.addEventListener( 5 'mousedown', () => wpa_block_list_drag = false 6 ); 7 8 document.addEventListener( 9 'mousemove', () => wpa_block_list_drag = true 10 ); 11 12 $(".wpa-block-list-results > .wpa-result-item").on("click", function(e) { 13 if(!wpa_block_list_drag) { 14 window.location = $(this).find(".wpa-result-link").attr("href"); 15 } 16 }); 17 $(".wpa-block-list-results > .wpa-result-item").on("auxclick", function(e) { 18 if(!wpa_block_list_drag) { 19 window.location = $(this).find(".wpa-result-link").attr("href"); 20 } 21 }); 22 23 $(".wpa-block-list-results > .wpa-result-item").addClass("atw-cursor-pointer"); 24 25 $(".js-wpa-filters > button").on("click", function(e) { 26 e.preventDefault(); 27 if($("#js-wpa-filters-wrap").hasClass("wpadverts-hidden")) { 28 // show 29 $("#js-wpa-filters-wrap").removeClass("wpadverts-hidden"); 30 if($("#reveal_hidden").length < 1) { 31 var rh = $('<input type="hidden" name="reveal_hidden" id="reveal_hidden" value="1" />'); 32 $(".wpadverts-block-search .wpadverts-form").prepend(rh); 33 } 34 } else { 35 // hide 36 $("#js-wpa-filters-wrap").addClass("wpadverts-hidden"); 37 $("#reveal_hidden").remove(); 38 39 } 40 return false; 41 }); 42 if($("#reveal_hidden").length > 0) { 43 $("#js-wpa-filters-wrap").removeClass("wpadverts-hidden"); 44 } 45 46 $("#js-wpa-sort").on("click", function(e) { 47 e.preventDefault(); 48 $("#js-wpa-sort-options").toggle(); 49 return false; 50 }); 51 52}); 53 54var WPADVERTS = WPADVERTS || {}; 55 56WPADVERTS.GridGallery = function(item) { 57 var $item = jQuery(item); 58 59 this.slider = tns({ 60 container: "#" + $item.find('.wpa-grid-gallery-slider').attr("id"), 61 items: 1, 62 slideBy: 1, 63 autoplay: false, 64 mouseDrag: true, 65 center: false, 66 controls: false, 67 nav: false, 68 lazyload: $item.hasClass("wpa-slider-is-lazy"), 69 lazyloadSelector: ".wpa-lazy-img" 70 }); 71 72 this.prev = $item.find(".wpa-grid-gallery-left-btn"); 73 this.next = $item.find(".wpa-grid-gallery-right-btn"); 74 75 this.current = $item.find(".wpa-grid-gallery-current"); 76 77 this.slider.events.on('indexChanged', jQuery.proxy(this.IndexChanged, this)); 78 79 this.prev.on("click", jQuery.proxy(this.PrevClick, this)); 80 this.next.on("click", jQuery.proxy(this.NextClick, this)); 81 82 this.circles = $item.find(".wpa-block-gallery-circles .wpa-block-gallery-circle"); 83 84 this.PaginationVis(); 85 this.HandleCircles(); 86}; 87 88WPADVERTS.GridGallery.prototype.PrevClick = function(e) { 89 e.preventDefault(); 90 e.stopPropagation(); 91 this.slider.goTo("prev"); 92}; 93 94WPADVERTS.GridGallery.prototype.NextClick = function(e) { 95 e.preventDefault(); 96 e.stopPropagation(); 97 this.slider.goTo("next"); 98}; 99 100WPADVERTS.GridGallery.prototype.IndexChanged = function(e) { 101 this.current.text(this.slider.getInfo().displayIndex); 102 this.PaginationVis(); 103 this.HandleCircles(); 104}; 105 106WPADVERTS.GridGallery.prototype.PaginationVis = function() { 107 if(this.slider.getInfo().displayIndex === 1) { 108 this.prev.hide(); 109 } else { 110 this.prev.show(); 111 } 112 113 if(this.slider.getInfo().displayIndex === this.slider.getInfo().slideCount) { 114 this.next.hide(); 115 } else { 116 this.next.show(); 117 } 118}; 119 120WPADVERTS.GridGallery.prototype.HandleCircles = function() { 121 if(this.circles.length === 0) { 122 return; 123 } 124 125 this.circles.removeClass("wpa-circle-current"); 126 this.circles.removeClass("wpa-circle"); 127 this.circles.removeClass("wpa-circle-sm"); 128 this.circles.removeClass("wpa-circle-xs"); 129 130 var index = this.slider.getInfo().displayIndex; 131 132 133 jQuery.each(this.circles, function(i, item) { 134 var $item = jQuery(item); 135 var distance = (i+1) - index; 136 var viewport = 3; 137 var visible = []; 138 139 for(var j=0; j<viewport; j++) { 140 visible.push(index+j); 141 } 142 143 console.log(visible); 144 $item.addClass("wpa-circle"); 145 146 if(distance == 0) { 147 // current 148 $item.addClass("wpa-circle-current"); 149 150 } 151 152 153 154 /* 155 if(distance == 0) { 156 // current 157 $item.addClass("wpa-circle-current"); 158 159 } else if(distance == -1 || distance == 1) { 160 // next to the current 161 $item.removeClass("wpa-circle-current"); 162 $item.addClass("wpa-circle"); 163 } else if(distance == -2 || distance == 2) { 164 $item.removeClass("wpa-circle-current"); 165 $item.addClass("wpa-circle-sm"); 166 // small 167 } else if(distance == -3 || distance == -3) { 168 $item.removeClass("wpa-circle-current"); 169 $item.addClass("wpa-circle-xs"); 170 } else { 171 $item.removeClass("wpa-circle-current"); 172 $item.addClass("wpa-circle-xs"); 173 } 174 */ 175 }); 176 177}; 178 179jQuery(function($) { 180 if($(".wpa-grid-gallery-slider-wrap").length > 0) { 181 $(".wpa-grid-gallery-slider-wrap").each(function(index, item) { 182 new WPADVERTS.GridGallery(item); 183 }); 184 } 185});
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.