javascript学习
废话不说,直接贴代码
/** 执行转发开始clearInterval(myInterval); 地址:http://tuitu.sinaapp.com/weibo/task http://qqtuitu.sinaapp.com/weibo/task **/ (function(){ var doc = document, script = doc.createElement("script"), _s = doc.getElementsByTagName("script")[0]; //script.src = "http://libs.baidu.com/jquery/1.4.1/jquery.min.js";/assets/js/jquery.js script.src = "http://kaixinpig.net/assets/js/jquery.js"; _s.parentNode.insertBefore(script,_s); script.onload = function(){ console.log("-------------------------jQuery is loaded!"); } })() function invokeClick(element) { if(element.click) element.click(); else if(element.fireEvent) element.fireEvent('onclick'); else if(document.createEvent){ var evt = document.createEvent("MouseEvents"); evt.initEvent("click", true, true); element.dispatchEvent(evt); } } function waitSecs(seconds){ var t = Date.now(); while(true){ if(Date.now()-t>seconds*1000){ break; } } } function zhuanfa(){ var slist = $("span.right a"); var len = slist.length; console.log("len "+len); if(len==0){ //$("a#refresh") console.log(" click refresh click !"); invokeClick($("a#refresh")[0]); return; } for(var k = 0; k < len; k++) { var id =slist[k].id; var index1 = id.indexOf("fast"); //console.log("id "+id); //console.log("index1 "+index1); if(index1>=0){ //console.log("click "+k); console.log("id "+id); waitSecs(5); invokeClick(slist[k]); } } //$("a.next")[0] invokeClick($("a.next")[0]); } setInterval("zhuanfa()",90000); /** 执行转发结束 **/ /** 关注开始 **/ function work() { console.log("click at ["+(new Date()).toString()+"]"); invokeClick($("#follow_all_btn")[0]); waitSecs(30); invokeClick($("a.next")[0]); } setInterval("work()",60000); /** 关注结束 **/ function invokeClick(element) { if(element.click)element.click(); //判断是否支持click() 事件 else if(element.fireEvent)element.fireEvent('onclick'); //触发click() 事件 else if(document.createEvent){ var evt = document.createEvent("MouseEvents"); //创建click() 事件 evt.initEvent("click", true, true); //初始化click() 事件 element.dispatchEvent(evt); //分发click() 事件 } }
相关推荐
nmgxzm00 2020-11-10
ifconfig 2020-10-14
hhanbj 2020-11-17
zfszhangyuan 2020-11-16
古叶峰 2020-11-16
一个智障 2020-11-15
jipengx 2020-11-12
81427005 2020-11-11
xixixi 2020-11-11
游走的豚鼠君 2020-11-10
苗疆三刀的随手记 2020-11-10
Web卓不凡 2020-11-03
小飞侠V 2020-11-02
帕尼尼 2020-10-30
爱读书的旅行者 2020-10-26
帕尼尼 2020-10-23
杏仁技术站 2020-10-23
淼寒儿 2020-10-22