-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththorntons_scraper_bookmarklet.js
More file actions
1 lines (1 loc) · 1.97 KB
/
thorntons_scraper_bookmarklet.js
File metadata and controls
1 lines (1 loc) · 1.97 KB
1
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="https://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){var elQ=$("#Content_MainContent_boxBinCollectionHistory_gridInvoices_GridViewPager1_DropDownListPageSize");if(elQ&&elQ[0]){var val=elQ.find(":selected").text();if("20"!=val)$(".header").html('<div style="color: #fff; font-size: 2em; font-style: italic;">Updating (20 rows per page), one moment...</div>'),elQ.val("20").change();else{var elT=$("#Content_MainContent_boxBinCollectionHistory_gridInvoices");if(elT&&elT[0]){var s="";elT.find(".grdRow, .grdAltRow").each(function(idx,el){if(elTDs=$(el).children("td"),elTDs&&6==elTDs.length){var dt=$(elTDs[0]).text();dt=dt.replace(" 12:00 AM",""),s+=dt+"\t"+$(elTDs[1]).text()+"\t",s+="General Waste"==$(elTDs[2]).text()?"General":"Compost"==$(elTDs[2]).text()?"Compost":"General Recycling"==$(elTDs[2]).text()?"Recycling":"n/a",s+="\n"}});var win=window.open(null,"_blank","width=400,height=400");if(win){win.document.write('<html><head><title>Thorntons Scraped Data</title><head><body><h2>Scraped Data:</h2><form><p>Header Row:</p><textarea style="width: 100%;" rows="1">Date\tWeight\tType\n</textarea><br /><p>Data:</p><textarea style="width: 100%;" rows="10">'+s+"</textarea><br/></form></body></html>");var elA=$("#Content_MainContent_boxBinCollectionHistory_gridInvoices_GridViewPager1_ImageButtonNext");if(elA&&elA[0]){$(".header").html('<div style="color: #fff; font-size: 2em; font-style: italic;">Retrieving next page of results, one moment...</div>');var href=elA.attr("href");href=href.replace("javascript:",""),eval(href)}}else alert("Popup windows appear to be blocked, so I could not display the scraped data.")}}}});