1$(document).ready(function() { 2 oclayerednavigationajax.productViewChange(); 3 oclayerednavigationajax.paginationChangeAction(); 4}); 5 6var oclayerednavigationajax = { 7 8 /* Filter action */ 9 'filter' : function(filter_url) { 10 var old_route = 'route=product/category'; 11 var new_route = 'route=extension/module/oclayerednavigation/category'; 12 if(filter_url.search(old_route) != -1) { 13 filter_url = filter_url.replace(old_route, new_route); 14 } 15 16 if(filter_url.search(new_route) != -1) { 17 $.ajax({ 18 url : filter_url, 19 type : 'get', 20 beforeSend : function () { 21 $('.layered-navigation-block').show(); 22 $('.ajax-loader').show(); 23 }, 24 success : function(json) { 25 $('.filter-url').val(json['filter_action']); 26 $('.price-url').val(json['price_action']); 27 $('.custom-category').html(json['result_html']); 28 $('.layered').html(json['layered_html']); 29 oclayerednavigationajax.paginationChangeAction(); 30 oclayerednavigationajax.productViewChange(); 31 $('.layered-navigation-block').hide(); 32 $('.ajax-loader').hide(); 33 } 34 }); 35 } 36 37 }, 38 39 /* Use again and update ajaxComplete from common.js */ 40 'productViewChange' : function() { 41 // Product List 42 $('#list-view').click(function() { 43 $('#content .product-grid > .clearfix').remove(); 44 45 $('#content .row > .product-grid').attr('class', 'product-layout product-list col-xs-12'); 46 $('#grid-view').removeClass('active'); 47 $('#list-view').addClass('active'); 48 49 localStorage.setItem('display', 'list'); 50 }); 51 52 // Product Grid 53 $('#grid-view').click(function() { 54 var cols = $('#column-right, #column-left').length; 55 56 if (cols == 2) { 57 $('#content .product-list').attr('class', 'product-layout product-grid col-lg-6 col-md-6 col-sm-12 col-xs-12'); 58 } else if (cols == 1) { 59 $('#content .product-list').attr('class', 'product-layout product-grid col-lg-4 col-md-4 col-sm-6 col-xs-12'); 60 } else { 61 $('#content .product-list').attr('class', 'product-layout product-grid col-lg-3 col-md-3 col-sm-6 col-xs-12'); 62 } 63 64 $('#list-view').removeClass('active'); 65 $('#grid-view').addClass('active'); 66 67 localStorage.setItem('display', 'grid'); 68 }); 69 70 if (localStorage.getItem('display') == 'list') { 71 $('#list-view').trigger('click'); 72 $('#list-view').addClass('active'); 73 } else { 74 $('#grid-view').trigger('click'); 75 $('#grid-view').addClass('active'); 76 } 77 }, 78 79 /* Modify pagination links */ 80 paginationChangeAction: function () { 81 $('.custom-category .pagination a').each(function () { 82 var href = $(this).attr('href'); 83 $(this).attr('onclick', 'oclayerednavigationajax.filter("'+ href +'")'); 84 $(this).attr('href', 'javascript:void(0);'); 85 }); 86 } 87 88};
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.