我有这个 Twitter 扫描仪(一个 Google Chrome 扩展),我想只执行一次这个 IF 语句。之后我仍然希望它能够扫描 other shoeName
,但是我设置的标志不断被重置。
这是我的代码:
function twitterScan() {
for (var i = 0; i < 4; i++) {
tweetName[i] = document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id")[0].innerHTML;
tweet[i] = document.getElementsByClassName("js-tweet-text")[i].innerHTML;
}
var flag = true;
var flag1 = true;
//if (document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id")[0].innerHTML;
if (tweet[0].match(shoeName) == shoeName && flag == true||(tweet[0].match(shoeName1) == shoeName1 && flag1 == true) {
if(tweet[0].match(shoeName) == shoeName)
flag = false;
if(tweet[0].match(shoeName1) == shoeName1)
flag1 = false;
document.getElementsByClassName("twitter-timeline-link")[0].click();
tFunction = "get outa here";
shoeName = " 4444 4 456 7 8 456 7 345 7 345 345 3 1 1 133s "; //buffer to jump out of interval loop
}
}