1jQuery(document).ready(function($){ 2 $("#show-filters-link a").click(function(e){ 3 e.preventDefault(); 4 // hide this link 5 $("#show-filters-link").hide(); 6 // show the 'hide' link 7 $("#hide-filters-link").show(); 8 // show the filter div 9 $("#filter-options").show(); 10 // set a session variable for the choice 11 $.post("/products/set_browse_filter_option/show"); 12 }); 13 14 $("#hide-filters-link a").click(function(e){ 15 e.preventDefault(); 16 // hide this link 17 $("#hide-filters-link").hide(); 18 // show the 'show' link 19 $("#show-filters-link").show(); 20 // hide the filter div 21 $("#filter-options").hide(); 22 // set a session variable for the choice 23 $.post("/products/set_browse_filter_option/hide"); 24 }); 25 26 $("#perpage").change(function(){ 27 var per_page = $(this).val(); 28 29 // display a message 30 $("#results").html('<div class="msg-processing"><img src="/images/loading.gif" width="18" height="18" border="0" alt="" style="vertical-align: text-bottom;" /> Setting Pagination ...</div>'); 31 32 $.ajax({
33 type: "POST", 34 url: '/products/set_browse_pagination/'+per_page, 35 success: function(response) { 36 // remove the message 37 $("#results").html(''); 38 39 // refresh the products 40 refresh_products(); 41 } 42 }); 43 }); 44 45 $("#sortby").change(function(){ 46 var sort_by = $(this).val(); 47 48 // display a message 49 $("#results").html('<div class="msg-processing"><img src="/images/loading.gif" width="18" height="18" border="0" alt="" style="vertical-align: text-bottom;" /> Setting Sorting ...</div>'); 50 51 $.ajax({ 52 type: "POST", 53 url: '/products/set_browse_sorting/'+sort_by, 54 success: function(response) { 55 // remove the message 56 $("#results").html(''); 57 58 // refresh the products 59 refresh_products(); 60 } 61 }); 62 }); 63 64 $("#browse-filter select").change(function(){ 65 // display a message 66 $("#results").html('<div class="msg-processing"><img src="/images/loading.gif" width="18" height="18" border="0" alt="" style="vertical-align: text-bottom;" /> Setting Filters ...</div>'); 67 68 $.ajax({
69 type: "POST", 70 url: '/products/set_browse_filters/', 71 data: $("#browse-filter").serialize(), 72 success: function(response) { 73 // remove the message 74 $("#results").html(response); 75 76 // refresh the products 77 refresh_products(); 78 } 79 }); 80 }); 81 82 $("#browse-filter input[type='radio']").change(function(){ 83 // display a message 84 $("#results").html('<div class="msg-processing"><img src="/images/loading.gif" width="18" height="18" border="0" alt="" style="vertical-align: text-bottom;" /> Setting Filters ...</div>'); 85 86 $.ajax({ 87 type: "POST", 88 url: '/products/set_browse_filters/', 89 data: $("#browse-filter").serialize(), 90 success: function(response) { 91 // remove the message 92 $("#results").html(response); 93 94 // refresh the products 95 refresh_products(); 96 } 97 }); 98 }); 99 100 // initialize the pagination links 101 initialize_pagination_links(); 102}); 103 104/** 105 * Sets up the jQuery actions for the pagination links. 106 */ 107function initialize_pagination_links() 108{ 109 jQuery("div.pagination a").click(function(e){ 110 e.preventDefault(); 111 112 var link = jQuery(this).attr("href"); 113 link = link.replace('browse', 'refresh_browse_list'); 114 load_browse_page(link); 115 }); 116} 117 118/** 119 * Loads a product browse page. 120 * @param string - url - The url to load the product browse page (including pagination). 121 */ 122function load_browse_page(url) 123{ 124 // set the processing message 125 $("#product-list").html('<div class="msg-loading">Loading Products ...<br /><br /><img src="/images/jquery.thickbox.loading.gif" width="208" height="13" border="0" alt="" style="vertical-align: text-bottom;" /></div>'); 126 127 jQuery.ajax({ 128 type: "POST", 129 url: url, 130 success: function(response) { 131 jQuery("#product-list").html(response); 132 133 // initialize the pagination links 134 initialize_pagination_links(); 135 } 136 }); 137} 138 139/** 140 * Refreshes the product listing on the browse page. 141 */ 142function refresh_products() 143{ 144 // set the processing message 145 $("#product-list").html('<div class="msg-loading">Loading Products ...<br /><br /><img src="/images/jquery.thickbox.loading.gif" width="208" height="13" border="0" alt="" style="vertical-align: text-bottom;" /></div>'); 146 147 // set the url and process the form (via ajax) 148 var url = '/products/refresh_browse_list/'; 149 $.post(url, '', refresh_products_callback); 150} 151 152/** 153 * The callback function for refresh_products(). Puts the product list into the appropriate container and sets up the pagination link actions. 154 * @param string - response - The response from the refresh_products() call. 155 */ 156function refresh_products_callback(response) 157{ 158 $("#product-list").html(response); 159 160 // initialize the pagination links 161 initialize_pagination_links(); 162}
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.