Greasy Fork is available in English.

BlockIdiotsInGithub

Block some idiots and their gibberish projects in search result

Verze ze dne 21. 02. 2024. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         BlockIdiotsInGithub
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Block some idiots and their gibberish projects in search result
// @description:zh-tw  屏蔽一些傻逼
// @author       zongren
// @match        *://github.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var shaBiList = [
        "cirosantilli",
        "codin-stuffs",
        "cheezcharmer",
        "Daravai1234",
        "tjqJ62cESiHPj6DdR6vXDAcPp",
    ]
    function isShaBi(href){
        for(var i = 0;i < shaBiList.length;i++){
            if(href.match("/"+shaBiList[i]+"/")){
                return true
            }
        }
        return false;
    }
    function deleteShaBi(){
        var searchResultList = document.querySelectorAll("[data-testid=\"results-list\"]")
        var foundShaBiList = []
        for(var i = 0;i < searchResultList.length;i++){
            var ele = searchResultList[i]
            var eleChildren = ele.children
            for(var k = 0;k < eleChildren.length;k++){
                var eleChild = eleChildren[k]
                var linkList = eleChild.getElementsByTagName("a")
                for(var j = 0;j < linkList.length;j++){
                    var linkEle = linkList[j]
                    if(linkEle.href && isShaBi(linkEle.href)){
                        foundShaBiList.push(eleChild)
                        console.log("找到一个傻逼:"+linkEle.href)
                        break
                    }
                }
            }
        }
        for(var h = 0;h < foundShaBiList.length;h++){
            console.log("delete one idiot")
            foundShaBiList[h].remove()
        }
    }
    var observeDOM = (function(){
        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

        return function( obj, callback ){
            if( !obj || obj.nodeType !== 1 ) return;

            if( MutationObserver ){
                // define a new observer
                var mutationObserver = new MutationObserver(callback)

                // have the observer observe for changes in children
                mutationObserver.observe( obj, { childList:true, subtree:true })
                return mutationObserver
            }

            // browser support fallback
            else if( window.addEventListener ){
                obj.addEventListener('DOMNodeInserted', callback, false)
                obj.addEventListener('DOMNodeRemoved', callback, false)
            }
        }
    })()
    observeDOM(document.body, function(m){
        deleteShaBi()
    });
    console.log("start monitor idiot")
})();