// ==UserScript==
// @name 自动任务
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author HCLonely
// @include *://marvelousga.com/giveaway/*
// @include *://dupedornot.com/giveaway/*
// @include *://gamezito.com/giveaway/*
// @include *://www.grabfreegame.com/giveaway/*
// @grant GM_xmlhttpRequest
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
var t=0;
var addUrl="//store.steampowered.com/api/addtowishlist";
var removeUrl="//store.steampowered.com/api/removefromwishlist";
var url=window.location.href;
var game=url.replace("https://marvelousga.com/giveaway/","");
game=game.replace("https://dupedornot.com/giveaway/","");
var div=document.createElement("div");
div.setAttribute("id", "doTaskDiv");
div.setAttribute("style", "position:fixed;right:50px;top:10px;width:85px;height:35px;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;");
document.getElementsByTagName("body")[0].appendChild(div);
document.getElementsByTagName("body")[0].appendChild(div2);
if(/https?:\/\/(marvelousga|dupedornot|gamezito).com\/giveaway\/[\w\W]*/.test(url)){
document.getElementById("doTask").onclick=function(){
var crsf=token();
if(crsf===1){
var a=document.getElementsByTagName("a");
for(var i=0;iOK!";
}else{
var msg=data.message||"ERROR";
p.innerHTML+=`${msg}!`;
}
if(e===t){
//console.log("ok");
getId();
}
}
});
}
/*
document.getElementById("removeWishlist").onclick=function(){
var a=document.getElementsByTagName("a");
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);
getKey();
}
}
function verify(e){
var p=document.createElement("p");
p.setAttribute("class", "card-text monospace");
p.innerHTML=`验证任务${task_id[e]}:${p_id[e]}...`;
div2.appendChild(p);
$.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!";
}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(eOK!";
var p1=document.createElement("p");
p1.setAttribute("class", "card-text monospace");
p1.innerHTML=`YOUR KEY : ${data.key}`;
div2.appendChild(p1);
window.open("https://store.steampowered.com/account/registerkey?key="+data.key,"_blank");
}else{
var msg=data.message||"ERROR";
p.innerHTML+=`${msg}!`;
}
}
});
}
}
if(/https?:\/\/www.grabfreegame.com\/giveaway\/[\w\W]*/.test(url)){
var verify_btn=[];
var do_btn=[]
document.getElementById("doTask").onclick=function(){
getBtn("d");
};
document.getElementById("Verify").onclick=function(){
getBtn("v");
};
function getBtn(e){
var btn=document.getElementsByTagName("button");
for(var i=0;i0&&e==="d"){
doTask(0);
}
if(verify_btn.length>0&&e==="v"){
verify_1(0);
}
}
function doTask(e){
$.ajax({
type: "get",
url: do_btn[e],
datatype: "json",
crossDomain:true,
xhrFields: {
withCredentials: true
},
complete: function (data) {
e++;
if(e0){
verify_1(0);
}
}
}
});
}
function verify_1(e){
$.ajax({
type: "get",
url: verify_btn[e],
datatype: "json",
crossDomain:true,
xhrFields: {
withCredentials: true
},
complete: function (data) {
e++;
if(e