1var ShoWareBasketData = {}; 2var ShoWareTicketingSystemURL = ""; 3var ShoWareBasketDataDebug = ""; 4var enableDebugging = true; 5 6parseUrl = (function () { 7 var a = document.createElement('a'); 8 return function (url) { 9 a.href = url; 10 return { 11 host: a.host, 12 hostname: a.hostname, 13 pathname: a.pathname, 14 port: a.port, 15 protocol: a.protocol, 16 search: a.search, 17 hash: a.hash 18 }; 19 } 20})(); 21 22function ShoWareCallback(jsonData) 23{ 24// Create ShoWare Basket Object from Json Data 25 var $sresult = ""; 26 var json = $.parseJSON(jsonData); 27 $(json).each(function(i,val){ 28 $.each(val,function(k,v){ 29 if ($sresult!=="") $sresult += ","; 30 $sresult += '"' + k + '":"' + v + '"'; 31 ShoWareBasketDataDebug += k + ' = "' + v + '" , '+String.fromCharCode(10) + String.fromCharCode(13); 32 }); 33 }); 34 if ($sresult !== "") { 35 $sresult = "{" + $sresult + "}"; 36 ShoWareBasketData = JSON.parse($sresult); 37 38 if (ShoWareBasketData) { 39 ProcessBasketObject(); 40 } 41 } 42} 43 44 45(function () { 46 47 function loadScript(url, callback) { 48 49 var script = document.createElement("script") 50 script.type = "text/javascript"; 51 52 if (script.readyState) { //IE 53 script.onreadystatechange = function () { 54 if (script.readyState == "loaded" || script.readyState == "complete") { 55 script.onreadystatechange = null; 56 callback(); 57 } 58 }; 59 } else { //Others 60 script.onload = function () { 61 callback(); 62 }; 63 } 64 65 script.src = url; 66 document.getElementsByTagName("head")[0].appendChild(script); 67 } 68 var ShoWareBasketWidgetURL = ""; 69 var tmpuri = parseUrl(document.getElementById("showarebasketscript").src); 70 if (document.getElementById("showarebasketscript")) { 71 ShoWareTicketingSystemURL = tmpuri.protocol + '//' + tmpuri.hostname + '/'; 72 ShoWareBasketWidgetURL = ShoWareTicketingSystemURL + 'include/widgets/basket/basketwidget.asp'; 73 } 74 if (ShoWareBasketWidgetURL !== "") { 75 if (typeof jQuery == 'undefined') { 76 console.log("jQuery NOT present - required for basket widget.") 77 } else { 78 $.getScript(ShoWareBasketWidgetURL); 79 $('head').append('<link rel="stylesheet" href="' + tmpuri.protocol + '//' + tmpuri.hostname + '/include/widgets/basket/basketwidget.css" type="text/css" />'); 80 }; 81 }; 82})(); 83 84 85function twoDigit(n) { 86 var str=(n-1+1.005).toString(); 87 return str.substring(0,str.indexOf('.')+3); 88} 89 90 91function ProcessBasketObject() { 92 var html = "<div class=\"cart-item\">\n"; 93 html+=" <span class=\"cart-item-pic\">\n"; 94 html+=" <i class=\"sw-icon sw-i-cart\"></i>\n"; 95 html+=" </span>\n"; 96 var smsg = ""; 97 if (ShoWareBasketData.TotalNumerItems>0) { 98 smsg = "There "+((ShoWareBasketData.TotalNumerItems==1)?"is "+ShoWareBasketData.TotalNumerItems+" item":"are " + ShoWareBasketData.TotalNumerItems+" items")+"\n in your shopping cart"; 99 } else { 100 smsg = "Your shopping cart is empty"; 101 } 102 html+=" <span aria-describedby=\"cart-text\" class=\"cart-item-desc\" title=\"" + smsg + "\">\n"; 103 html+=" " + ShoWareBasketData.TotalNumerItems + "\n"; 104 html+=" </span>\n"; 105 html+="</div>\n"; 106 html+="<div class=\"cart-item-detail\">\n"; 107 html+="<span class=\"comment\">click to open cart</span>\n"; 108 html += "<table cellspacing=1 cellpadding=0 border=0>\n"; 109 if (ShoWareBasketData.NumberOfTickets > 0) { 110 html += "<tr><td nowrap class=\"label\">Tickets</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.TicketsAmount) + "</td></tr>\n"; 111 html += "<tr><td nowrap class=\"label\">Ticket Fees</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.TicketFeesAmount) + "</td></tr>\n"; 112 html += "<tr><td nowrap class=\"label\">Order Fees</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.OrderFeeAmount) + "</td></tr>\n"; 113 114 if (ShoWareBasketData.hasDeliveryOptionSet) { 115 html+="<tr><td nowrap class=\"label\">Delivery Fees</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.DeliveryFeeAmount) + "</td></tr>\n"; 116 html+="<tr><td nowrap class=\"notes\" colspan=\"2\">" + ShoWareBasketData.DeliveryMethodName + "</td></tr>\n"; 117 } 118 } 119 if (ShoWareBasketData.NumberOfDonations > 0) { 120 html+="<tr><td nowrap class=\"label\">Donations</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.DonationsAmount) + "</td></tr>\n"; 121 } 122 if (ShoWareBasketData.NumberOfMemberships > 0) { 123 html += "<tr><td nowrap class=\"label\"> " + ShoWareBasketData.MembershipsAlias + "</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.MembershipsAmount) + "</td></tr>\n"; 124 html += "<tr><td nowrap class=\"label\"> " + ShoWareBasketData.MembershipsAlias + " Fees</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.MembershipsFeesAmount) + "</td></tr>\n"; 125 } 126 html+="<tr class=\"total\"><td nowrap class=\"label\">Sub Total</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.GrandTotal) +"</td></tr>\n"; 127 128 if (ShoWareBasketData.DueTodayAmount > 0){ 129 html+="<tr class=\"total\"><td nowrap class=\"label\">Due Today</td><td nowrap>" + ShoWareBasketData.SystemCurrencySymbol + twoDigit(ShoWareBasketData.DueTodayAmount) +"</td></tr>\n"; 130 } 131 132 html+="</table>\n"; 133 html+="</div>\n"; 134 if (enableDebugging) {
135 html+="<!-- " + String.fromCharCode(10) + String.fromCharCode(13) + ShoWareBasketDataDebug + String.fromCharCode(10) + String.fromCharCode(13) + " -->"; 136 } 137 $("#ShoWareBasketWidget").append(html); 138 $("#ShoWareBasketWidget").click(function(){ 139 window.location.href = ShoWareTicketingSystemURL+'basket.asp?fw=1'; 140 }); 141 if (ShoWareBasketData.TotalNumerItems > 0) { 142 var swNoFocus; 143 $("#ShoWareBasketWidget").mouseover(function () { 144 if ($(this).find("div.cart-item-detail").css("display")==="none") { 145 $(this).find("div.cart-item-detail").slideDown(400); 146 clearInterval(swNoFocus); 147 } 148 }); 149 $("#ShoWareBasketWidget").mouseleave(function(){ 150 clearInterval(swNoFocus); 151 swNoFocus = setInterval(swHideBasketDetails, 500) 152 }); 153 function swHideBasketDetails() { 154 $("#ShoWareBasketWidget").find("div.cart-item-detail").slideUp(400); 155 clearInterval(swNoFocus); 156 swNoFocus = null; 157 } 158 } 159}
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.