1$(document).ready(function () { 2 if(localStorage.getItem('type') == null) { 3 var type = $('#category-view-type').val(); 4 var cols = $('#category-grid-cols').val(); 5 6 if(type == "list") { 7 category_view.initView(type, cols, 'btn-list'); 8 } 9 10 if(type == 'grid') { 11 category_view.initView(type, cols, 'btn-grid-' + cols); 12 } 13 } else { 14 var type = localStorage.getItem('type'); 15 var cols = localStorage.getItem('cols'); 16 var element = localStorage.getItem('element'); 17 18 category_view.initView(type, cols, element); 19 } 20}); 21 22var category_view = { 23 'initView' : function (type, cols, element) { 24 category_view.changeView(type, cols, element); 25 }, 26 27 'changeView' : function (type, cols, element) { 28 if(type == "grid") { 29 $('.custom-products').removeClass('custom-products-row'); 30 $(this).addClass('selected'); 31 $('.btn-list').removeClass('selected'); 32 $('#content .custom-products .product-grid .caption').removeClass('col-md-8 col-sm-8 col-sms-12'); 33 $('#content .custom-products .product-grid .images-container').removeClass('col-md-4 col-sm-4 col-sms-12'); 34 var column = parseInt(cols); 35 if(column == 2) { 36 $('#content .product-item').attr('class', 'product-layout product-grid module-style1 col-lg-6 col-md-6 col-sm-6 col-xs-6 product-item two-item'); 37 } 38 if(column == 3) { 39 $('#content .product-item').attr('class', 'product-layout product-grid module-style1 col-lg-4 col-md-4 col-sm-4 col-sms-12 product-item three-item'); 40 } 41 if(column == 4) { 42 $('#content .product-item').attr('class', 'product-layout product-grid module-style1 col-lg-3 col-md-3 col-sm-3 col-sms-12 product-item four-item'); 43 } 44 if(column == 5) { 45 $('#content .product-item').attr('class', 'product-layout product-grid module-style1 col-lg-divide-5 col-md-divide-5 col-sm-6 col-sms-12 product-item five-item'); 46 } 47 } 48 49 if(type == "list") { 50 $('#content .product-item').attr('class', 'product-layout product-list col-xs-6 product-item'); 51 $('.custom-products').addClass('custom-products-row'); 52 $(this).addClass('selected'); 53 $('.btn-grid').removeClass('selected'); 54 $('#content .custom-products-row .product-list .caption').addClass('col-md-8 col-sm-8 col-sms-12'); 55 $('#content .custom-products-row .product-list .images-container').addClass('col-md-3 col-sm-4 col-sms-12'); 56 } 57 58 $('.btn-custom-view').removeClass('active'); 59 $('.' + element).addClass('active'); 60 61 localStorage.setItem('type', type); 62 localStorage.setItem('cols', cols); 63 localStorage.setItem('element', element); 64 } 65}
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.