Skip to content

Instantly share code, notes, and snippets.

@eduidl
Last active May 24, 2023 07:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eduidl/3a408c67a5b486ee4002104c4afcea82 to your computer and use it in GitHub Desktop.
Save eduidl/3a408c67a5b486ee4002104c4afcea82 to your computer and use it in GitHub Desktop.
Hide archived GitHub repositories
// ==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