GITHUB

try to take over the world!

Mint 2018.10.14.. Lásd a legutóbbi verzió

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         GITHUB
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://github.com/**/stargazers**
// @grant        none
// ==/UserScript==


(function() {
    'use strict';

    window.onload = function() {
        setTimeout(() => {
            var $btnOn = document.querySelectorAll('.js-social-container:not(.on) .btn.btn-sm.js-toggler-target');
            var $btnDis = document.querySelectorAll('.js-social-container.on .btn.btn-sm.js-toggler-target');

            // Blocked by github
            if ($btnOn.length <= 2 && $btnDis.length <= 2) {
                return setTimeout(() => {
                    location.reload();
                }, 60000)
            }

            var unfollowList = [];
            $btnOn.forEach(item => {
                if(/Follow/.test(item.getAttribute('title'))) {
                    unfollowList.push(item);
                }
            })

            // Turn the page
            if(!unfollowList.length) {
                var $pList = document.querySelectorAll(".pagination a");
                var pIndex = $pList.length - 1;
                return document.querySelectorAll(".pagination a")[pIndex].click();
            }

            var nowIndex = 0;
            function clickFollow(unfollowList, nowIndex) {
                unfollowList[nowIndex].click();
                nowIndex++;
                if (nowIndex >= unfollowList.length) {
                    setTimeout(() => {
                        location.reload();
                    }, 100)
                } else {
                    setTimeout(() => {
                        clickFollow(unfollowList, nowIndex);
                    }, 300 + parseInt(Math.random()*300));
                }
            }

            clickFollow(unfollowList, nowIndex);
        }, 100)
    }

})();