1jQuery(document).ready( function($) { 2 3 4 function setCookie(cname, cvalue, exdays) { 5 var d = new Date(); 6 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 7 var expires = "expires="+d.toUTCString(); 8 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 9} 10 11function getCookie(cname) { 12 var name = cname + "="; 13 var ca = document.cookie.split(';'); 14 for(var i = 0; i < ca.length; i++) { 15 var c = ca[i]; 16 while (c.charAt(0) == ' ') { 17 c = c.substring(1); 18 } 19 if (c.indexOf(name) === 0) { 20 return c.substring(name.length, c.length); 21 } 22 } 23 return ""; 24} 25 26function checkMobile() { 27 var check = false; 28 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); 29 return check; 30}; 31 32/*function checkCookie() { 33 var user = getCookie("username"); 34 console.log(user); 35 if (user !== "") { 36 37 if (user === "visted"){ 38 $('.sticky_footer').hide(); 39 } 40 41 } else { 42 user = "visted"; 43 if (user !== "" && user !== null) { 44 45 } 46 setTimeout( 47 function() 48 { 49 if($(window).width() > 768 && $(window).height() > 850 && !checkMobile()){ 50 //$('.newsletter_popup__mask').show(); 51 setCookie("username", user, 365); 52 } 53 }, 20000); 54 55 } 56} 57 58checkCookie();*/ 59 60 /* Sticky Footer Cookies */ 61 62 $( ".sticky_footer__close" ).click(function(){ 63 var match = $(this).attr("class"); 64 65 Cookies.set('Newsletter', match, { expires: 60, path: '/' }); 66 Cookies.get(); 67 }); 68 69 var cookies = Cookies("Newsletter"); 70 //console.log(cookies); 71 if (cookies == null) { 72 $('.sticky_footer').removeClass('hidden'); 73 } else { 74 // do nothing 75 } 76 77 $('.sticky_footer__close').on('click',function(){ 78 $('.sticky_footer').hide(); 79 }); 80 81 /* Newsletter Popup Cookies */ 82 83 /*$( ".newsletter_popup__close" ).click(function(){ 84 var match = $(this).attr("class"); 85 86 Cookies.set('Popup', match, { expires: 60, path: '/' }); 87 Cookies.get(); 88 }); 89 90 var cookies = Cookies("Popup"); 91 console.log(cookies); 92 if (cookies == null) { 93 $('.newsletter_popup__mask').removeClass('hidden'); 94 } else { 95 // do nothing 96 } 97 98 $('.newsletter_popup__close').on('click',function(){ 99 $('.newsletter_popup__mask').hide(); 100 //$('.sticky_footer').hide(); 101 102 });*/ 103 104 $('#site-nav--toggle').click(function(){ 105 $('#site-nav--menu').toggle(); 106 }); 107 108 $(".slider").owlCarousel({ 109 // items: 2, 110 singleItem: true, 111 navigation: true, 112 autoPlay: 5000, 113 navigationText: ['<span class="fa fa-angle-left"></span>','<span class="fa fa-angle-right"></span>'] 114 }); 115 116 $("#expert_slider").owlCarousel({ 117 // items: 2, 118 singleItem: true, 119 navigation: true, 120 pagination: false, 121 transitionStyle : "fade", 122 stopOnHover: true, 123 autoPlay: 2500, 124 navigationText: ['<span class="fa fa-angle-left"></span>','<span class="fa fa-angle-right"></span>'] 125 }); 126 127 var $container2 = $('.product-groups').imagesLoaded( function() { 128 // init 129 $container2.isotope({ 130 // options 131 itemSelector: '.product-group', 132 layoutMode: 'fitRows' 133 }); 134 }); 135 136 $('product--filters .all').click(function() { 137 $('.selected').removeClass('selected'); 138 $(this).toggleClass('selected'); 139 $container2.isotope({ filter: '*'}); 140 }); 141 142 // store filter for each group 143 var filters = {}; 144 145 function getUrlParameter( sParam ) { 146 var sPageURL = window.location.search.substring(1); 147 var sURLVariables = sPageURL.split('&'); 148 for (var i = 0; i < sURLVariables.length; i++) { 149 var sParameterName = sURLVariables[i].split('='); 150 if (sParameterName[0] == sParam) { 151 return sParameterName[1]; 152 } 153 } 154 } 155 156 /* Load products and recipies with filters from URL */ 157 var tech = getUrlParameter('filter'); 158 if ($('.'+tech)){ 159 160 $(window).on('load', function(){ 161 162 $('.product--filters--type a.'+tech+', .product--filters--package a.'+tech+', .product--filters--consumer a.'+tech).trigger('click'); 163 }); 164 165 } 166 167 $( function() { 168 // quick search regex 169 var qsRegex; 170 var buttonFilter; 171 172 // init Isotope 173 var $container2 = $('.product-groups').isotope({ 174 itemSelector: '.product-group', 175 layoutMode: 'fitRows', 176 filter: function() { 177 var $this = $(this); 178 var searchResult = qsRegex ? $this.text().match( qsRegex ) : true; 179 var buttonResult = buttonFilter ? $this.is( buttonFilter ) : true; 180 return searchResult && buttonResult; 181 } 182 }); 183 184 $('.product--filters--type, .product--filters--package, .product--filters--consumer').on( 'click', 'a', function() { 185 buttonFilter = $( this ).attr('data-filter'); 186 $container2.isotope(); 187 $('.selected').removeClass('selected'); 188 $(this).toggleClass('selected'); 189 190 }); 191
192 // use value of search field to filter 193 var $quicksearch = $('#quicksearch').keyup( debounce( function() { 194 qsRegex = new RegExp( $quicksearch.val(), 'gi' ); 195 $container2.isotope(); 196 }) ); 197 }); 198 199 $( function() { 200 // quick search regex 201 var qsRegex; 202 var buttonFilter; 203 204 // init Isotope 205 var $container = $('.recipe-box').imagesLoaded( function() { 206 $container.isotope({ 207 itemSelector: '.recipe--list-item', 208 layoutMode: 'fitRows', 209 filter: function() { 210 211 var $this = $(this); 212 var searchResult = qsRegex ? $this.text().match( qsRegex ) : true; 213 var buttonResult = buttonFilter ? $this.is( buttonFilter ) : true; 214 return searchResult && buttonResult; 215 } 216 }); 217 }); 218 219 220 221 222 // store filter for each group 223 var filters = {}; 224 225 $('.recipe--filters--meal, .recipe--filters--time').on( 'click', 'a', function() { 226 $(this).siblings('a').removeClass('selected'); 227 $(this).addClass('selected'); 228 229 var $this = $(this); 230 // get group key 231 var $buttonGroup = $this.parents('.button-group'); 232 233 var filterGroup = $buttonGroup.attr('data-filter-group'); 234 // set filter for group 235 236 filters[ filterGroup ] = $this.attr('data-filter'); 237 // combine filters 238 var filterValue = ''; 239 for ( var prop in filters ) { 240 filterValue += filters[ prop ]; 241 } 242 buttonFilter = filterValue; 243 // set filter for Isotope 244 $container.isotope(); 245 }); 246 247 // use value of search field to filter 248 var $quicksearch = $('#quicksearch').keyup( debounce( function() { 249 qsRegex = new RegExp( $quicksearch.val(), 'gi' ); 250 $container.isotope(); 251 }) ); 252 // change is-checked class on buttons 253 254}); 255 256 // debounce so filtering doesn't happen every millisecond 257 function debounce( fn, threshold ) { 258 var timeout; 259 return function debounced() { 260 if ( timeout ) { 261 clearTimeout( timeout ); 262 } 263 function delayed() { 264 fn(); 265 timeout = null; 266 } 267 setTimeout( delayed, threshold || 100 ); 268 }; 269 } 270 271 $('.nutrition-toggle').click(function(){ 272 $('.product-desc--nutrition').toggleClass('open closed'); 273 }); 274 275 276 // Check if there is a hash in url, click the filter button, remove hidden class from products list 277 // if($('body').hasClass('post-type-archive-product') && window.location.hash) { 278 279 // var hash = window.location.hash.substring(1); 280 // setTimeout(function() { 281 // $('.product--filters--consumer > a[data-filter=".'+hash+'"]').click(); 282 // setTimeout(function() { 283 // }, 200); 284 // }, 100); 285 286 // } 287 288});
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.