这作为书签运行。
创建窗口,提取值并将它们写入窗口“ log”非常完美。
我想将“日志”窗口的内容保存到scrypt.txt,但是将父窗口的内容保存起来。我做错什么了?
javascript:
setInterval(logging,60000);
w1 = window.open("https://scrypt.cc/index.php");
log = window.open("");
function logging(){
if(w1.document.body.innerHTML == 'Server is currently busy. Please try again later.'){
w1.location.href = 'https://scrypt.cc/index.php';
console.log("busy");
}else{
console.log("ok");
log.document.body.innerHTML = '';
var re=/var\s*dayprofitperkhs\s*=\s*([0-9\.]+)\s/gi;
var matches=re.exec(w1.document.body.innerHTML);
log.document.write(RegExp.$1 + "<p></p>");
log.document.write(w1.$('#t9_2').val() + "<p></p>");
log.setTimeout(save,1000);
w1.location.href = 'https://scrypt.cc/index.php';
}
}
function save() {
a = log.document.createElement('a');
a.href = log.location.href;
a.download = 'scrypt.txt';
log.document.body.appendChild(a);
a.click();
a.parentNode.removeChild(a);
}
编辑:另存为* .html和另一个a.href可以正常工作:
a.href = 'data:text/html;base64,' + btoa(log.document.body.outerHTML);
a.download = 'values.html';
这是一个可行的解决方案:
javascript:
setInterval(logging,60000);
w1 = window.open("https://scrypt.cc/index.php");
log = window.open("");
function logging(){
if(w1.document.body.innerHTML == 'Server is currently busy. Please try again later.'){
w1.location.href = 'https://scrypt.cc/index.php';
console.log("server busy");
}else{
log.document.body.innerHTML = '';
var re=/var\s*dayprofitperkhs\s*=\s*([0-9\.]+)\s/gi;
var matches=re.exec(w1.document.body.innerHTML);
log.document.write("<p>" + RegExp.$1 + "</p>");
log.document.write("<p>" + w1.$('#t9_2').val() + "</p>");
log.setTimeout(save,1000);
w1.location.href = 'https://scrypt.cc/index.php';
}
}
function save() {
console.log("file saved");
a = document.createElement('a');
a.href = 'data:text/html;base64,' + btoa(log.document.body.outerHTML);
a.download = 'values.html';
document.body.appendChild(a);
a.click();
a.parentNode.removeChild(a);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句