From 5d3a5dfb2f929e1a08a9023ce8eb716f619c9052 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sat, 23 Jun 2018 08:40:20 -0400 Subject: [PATCH] Update for Giveaway.su Extension v4.0.2 gekkedev/GiveawayKiller#5 --- giveawayKiller.user.js | 115 ++++++++++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 18 deletions(-) diff --git a/giveawayKiller.user.js b/giveawayKiller.user.js index e4eb167..993cfb8 100644 --- a/giveawayKiller.user.js +++ b/giveawayKiller.user.js @@ -24,6 +24,8 @@ // @match *://*.steamcommunity.com/groups/* // @grant GM.getValue // @grant GM.setValue +// @grant GM.xmlhttpRequest +// @grant GM.xmlHttpRequest // @updateURL https://raw.githubusercontent.com/gekkedev/GiveawayKiller/master/giveawayKiller.user.js // @downloadURL https://raw.githubusercontent.com/gekkedev/GiveawayKiller/master/giveawayKiller.user.js // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js @@ -176,26 +178,103 @@ J.get(window.location.pathname+"?extension="+extension+"×tamp="+timestamp+"&csrf="+csrf+(secret ? "&secret="+secret : ""), function(response) { J("article").replaceWith(response); //this is the extension version and should not depend on manual updates - J("article").attr("extension-version", "chrome-3.4.9");//+chrome.runtime.getManifest().version); - - - var button = J("#getKey a"); - var actions = 0; - J("#actions [data-action-id]").each(function(i,el){ - actions += parseInt(J(el).data("action-id")); - if (J(el).find("button[data-type='steam.curator']").length) { - J(el).fadeOut(); - } else if (J(el).find("button[data-type='youtube.subscribe']").length) { - J(el).fadeOut(); - } else if (J(el).find("button[data-type='twitter.follow']").length) { - J(el).fadeOut(); - } else if (J(el).find("button[data-type='steam.game.wishlist']").length) { - J(el).fadeOut(); - } else if (J(el).find("td:contains('Invite')").length) { - J(el).fadeOut(); + J("article").attr("extension-version", "chrome-4.0.2");//+chrome.runtime.getManifest().version); + + var toggleActionButton = function(button) { + J(button).toggleClass("btn-default btn-success disabled").prop("disabled", "disabled").find("i.glyphicon-refresh").toggleClass("glyphicon-refresh glyphicon-ok").removeClass("spin"); + + if (J("#actions .btn-success[data-type]").length == J("#actions tr").length) { + var button = J("#getKey a"); + var actions = 0; + J("#actions [data-action-id]").each(function(i,el){ + actions += parseInt(J(el).data("action-id")); + }); + J(button).attr("href", J(button).attr("href")+"&actions="+md5(actions)).removeClass("disabled"); } + }; + + var universalVerify = function(data, callback) { + var action = JSON.parse(JSON.stringify(data)); + var request = new XMLHttpRequest(); + + GM.xmlHttpRequest({ + url: action.task, + method: action.method, + headers: { "Content-type": "application/x-www-form-urlencoded" }, + onload: function(request) { + if (request.status >= 200 && request.status < 400) { + + var new_response = request.responseText; + + // Steam Curator Follow + new_response = new_response.replace(/(\
)/, ""); + new_response = new_response.replace(/(onclick=\"FollowCurator\( ([0-9]+), false \);\" style=\"display: none\")/, "onclick=\"FollowCurator( $2, false );\""); + new_response = new_response.replace(/(onclick=\"FollowCurator\( ([0-9]+), true \);\")/, "onclick=\"FollowCurator( $2, true );\" style=\"display: none\""); + + // Steam Game Follow & Like + new_response = new_response + " game_area_already_owned "; + new_response = new_response.replace('