Advertisement
SoftJustman

Gamehag [Miped]

Dec 24th, 2017
28,449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Gamehag GA Solver
  3. // @version      0.3.2
  4. // @description  Easily complete tasks
  5. // @author       Justman
  6. // @match        https://gamehag.com/*/giveaway/*
  7. // @match        https://gamehag.com/giveaway/*
  8. // @updateURL    https://pastebin.com/raw/rtV3dC5m
  9. // @downloadURL  https://pastebin.com/raw/rtV3dC5m
  10. // @grant        none
  11. // @require      https://code.jquery.com/jquery-3.2.1.min.js
  12. // ==/UserScript==
  13.  
  14. (function() {
  15.     'use strict';
  16.  
  17.     var DELAY = 400; // ms. Increase if some tasks are not completed
  18.  
  19.     function complete ()
  20.     {
  21.         var tasks = [];
  22.         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]};});
  23.         var i = 0;
  24.         var interval = setInterval(function ()
  25.                                    {
  26.             if (i < tasks.length) {
  27.                 jQuery.get(tasks[i].href);
  28.             }
  29.             if (i !== 0) {
  30.                 tasks[i - 1].btn.click();
  31.                 jQuery(tasks[i - 1].taskElem.firstElementChild).addClass("collapsed").attr("aria-expanded", "false");
  32.                 jQuery(tasks[i - 1].taskElem.lastElementChild).removeClass("show");
  33.             }
  34.             if (i >= tasks.length) {
  35.                 clearInterval(interval);
  36.                 return;
  37.             }
  38.             i++;
  39.         }, DELAY);
  40.     }
  41.  
  42.     jQuery("#getkey").parent().append(
  43.         `<div id="solvetasks" class="btn btn-primary btn-lg" style="margin-left: 10px;" href="">
  44.         выполни задания
  45.         </div>`
  46.     );
  47.     jQuery("#solvetasks").click(complete);
  48. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement