1var ipDec = { 2 site: "//" + location.host, 3 ISBN: "", 4 baseURL: "http://" + location.host + "/images/stories/vsj/", 5 MainArticle: {}, 6 MainArticleHTML: "", 7 pageURL: window.location.href, 8 ASINtagtarget: /(?:<|<);ASIN:.*?(?:>|>)/i, 9 allASIN: /(?:<|<);ASIN:.*?(?:>|>)/ig, 10 ISBNtagtarget: /ISBN:(?:\s| )*/, 11 ISBNtarget13: /ISBN:(?:\s| )*97(?:8|9)?-?\d{9}(?:\d|X)/i, 12 ISBNtarget10: /ISBN:(?:\s| )*.{10}/i, 13 PrintASIN: /Print:(?:\s| )*\w*/i, 14 PrintASINTag: /Print:(?:\s| )*/i, 15 KindleASIN: /Kindle:(?:\s| )*\w*/i, 16 KindleASINTag: /Kindle:(?:\s| )*/i, 17 18 decorator: function () { 19 if ($("#reviewoftheday").length !== 0) 20 this.bookReview(); 21 if ($(".bookwatch").length !== 0) 22 this.bookWatch(); 23 24 this.addAdColumn(); 25 26 jQuery(".btn-navbar").on("click", function (e) { 27 //this assumes that there is only one nav-collapse 28 navs = jQuery(".nav-collapse"); 29 if (navs.hasClass("in")) { 30 navs.removeClass("in").height("0px"); 31 } else { 32 navs.addClass("in").height("auto"); 33 } 34 }); 35 }, 36 37 addAdColumn: function () { 38 var col = jQuery("#aside"); 39 if (col.css("display") != "none") { 40 jQuery.ajax({ url: this.site + "/HTMLPages/RightCol.html" }).done(function (result) { 41 col.append(result); 42 }); 43 } 44 }, 45 46 bookReview: function () { 47 //Review of the day - only one hr 48 // var result = this.processInfoBlock($("#reviewoftheday").html()); 49 // if (!result.ASIN) 50 // return; 51 52 const bookref=["B0FP9RJJ7Z","B0FJYJF77Q", 53"B0F4NMXRJN", "B0DZ361XX6", "B0DSSVDV76", "B0DHKT342W", "B0CVW1D2Z5", 54"B0DKB5JPDD", "B0D8H4N8SK", "B0D6LZZQ8R", "B0CTGF8XQ5", "B0CT46R6LF", 55"B0CS2LRPSS", "B0CK71TQ17", "B0896SDK1Y", "B0BHDWZY62", "B09ZGBHMG9", 56"B0B5522QS3", "B08XPRMK97", "B09MDL5J1S", "B09FTLPTP9", "B07SCYZ75R", 57"B081YS81L7", "B07XJQDS4Z", "B07SH923YX", "B07RZ5RR35", "B07S9Y7LZQ", 58"B07SBN571P", "B07SDN5XTY", "B07S8958R9", "B07S79ZVMQ", "B07S5CT71C", 59"B0G5M76KLB", "B0FDYDPQ54","B0GMKQCC9M","B0GHP5XND9","B0GX372RM5", 60"B0GX2TRN6N"]; 61 var asin=bookref[Math.floor(Math.random()*bookref.length)]; 62 var widget = this.MakeWidget(asin); 63 // var Side = "left"; 64 widget.css({ margin: "auto" }); 65 $("#reviewoftheday h1").after(widget); 66 67 }, 68 bookWatch: function () { 69 var content = $(".bookwatch"); 70 var count = 0; 71 var ASIN; 72 73 while (ASIN = content.html().match(this.ASINtagtarget)) { 74 ASIN = ASIN[0]; 75 count++; 76 content.html(content.html().replace(this.ASINtagtarget, "<div id=bookwatchimage></div>")); 77 ASIN = this.processASIN(ASIN); 78 var widget = this.MakeWidget(ASIN); 79 widget.css({ margin: "auto" }); 80 content.find("#bookwatchimage").prevAll("hr:eq(0)").after(widget); 81 $("#bookwatchimage").remove(); 82 } 83 84 }, 85 processASIN: function (ASIN) { 86 if ((ASIN.search("@" + this.Region) != -1) || (ASIN.search("@") == -1)) { 87 ASIN = ASIN.match(/\w{10}/); 88 if (ASIN == null) 89 return ASIN; 90 } else if (ASIN.search("@ALL") != -1) { 91 ASIN = ASIN.match(/\w{10}/); 92 if (ASIN == null) 93 return ASIN; 94 } 95 return ASIN; 96 }, 97 processInfoBlock: function (DOMHTML) { 98 var ASIN = DOMHTML.match(this.PrintASIN); 99 if (ASIN) { 100 ASIN = ASIN.toString(); 101 ASIN = ASIN.replace(this.PrintASINTag, ""); 102 } else { 103 var ISBN = DOMHTML.match(this.ISBNtarget13); 104 if (!ISBN) { 105 ISBN = DOMHTML.match(this.ISBNtarget10); 106 } 107 if (ISBN) { 108 ISBN = ISBN.toString(); 109 ISBN = ISBN.replace(this.ISBNtagtarget, ""); 110 if (ISBN.length !== 10) 111 ISBN = this.ISBN13to10(ISBN); 112 } 113 ASIN = ISBN; 114 } 115 var kindleASIN = DOMHTML.match(this.KindleASIN); 116 if (kindleASIN) { 117 kindleASIN = kindleASIN.toString(); 118 kindleASIN = kindleASIN.replace(this.KindleASINTag, ""); 119 } 120 return { ASIN: ASIN, kindle: kindleASIN }; 121 }, 122 MakeWidget: function (ASIN) { 123 var Widget = '<iframe type="text/html" sandbox="allow-scripts allow-same-origin allow-popups" width="212" height="362" frameborder="0" allowfullscreen style="max-width:100%"'; 124 Widget += 'src="https://read.amazon.com/kp/card?asin=' + ASIN + '&preview=newtab&linkCode=kpe&ref_=cm_sw_r_kb_dp_XX4EW9D5J03MS25R4MQS&tag=iprog-20&hideShare=true" ></iframe>'; 125 var WidgetFrame = $("<div> </div>"); 126 WidgetFrame.css({ 127 width: "212px", 128 height: "362px", 129 margin: "2px", 130 cursor: "pointer", 131 }); 132 WidgetFrame.append($(Widget)); 133 return WidgetFrame; 134 } 135}; 136 137let iprogIntervalId; 138let iprogCount = 0; 139var correctSharewww = function () { 140 var val = $(".st-label").text() 141 if (val != "") { 142 val = parseFloat(val) + 5.9; 143 $(".st-label").text(val.toFixed(1) + "k"); 144 clearInterval(iprogIntervalId); 145 }
146 iprogCount = iprogCount + 1; 147 if (iprogCount > 200) clearInterval(iprogIntervalId); 148}; 149 150 151 152var iprogrammermain = function () { 153 ipDec.decorator(); 154 iprogIntervalId = setInterval(correctSharewww, 100); 155}; 156 157 158$(document).ready(iprogrammermain);
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.