您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
- // ==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)
- }
- })();