的問題基本上,即時通過JavaScript來刷新頁面,當價格達到期望價格時,它會查找價格併購買商品。iFrame.contentDocument
我得到它沒有iframe的工作,但我需要工作在iframe,這是問題達成。
如果你去了這個網頁:[http://m.roblox.com/items/100933289/privatesales]
,跑這個代碼:
alert(document.getElementsByClassName('currency-robux')[0].innerHTML);
你會得到最低價格的警報。在代碼中,這並不工作(因此,我的問題。)
嘗試運行下面的代碼此頁面上得到它的工作[http://www.roblox.com/Junk-Bot-item?id=100933289]
var filePath = document.URL;
var itemid = filePath.slice(((filePath.search("="))+1));
var mobileRoot = 'http://m.roblox.com/items/';
var mobileEnd = '/privatesales';
var mobileFilePath = mobileRoot+itemid+mobileEnd;
var iframe2 = '<iframe id="frame" width="100%" height="1" scrolling="yes"></iframe>';
document.write(iframe2);
var iframe = parent.document.getElementById("frame");
iframe.height = 300;
iframe.width = 500;
iframe.src = mobileFilePath;
var price;
var snipe = false;
var lp = Number(prompt("Snipe Price?"));
document.title = "Sniping";
function takeOutCommas(s){
var str = s;
while ((str.indexOf(",")) !== -1){
str = str.replace(",","");
}
return str;
}
function load() {
if (snipe == false) {
tgs = iframe.contentDocument.getElementsByClassName('currency-robux');
price = Number((takeOutCommas(tgs[0].innerHTML)));
alert(price);
}
}
iframe.onload = load;