我有一个冗长的脚本,在最近的操作系统更新中已经破解。书签脚本在运行时抛出一个弹出窗口,您可以在其中输入订单号。它搜索这些订单,检查适用的框,加粗它们,然后显示找到的订单列表和未找到的订单。
由于更新未找到任何内容,因此仅显示未找到的订单。
javascript:q=prompt("ORDER NUMBERS","");
q=q.toUpperCase();
allOrders=q;
allOrders=allOrders.replace(/[^\w]/g,' ');
allOrders=allOrders.replace(/\b(?!M)\w+\b/g,' ');
allOrders=allOrders.replace(/ +/g,' ');
nonOrders=allOrders;
foundOrders="";
nonOrders=nonOrders.replace(/[^\w]/g,' ');
elmz=document.getElementsByTagName("p");
refundAmount=0.00;
j=0;
for(var i=0; i<elmz.length; i++)
{
if(elmz[i].getAttribute("class")=="WebOrderNumber")
{
orderNum=elmz[i].innerHTML;
orderNum=orderNum.replace(/<b>/g, '');
orderNum=orderNum.replace(/<\/b>/g, '');
if(q.indexOf(orderNum)!="-1")
{
var reOrder = new RegExp(orderNum, "g");
foundOrders=foundOrders+orderNum+'\n';
nonOrders=nonOrders.replace(reOrder,'');
elmz[i].innerHTML="<b>"+ elmz[i].innerHTML+"</b>";
elmzz=document.getElementsByTagName("tr");
k=0;
for(var l=0; l<elmzz.length; l++)
{
if(elmzz[l].getAttribute("class")=="total")
{
if(k==j)
{
refundAmount=refundAmount+parseFloat(elmzz[l].getElementsByTagName("td")[0].innerHTML);
}
k++;
}
}
}
j++;
}
}
if(refundAmount.toFixed(2)!="0.00")
{
alert(refundAmount.toFixed(2));
}
else
{
more=true;
while(more)
{
more=false;
elmzzz=document.getElementsByTagName("td");
for(var i=0; i<elmzzz.length; i++)
{
if(elmzzz[i].getAttribute("class")=="sortable itemWebOrderNumber")
{
if(q.indexOf(elmzzz[i].innerHTML) != "-1")
{
var reOrder = new RegExp(elmzzz[i].innerHTML, "g");
foundOrders=foundOrders+elmzzz[i].innerHTML+'\n';
nonOrders=nonOrders.replace(reOrder,'');
elmzzz[i].innerHTML="<b>"+elmzzz[i].innerHTML+"</b>";
elmzzz[i-1].getElementsByTagName("input")[0].click();
more=true;
}
}
}
}
}
nonOrders=nonOrders.replace(/ +/g,'\n');
alert("Found Orders:\n"+foundOrders+"\nPossible order numbers not located:\n"+nonOrders);