Last active
May 24, 2023 07:12
-
-
Save eduidl/3a408c67a5b486ee4002104c4afcea82 to your computer and use it in GitHub Desktop.
Hide archived GitHub repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name HideArchivedRepository | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide archived repository | |
// @author eduidl | |
// @match https://github.com/* | |
// @icon https://github.com/favicon.ico | |
// @grant none | |
// ==/UserScript== | |
const ARCHIVED_OPACITY = 0.3; | |
(function() { | |
'use strict'; | |
const getRepos = () => { | |
let container = document.getElementById('org-repositories'); | |
if (container == undefined) { | |
container = document.getElementById('user-repositories-list'); | |
} | |
if (container == undefined) { | |
return []; | |
} | |
return container.getElementsByTagName('li'); | |
}; | |
const archived = (repo) => { | |
const tags = repo.querySelectorAll('span.Label'); | |
for (const tag of tags) { | |
if (tag.innerText.includes('archive')) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
const hideArchived = () => { | |
const repos = getRepos(); | |
for (const repo of repos) { | |
repo.style.opacity = archived(repo) ? ARCHIVED_OPACITY : 1.0; | |
} | |
}; | |
(function run() { | |
hideArchived(); | |
setTimeout(run, 200); | |
})(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment