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 } 25 else{ 26 f=m.expires 27 } 28 e="; expires="+f.toUTCString() 29 } 30 var l=m.path?"; path="+(m.path):""; 31 var g=m.domain?"; domain="+(m.domain):""; 32 var a=m.secure?"; secure":""; 33 34 document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("") 35 } 36 else{ 37 var d=null; 38 if(document.cookie&&document.cookie!=""){ 39 var k=document.cookie.split(";"); 40 for(var h=0;h<k.length;h++){ 41 var c=jQuery.trim(k[h]); 42 if(c.substring(0,b.length+1)==(b+"=")){ 43 d=decodeURIComponent(c.substring(b.length+1)); 44 break 45 } 46 } 47 } 48 return d 49 } 50}; 51 52/* 53 * Currency tools 54 * 55 * Copyright (c) 2013 Caroline Schnapp ([email protected]) 56 * Licensed under the MIT license: 57 * http://www.opensource.org/licenses/mit-license.php 58 * 59 */ 60 61if(typeof Currency==="undefined"){
62 var Currency={} 63} 64 65Currency.cookie={ 66 configuration:{ 67 expires:365, 68 path:"/", 69 domain:window.location.hostname 70 }, 71 name:"currency", 72 write:function(a){ 73 jQuery.cookie(this.name,a,this.configuration) 74 }, 75 read:function(){ 76 return jQuery.cookie(this.name) 77 }, 78 destroy:function(){ 79 jQuery.cookie(this.name,null,this.configuration) 80 } 81}; 82 83Currency.money_with_currency_format={ 84}; 85 86Currency.money_format={ 87}; 88 89Currency.formatMoney=function(b,f,h,i){ 90 if(typeof b=="string"){ 91 b=b.replace(".","") 92 } 93 var e=""; 94 var d=/\{\{\s*(\w+)\s*\}\}/; 95 var a=(f||this.money_format); 96 function c(g){ 97 g += ''; 98 x = g.split('.'); 99 x1 = x[0]; 100 x2 = x.length > 1 ? '.' + x[1] : ''; 101 var rgx = /(\d+)(\d{3})/; 102 while (rgx.test(x1)) { 103 x1 = x1.replace(rgx, '$1' + ',' + '$2'); 104 } 105 x1 = x1.replace(/,/g, i); 106 return x1 + x2; 107 } 108 109 switch(a.match(d)[1]){ 110 case"amount": 111 e=c(floatToString(b/100,h)); 112 break; 113 114 case"amount_no_decimals": 115 e=c(floatToString(b/100,0)); 116 break; 117 118 case"amount_with_comma_separator": 119 e=floatToString(b/100,2).replace(/\./,","); 120 break; 121 122 case"amount_no_decimals_with_comma_separator": 123 e=c(floatToString(b/100,0)).replace(/\./,","); 124 break 125 } 126 127 return a.replace(d,e) 128}; 129 130function floatToString(c,a){ 131 var b=c.toFixed(a).toString(); 132 if(b.match(/^\.\d+/)){ 133 return"0"+b 134 } 135 else{ 136 return b 137 } 138} 139 140Currency.currentCurrency=""; 141Currency.format="money_with_currency_format"; 142 143Currency.convertAll=function(c,b,a,d){ 144 jQuery(a||"span.money").each(function(){ 145 if(jQuery(this).attr("data-currency")===b){ 146 return 147 } 148 // if(jQuery(this).attr("data-currency-"+b)){ 149 // jQuery(this).html(jQuery(this).attr("data-currency-"+b)) 150 // } 151 else{ 152 var e=0; 153 var f=Currency[d||Currency.format][c]||"{{amount}}"; 154 var g=Currency[d||Currency.format][b]||"{{amount}}"; 155 var i=Currency.money_decimal[b]; 156 var j=Currency.money_separator[b]; 157 158 if(f.indexOf("amount_no_decimals")!==-1){ 159 e=Currency.convert(parseInt(jQuery(this).html().replace(/[^0-9]/g,""),10)*100,c,b) 160 } 161 else{ 162 if(c==="JOD"||c=="KWD"||c=="BHD"){ 163 e=Currency.convert(parseInt(jQuery(this).html().replace(/[^0-9]/g,""),10)/10,c,b) 164 } 165 else{ 166 var ori_price = jQuery(this).data("ori-price"); 167 e=Currency.convert(parseInt(ori_price.toString().replace(/[^0-9]/g,""),10),c,b) 168 } 169 } 170 var h=Currency.formatMoney(e,g,i,j); 171 jQuery(this).html(h); 172 jQuery(this).attr("data-currency-"+b,h) 173 } 174 jQuery(this).attr("data-currency",b) 175 }); 176 this.currentCurrency=b;this.cookie.write(b) 177};
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.