哪个大哥帮我改下JS脚本 已经写了点
网页游戏的 现在想做到依次点击循环
1 先是判断open的按钮是否存在 存在就点击 open
<a class="open has_poster" href="#"
onclick="hg.utils.UserInventory.useConvertible
('wanted_poster_convertible', 1); return false;"></a>
2点进去以后点击leave map按钮
<a href="#" class="treasureMapPopup-cancel"
onclick="app.views.TreasureMapView.map.toggleTabState('leaveMap');
return false;">Leave Map</a
3最后点击leave按钮
<a href="#" class="treasureMapPopup-action-button highlight"
onclick="app.views.TreasureMapView.map.discard(this); return
false;">Leave</a>
这样一个循环 当没有open按钮的时候就不需要操作 能帮看下下面的吗
var timer=null;
var hudLocationContent =document.getElementById("hudLocationContent");
function dd(){
timer=setInterval(function(){
var has_poster=document.getElementsByClassName("has_poster");
if(has_poster){
setTimeout(function(){
app.views.TreasureMapView.map.show()
setTimeout(function(){
app.views.TreasureMapView.map.toggleTabState('leaveMap');
setTimeout(function(){
window.location.reload()
dd();
// app.views.TreasureMapView.map.discard(this);
// var overlayPopup= document.getElementById("overlayPopup")
// var treasureMapPopup=document.getElementsByClassName("treasureMapPopup-block-cell-name");
// var len=treasureMapPopup.length;
// treasureMapPopup[len-1].click();
},1000)
},5000)
},2000)
}
},1000)}
dd();
现在的问题是在 leave map 和 leave 这里卡主了点不了 leave