Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Gamehag GA Solver
- // @version 0.3.2
- // @description Easily complete tasks
- // @author Justman
- // @match https://gamehag.com/*/giveaway/*
- // @match https://gamehag.com/giveaway/*
- // @updateURL https://pastebin.com/raw/rtV3dC5m
- // @downloadURL https://pastebin.com/raw/rtV3dC5m
- // @grant none
- // @require https://code.jquery.com/jquery-3.2.1.min.js
- // ==/UserScript==
- (function() {
- 'use strict';
- var DELAY = 400; // ms. Increase if some tasks are not completed
- function complete ()
- {
- var tasks = [];
- jQuery(`a[href*="https://gamehag.com/ru/giveaway/click"]`).each(function (index, element) {tasks[index] = {"href": element.href, "btn": jQuery(element).parent().find("button")[0], "taskElem": jQuery(element).closest(".task-content")[0]};});
- var i = 0;
- var interval = setInterval(function ()
- {
- if (i < tasks.length) {
- jQuery.get(tasks[i].href);
- }
- if (i !== 0) {
- tasks[i - 1].btn.click();
- jQuery(tasks[i - 1].taskElem.firstElementChild).addClass("collapsed").attr("aria-expanded", "false");
- jQuery(tasks[i - 1].taskElem.lastElementChild).removeClass("show");
- }
- if (i >= tasks.length) {
- clearInterval(interval);
- return;
- }
- i++;
- }, DELAY);
- }
- jQuery("#getkey").parent().append(
- `<div id="solvetasks" class="btn btn-primary btn-lg" style="margin-left: 10px;" href="">
- выполни задания
- </div>`
- );
- jQuery("#solvetasks").click(complete);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement