GITHUB

try to take over the world!

2018-10-14 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

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

})();