Undiscovered Trending

Hide starred repos in trending and remove slob

当前为 2025-04-02 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Undiscovered Trending
// @namespace   shiftgeist
// @icon	https://github.com/fluidicon.png
// @match       https://github.com/trending*
// @grant       none
// @version     20250402
// @author      shiftgeist
// @description Hide starred repos in trending and remove slob
// @license     GNU GPLv3
// ==/UserScript==

function log(...params) {
  if (localStorage.getItem('undiscovered-debug') === 'true') {
    console.log('[undiscovered]', ...params)
  }
}

function main() {
  log('start of main')

  setTimeout(() => {
    log('delay done')

    const articles = document.querySelectorAll('article')

    for (article of articles) {
      if (
        // Already starred
        article.querySelector('.starred-button-icon').getClientRects().length > 0 ||
        // Contains AI
        [
          ' ai ',
          'ai assistant',
          'ai chat',
          'ai models',
          'ai-powered',
          'crypto',
          'deepseek',
          'defi',
          'gemini',
          'gpt',
          'llm',
          'mcp',
          'ollama',
          'openai',
          'qwenlm',
        ].findIndex(e => article.innerText.toLowerCase().includes(e)) >= 0
      ) {
        article.style.display = 'none'
      }
    }
  }, 300)
}

log('init')

let previousUrl = ''
const observer = new MutationObserver(function (mutations) {
  if (location.href !== previousUrl) {
    previousUrl = location.href
    main()
  }
})
const config = { subtree: true, childList: true }
observer.observe(document, config)