1/*! 2 * jQuery ListingSwitch 3 * 4 * @version 1.0.0 5 * 6 */ 7jQuery(document).ready(function () { 8 var listing = jQuery(".product-listing-switch"), 9 buttons = {}, 10 switcher, 11 keks = { 12 key: 'ListingSwitch', 13 value: false 14 }, 15 switchTo; 16 17 if (listing.length) { 18 switcher = jQuery(".listing-switch"); 19 if (switcher.length) { 20 21 // init 22 switcher.removeClass('hidden'); 23 keks.value = esseKeks(keks.key); 24 switchTo = function (from, to) { 25 listing.removeClass('product-listing-' + from); 26 listing.addClass('product-listing-' + to).addClass('switch-active'); 27 keks.value = to; 28 }; 29 buttons = { 30 'v1': switcher.find(".v1"), 31 'v2': switcher.find(".v2"), 32 'all': switcher.find(".btn") 33 }; 34 35 // switch to listing by cookie setting 36 if (keks.value) { 37 if (keks.value == 'v1') { 38 switchTo('v2', 'v1'); 39 } else if (keks.value == 'v2') { 40 switchTo('v1', 'v2'); 41 } 42 } 43 44 // highlight active button 45 if (listing.hasClass('product-listing-v1')) { 46 buttons.all.removeClass('active'); 47 buttons.v1.addClass('active'); 48 } else if (listing.hasClass('product-listing-v2')) { 49 buttons.all.removeClass('active'); 50 buttons.v2.addClass('active'); 51 } 52 53 // switch to listing by button press 54 buttons.all.click(function () { 55 var self = jQuery(this); 56 if (!self.hasClass('active')) { 57 buttons.all.removeClass('active'); 58 self.addClass('active'); 59 if (self.hasClass('v1')) { 60 switchTo('v2', 'v1'); 61 } else if (self.hasClass('v2')) { 62 switchTo('v1', 'v2'); 63 } 64 equalizeListingHeights(".products"); 65 backeKeks(keks.key, keks.value, 365); 66 } else { 67 self.blur(); 68 } 69 }); 70 } 71 } 72});
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.