// ==UserScript== // @name 自动任务 // @namespace http://tampermonkey.net/ // @version 0.6.10 // @description try to take over the world! // @author HCLonely // @include *://www.grabfreegame.com/giveaway/* // @include *://gamecode.win/giveaway/* // @include *://whosgamingnow.net/giveaway/* // @include *://marvelousga.com* // @include *://dupedornot.com* // @include *://gamezito.com* // @include *://www.grabfreegame.com/login* // @include *://gamecode.win/login* // @include *://whosgamingnow.net/login* // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict'; if(/You need to be logged in to perform all tasks/gim.test(document.getElementsByTagName("body")[0].innerText)){ window.location.href="/login"; return 0; } var url=window.location.href; var t=0; var addUrl="//store.steampowered.com/api/addtowishlist"; var removeUrl="//store.steampowered.com/api/removefromwishlist"; var game=url.replace("https://marvelousga.com/giveaway/",""); game=game.replace("https://dupedornot.com/giveaway/",""); game=game.replace("https://gamezito.com/giveaway/",""); game=game.replace("https://www.grabfreegame.com/giveaway/",""); game=game.replace("https://gamecode.win/giveaway/",""); var div=document.createElement("div"); div.setAttribute("id", "doTaskDiv"); div.setAttribute("style", "position:fixed;right:80px;top:120px;width:85px;z-index: 99999999999;"); div.innerHTML=` `; var div2=document.createElement("div"); div2.setAttribute("id", "info"); div2.setAttribute("class", "card-body card"); div2.setAttribute("style", "position:fixed;right:50px;bottom:10px;max-width:600px;max-height:400px;overflow-y:auto;z-index: 99999999999;"); document.getElementsByTagName("body")[0].appendChild(div); document.getElementsByTagName("body")[0].appendChild(div2); //防止弹出新窗口 window.onload=function(){ var d=new Date(); var cookiename = "haveVisited1"; //document.cookie = "haveVisited=1; path=/"; //document.cookie = "lastVisit=" + (d.getUTCMonth()+1) +"/"+ d.getUTCDate() + "/" + d.getUTCFullYear() + "; path=/"; document.cookie = cookiename + "=1; path=/"; document.cookie = cookiename + "=" + (d.getUTCMonth()+1) +"/"+ d.getUTCDate() + "/" + d.getUTCFullYear() + "; path=/"; } //防止419 function token(){ var a=document.getElementsByTagName("a"); for(var j=0;j${msg}!`; } if(e===t){ getId(); } }, error:function(jqXHR, textStatus, errorThrown){ p.innerHTML+=`${textStatus}:${jqXHR.status}-${errorThrown}`; if(e===t){ getId(); } } }); } var task_id=[]; var api_id=[]; var btn_id=[]; var p_id=[] //获取任务id function getId(){ var btn=document.getElementsByTagName("button"); for(var i=0;i0&&api_id.length>0&&btn_id.length>0&&p_id.length>0){ verify(0); }else if(task_id.length==0&&api_id.length==0&&btn_id.length==0&&p_id.length==0){ var p2=document.createElement("p"); p2.setAttribute("class", "card-text monospace"); p2.setAttribute("style", "color:green"); p2.innerHTML=`所有任务验证完成!`; div2.appendChild(p2); p2.scrollIntoView(); getKey(); } } //验证任务 function verify(e,v=0){ if(/visit[\w\W]*?webpage/gim.test(p_id[e])&&v==1){ e++; verify(e,v); return; }else if(/visit[\w\W]*?webpage/gim.test(p_id[e])&&v!=1){ v=1; } var p=document.createElement("p"); p.setAttribute("class", "card-text monospace"); p.innerHTML=`验证任务${task_id[e]}:${p_id[e]}...`; div2.appendChild(p); p.scrollIntoView(); if(/Join[\w\W]*?in Steam/i.test(p_id[e].innerText)){ document.getElementById(btn_id[e]).removeAttribute("disabled"); document.getElementById(btn_id[e]).click(); } if(/visit[\w\W]*?webpage/.test(p_id[e])&&v==1){ }else{ $.ajax({ type: "post", url: "/ajax/verifyTasks/"+api_id[e], datatype: "json", data:{ giveaway_slug: game, giveaway_task_id: task_id[e] }, crossDomain:true, xhrFields: { withCredentials: true }, success: function (data) { if(data.status==1){ document.getElementById(btn_id[e]).innerText="VERIFIED"; p.innerHTML+="OK!--"+data.percentageNanoBar+"%"; }else{ document.getElementById(btn_id[e]).innerText="ERROR!"; document.getElementById(btn_id[e]).style.color="red"; document.getElementById(btn_id[e]).parentNode.getElementsByTagName("a")[0].click(); var msg=data.message||"ERROR"; p.innerHTML+=`${msg}!`; } e++; /* if(e==btn_id.length-1){ document.getElementById(btn_id[e]).removeAttribute("disabled"); document.getElementById(btn_id[e]).click(); }*/ if(data.percentageNanoBar==100||e>=btn_id.length){ var p2=document.createElement("p"); p2.setAttribute("class", "card-text monospace"); p2.setAttribute("style", "color:green"); p2.innerHTML=`所有任务验证完成!`; div2.appendChild(p2); p2.scrollIntoView(); getKey(); }else{ verify(e,v); } }, error:function(jqXHR, textStatus, errorThrown){ document.getElementById(btn_id[e]).innerText="ERROR!"; document.getElementById(btn_id[e]).style.color="red"; document.getElementById(btn_id[e]).parentNode.getElementsByTagName("a")[0].click(); p.innerHTML+=`${textStatus}:${jqXHR.status}-${errorThrown}`; e++; /* if(e==btn_id.length-1){ document.getElementById(btn_id[e]).removeAttribute("disabled"); document.getElementById(btn_id[e]).click(); }*/ if(e${data.key}`; div2.appendChild(p1); p1.scrollIntoView(); window.open("https://store.steampowered.com/account/registerkey?key="+data.key,"_blank"); }else{ var msg=data.message||"ERROR"; p.innerHTML+=`${msg}!`; } }, error:function(jqXHR, textStatus, errorThrown){ p.innerHTML+=`${textStatus}:${jqXHR.status}-${errorThrown}`; } }); } } if(/https?:\/\/(marvelousga|dupedornot|gamezito).com\/giveaway\/[\w\W]*/.test(url)){ document.getElementById("doTask").onclick=function(){ t=0; var crsf=token(); if(crsf===1){ var a=document.getElementsByTagName("a"); for(var i=0;i0&&e==="d"){ doTask(0); } if(verify_btn.length>0&&e==="v"){ verify_1(0); } } //做任务 function doTask(e){ var taskId=do_btn[e].match(/\?q\=[\d]+/)[0]; taskId=taskId.replace("?q=",""); var p=document.createElement("p"); p.setAttribute("class", "code"); p.innerHTML=`执行任务:${taskId}...`; div2.appendChild(p); p.scrollIntoView(); $.ajax({ type: "get", url: do_btn[e], timeout:"10000", datatype: "json", crossDomain:true, xhrFields: { withCredentials: true }, complete: function (data) { p.innerHTML+="OK!"; e++; if(e0){ verify_1(0); } } } }); } //验证任务 function verify_1(e){ var taskId=verify_btn[e].match(/\?verify\=[\d]+/)[0]; taskId=taskId.replace("?verify=",""); var p=document.createElement("p"); p.setAttribute("class", "code"); p.innerHTML=`验证任务:${taskId}...`; div2.appendChild(p); p.scrollIntoView(); $.ajax({ type: "get", url: verify_btn[e], timeout:"10000", datatype: "json", crossDomain:true, xhrFields: { withCredentials: true }, complete: function (data) { p.innerHTML+="OK!"; e++; if(e`; }else{ msg=data.message||"ERROR"; task=g_task_ok[e].getElementsByTagName("a")[0]; zz=document.createElement("div"); zz.appendChild(task); task=zz.innerHTML; p.innerHTML+=`${msg}!${task}`; } p.scrollIntoView(); e++; if(e0){ p1.setAttribute("style", "color:red"); p1.innerHTML=`有任务未完成或验证失败,请手动完成任务之后在验证!`; }else{ p1.setAttribute("style", "color:green"); p1.innerHTML=`所有任务验证完成,请手动完成谷歌验证获取key!`; } div2.appendChild(p1); p1.scrollIntoView(); } } }); } if(/https?:\/\/gamecode.win\/giveaway\/[\w\W]*/.test(url)){ div2.setAttribute("class", "col-sm-8 text-center backgroundWhite finishAllTasksText matchColumn"); btn_class("btn draw-border parallelogram"); var g_btn=document.getElementsByTagName("button"); for(var g=0;g0){ g_do_task(0); }else{ var p1=document.createElement("p"); p1.setAttribute("style", "color:green"); p1.innerHTML=`所有任务都已经完成了,快去领key吧!`; div2.appendChild(p1); p1.scrollIntoView(); } }; document.getElementById("Verify").onclick=function(){ g_task_url=[]; g_task_id=[]; g_task_ok=[]; if(g_task_id.length>0){ g_do_task(0); }else{ var p1=document.createElement("p"); p1.setAttribute("style", "color:green"); p1.innerHTML=`所有任务都已经完成了,快去领key吧!`; div2.appendChild(p1); p1.scrollIntoView(); } }; } //button样式 function btn_class(e){ var task_btn=document.getElementsByClassName("auto-task"); for(var tb=0;tbSteam key:<\/h3>

[\w\d]{5}(-[\w\W]{5}){2}<\/strong><\/p>/i.test(data)){ var key=data.match(/

Steam key:<\/h3>

[\w\d]{5}(-[\w\W]{5}){2}<\/strong><\/p>/i)[0]; key=key.replace(/(

Steam key:<\/h3>

)|(<\/strong><\/p>)/gi,""); data=data.replace(key,`${key}`); } document.write(data); }, error:function(jqXHR, textStatus, errorThrown){ alert(textStatus+":"+jqXHR.status+"-"+errorThrown); } }); } document.getElementById("doTask").onclick=function(){ wsn_enter(); }; document.getElementById("Verify").onclick=function(){ wsn_enter(); }; } })();