1/*! 2 * jQuery ListingSwitch 3 * 4 * @version 1.0.0 5 * @copyright 8works <[email protected]> 6 * @author Jens Albert 7 * 8 * Don't change anything from here on 9 * if you don't know what you're doing. 10 * Otherwise the earth might disappear 11 * in a large black hole. We'll blame you! 12 */ 13jQuery(document).ready(function () { 14 var listing = jQuery(".product-listing-switch"), 15 buttons = {}, 16 switcher, 17 keks = { 18 key: 'ListingSwitch', 19 value: false 20 }, 21 switchTo; 22 23 if (listing.length) { 24 switcher = jQuery(".listing-switch"); 25 if (switcher.length) { 26 27 // init 28 switcher.removeClass('hidden'); 29 keks.value = esseKeks(keks.key); 30 switchTo = function (from, to) { 31 listing.removeClass('product-listing-' + from); 32 listing.addClass('product-listing-' + to).addClass('switch-active'); 33 keks.value = to; 34 }; 35 buttons = { 36 'v1': switcher.find(".v1"), 37 'v2': switcher.find(".v2"), 38 'all': switcher.find(".btn") 39 }; 40 41 // switch to listing by cookie setting 42 if (keks.value) { 43 if (keks.value == 'v1') { 44 switchTo('v2', 'v1'); 45 } else if (keks.value == 'v2') { 46 switchTo('v1', 'v2'); 47 } 48 } 49 50 // highlight active button 51 if (listing.hasClass('product-listing-v1')) { 52 buttons.all.removeClass('active'); 53 buttons.v1.addClass('active'); 54 } else if (listing.hasClass('product-listing-v2')) { 55 buttons.all.removeClass('active'); 56 buttons.v2.addClass('active'); 57 } 58 59 // switch to listing by button press 60 buttons.all.click(function () { 61 var self = jQuery(this); 62 if (!self.hasClass('active')) { 63 buttons.all.removeClass('active'); 64 self.addClass('active'); 65 if (self.hasClass('v1')) { 66 switchTo('v2', 'v1'); 67 } else if (self.hasClass('v2')) { 68 switchTo('v1', 'v2'); 69 } 70 equalizeListingHeights(".products"); 71 backeKeks(keks.key, keks.value, 365); 72 } else { 73 self.blur(); 74 } 75 }); 76 } 77 } 78});
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.