NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name openinspectionfinder // @namespace openinspectionfinder // @include http://www.domain.com.au/search/rent/*/?* // @version 1 // @grant none // ==/UserScript== var total = 0; var vurls = []; var vdata = []; var urls = []; var ListingsRows = []; function FindAllRows() { var litem = document.getElementsByTagName('li'); for (var i = 0; i < litem.length; ++i) { if (litem[i].className.indexOf('strap new-listing') != -1) { ListingsRows.push(litem[i]); } } total = ListingsRows.length; if (ListingsRows.length > 0) { for (var i = 0; i < ListingsRows.length; ++i) { WorkOnRow(ListingsRows[i]); } } } function WorkOnRow(RowElement){ var allElements = RowElement.getElementsByTagName('a'); for (var i = 0; i < allElements.length; ++i) { if (allElements[i].href.indexOf("/for-rent/") != -1) { ajaxsubmit(allElements[i].href); } } } function checkloaded(url){ urls.push(url); if(urls.length == total){ checkurls(); } } function checkurls(){ var dlitem = document.getElementsByTagName('li'); for (var i = 0; i < dlitem.length; ++i) { if(dlitem[i].innerHTML != ""){ var dlElements = dlitem[i].getElementsByTagName('a'); for (var i2 = 0; i2 < dlElements.length; ++i2) { if (dlElements[i2].href.indexOf("/for-rent/") != -1) { for (var i3 = 0; i3 < vurls.length; ++i3) { if(dlElements[i2].href == vurls[i3]){ var datael = document.createElement('li'); datael.appendChild(document.createTextNode('^ OPEN INSPECTION ')); datael.innerHTML = datael.innerHTML + vdata[i3]; dlitem[i].appendChild(datael); } } } } } } } function ajaxsubmit(url) { var mygetrequest=new ajaxRequest(); mygetrequest.onreadystatechange=function(){ if (mygetrequest.readyState==4){ if (mygetrequest.status==200){ var rdata = mygetrequest.responseText; var varipoint = rdata.indexOf('Open for inspection times'); if(varipoint != -1){ varistr = rdata.substring(varipoint); varistr = varistr.substring(varistr.indexOf('js-first-inspection') + 21); vurls.push(url); vdata.push(varistr.substring(0, varistr.indexOf('</li>'))); } checkloaded(url); } } } mygetrequest.open("GET", url, true); mygetrequest.send(null); } function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; if (window.ActiveXObject){ for (var i=0; i<activexmodes.length; i++){ try{ return new ActiveXObject(activexmodes[i]); } catch(e){ } } } else if (window.XMLHttpRequest) return new XMLHttpRequest(); else return false; } FindAllRows();