GITHUB

try to take over the world!

Stan na 14-10-2018. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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)
    }

})();