Greasy Fork is available in English.

Github搜索净化

净化Github搜索页,屏蔽cirosantilli等400+人的敏感仓库。

< Spätná väzba na Github搜索净化

Hodnotenie: Dobré - skript funguje

§
Pridaný: 09.09.2023

将名单改为数组

(function (){
// ==UserScript==
// @name Github搜索净化
// @namespace https://github.com/danicastarr
// @version 1.0.0
// @description 搜索时屏蔽github上的用户CiroSantilli和wumaoland下的仓库
// @license GPLv3
// @author DanicaStar
// @include http*://github.com/search*
// @run-at document-end
// ==/UserScript==

// Github更新时可能会发生变化,需要手动更改!
// s为外面的圆角矩形,就是项目的卡片
// ts为仓库名
const s = 'div.Box-sc-g0xbh4-0.hKtuLA'
const ts = 'span.Text-sc-17v1xeu-0.qaOIC.search-match'
let pingbi=['cirosantilli','wumaoland','codin-stuffs','cheezcharmer','Dimples1337','Dujltqzv','gege-circle','PCL'];
function run() {
let sle = document.querySelectorAll(s);
sle.forEach((el) => {
let qs = el.querySelectorAll(ts)[0].innerHTML;
pingbi.forEach((shabi)=>{
if(qs.includes(shabi)){
el.remove()
}
})
})
}

// 首次运行
run()

// github 路由更新时
function pageChange(url) {
// 保证时机
setTimeout(() => {
run()
},700)
}



var _wr = function(type) {

var orig = history[type];
return function() {

var rv = orig.apply(this, arguments);

var e = new Event(type);
e.arguments = arguments;

window.dispatchEvent(e);
return rv;
}
}


history.pushState = _wr('pushState');
history.replaceState = _wr('replaceState');

window.addEventListener('replaceState', function(e) {
pageChange(location.href);
})
window.addEventListener('pushState', function(e) {
pageChange(location.href);
})


})();

Pridať odpoveď

Aby ste mohli pridať odpoveď, prihláste sa.