1/** 2 * Cookie plugin 3 * 4 * Copyright (c) 2006 Klaus Hartl (stilbuero.de) 5 * Dual licensed under the MIT and GPL licenses: 6 * http://www.opensource.org/licenses/mit-license.php 7 * http://www.gnu.org/licenses/gpl.html 8 * 9 */ 10 11jQuery.cookie = function (b, j, m) { 12 if (typeof j != "undefined") { 13 m = m || {}; 14 if (j === null) { 15 j = ""; 16 m.expires = -1; 17 } 18 var e = ""; 19 if (m.expires && (typeof m.expires == "number" || m.expires.toUTCString)) { 20 var f; 21 if (typeof m.expires == "number") { 22 f = new Date(); 23 f.setTime(f.getTime() + m.expires * 24 * 60 * 60 * 1000); 24 } else { 25 f = m.expires; 26 } 27 e = "; expires=" + f.toUTCString(); 28 } 29 var l = m.path ? "; path=" + m.path : ""; 30 var g = m.domain ? "; domain=" + m.domain : ""; 31 var a = m.secure ? "; secure" : ""; 32 document.cookie = [b, "=", encodeURIComponent(j), e, l, g, a].join(""); 33 } else { 34 var d = null; 35 if (document.cookie && document.cookie != "") { 36 var k = document.cookie.split(";"); 37 for (var h = 0; h < k.length; h++) { 38 var c = jQuery.trim(k[h]); 39 if (c.substring(0, b.length + 1) == b + "=") { 40 d = decodeURIComponent(c.substring(b.length + 1)); 41 break; 42 } 43 } 44 } 45 return d; 46 } 47}; 48 49/** 50 * Module to show Recently Viewed Products 51 * 52 * Copyright (c) 2014 Caroline Schnapp (11heavens.com) 53 * Dual licensed under the MIT and GPL licenses: 54 * http://www.opensource.org/licenses/mit-license.php 55 * http://www.gnu.org/licenses/gpl.html 56 * 57 */ 58 59var Shopify = Shopify || {}; 60 61Shopify.Products = (function () { 62 var a = { 63 howManyToShow: 4, 64 howManyToStoreInMemory: 10, 65 wrapperId: "recently-viewed-products", 66 templateId: "recently-viewed-product-template", 67 onComplete: null, 68 }; 69 var c = []; 70 var h = null; 71 var d = null; 72 var e = 0; 73 var productIds = []; // Create an array to store product IDs 74 var b = { 75 configuration: { expires: 90, path: "/", domain: window.location.hostname }, 76 name: "shopify_recently_viewed", 77 write: function (i) { 78 jQuery.cookie(this.name, i.join(" "), this.configuration); 79 }, 80 read: function () { 81 var i = []; 82 var j = jQuery.cookie(this.name); 83 if (j !== null) { 84 i = j.split(" "); 85 } 86 return i; 87 }, 88 destroy: function () { 89 jQuery.cookie(this.name, null, this.configuration); 90 }, 91 remove: function (k) { 92 var j = this.read(); 93 var i = jQuery.inArray(k, j); 94 if (i !== -1) { 95 j.splice(i, 1); 96 this.write(j); 97 } 98 }, 99 }; 100 var f = function () { 101 h.show(); 102 if (a.onComplete) { 103 try { 104 a.onComplete(); 105 } catch (i) {} 106 } 107 }; 108 109 // C ARRAY DE PRODUCTOS EN COOKIE 110 111 var g = function () { 112 if (c.length && e < a.howManyToShow) { 113 jQuery.ajax({ 114 dataType: "json", 115 url: "/products/" + c[1] + ".js", 116 cache: false, 117 success: function (i) { 118 const productID = i.id; 119 const productHandle = i.handle; 120 }, 121 error: function () { 122 b.remove(c[0]); 123 c.shift(); 124 g(); 125 }, 126 }); 127 } else { 128 f(); 129 } 130 }; 131 return { 132 resizeImage: function (m, j) { 133 if (j == null) { 134 return m; 135 } 136 if (j == "master") { 137 return m.replace(/http(s)?:/, ""); 138 } 139 var i = m.match( 140 /\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif|webp)(\?v=\d+)?/i 141 ); 142 if (i != null) { 143 var k = m.split(i[0]); 144 var l = i[0]; 145 return (k[0] + "_" + j + l).replace(/http(s)?:/, ""); 146 } else { 147 return null; 148 } 149 }, 150 showRecentlyViewed: function (i) { 151 var i = i || {}; 152 jQuery.extend(a, i); 153 c = b.read(); 154 d = jQuery("#" + a.templateId); 155 h = jQuery("#" + a.wrapperId); 156 a.howManyToShow = Math.min(c.length, a.howManyToShow); 157 if (a.howManyToShow && d.length && h.length) { 158 g(); 159 } 160 }, 161 getConfig: function () { 162 return a; 163 }, 164 clearList: function () { 165 b.destroy(); 166 }, 167 recordRecentlyViewed: function (l) { 168 var l = l || {}; 169 jQuery.extend(a, l); 170 var j = b.read(); 171 if (window.location.pathname.indexOf("/products/") !== -1) { 172 var k = window.location.pathname.match(/\/products\/([a-z0-9\-]+)/)[1]; 173 var i = jQuery.inArray(k, j); 174 if (i === -1) { 175 j.unshift(k); 176 j = j.splice(0, a.howManyToStoreInMemory); 177 } else { 178 j.splice(i, 1); 179 j.unshift(k); 180 } 181 b.write(j); 182 } 183 }, 184 getProductIds: function () { 185 return productIds; // Add a function to retrieve product IDs 186 }, 187 }; 188})(); 189var Shopify = Shopify || {}; 190 191// --------------------------------------------------------------------------- 192// Money format handler 193// --------------------------------------------------------------------------- 194Shopify.money_format = "{{amount}} â¬"; 195Shopify.formatMoney = function (cents, format) { 196 if (typeof cents == "string") { 197 cents = cents.replace(".", ""); 198 } 199 var value = ""; 200 var placeholderRegex = /\{\{\s*(\w+)\s*\}\}/; 201 var formatString = format || this.money_format; 202 203 function defaultOption(opt, def) { 204 return typeof opt == "undefined" ? def : opt; 205 } 206 207 function formatWithDelimiters(number, precision, thousands, decimal) { 208 precision = defaultOption(precision, 2); 209 thousands = defaultOption(thousands, ","); 210 decimal = defaultOption(decimal, ","); 211 212 if (isNaN(number) || number == null) { 213 return 0; 214 } 215 216 number = (number / 100.0).toFixed(precision); 217 218 var parts = number.split("."), 219 dollars = parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + thousands), 220 cents = parts[1] ? decimal + parts[1] : ""; 221 222 return dollars + cents; 223 } 224 225 switch (formatString.match(placeholderRegex)[1]) { 226 case "amount": 227 value = formatWithDelimiters(cents, 2); 228 break; 229 case "amount_no_decimals": 230 value = formatWithDelimiters(cents, 0); 231 break; 232 case "amount_with_comma_separator": 233 value = formatWithDelimiters(cents, 2, ".", ","); 234 break; 235 case "amount_no_decimals_with_comma_separator": 236 value = formatWithDelimiters(cents, 0, ".", ","); 237 break; 238 } 239 240 return formatString.replace(placeholderRegex, value); 241};
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.