From b00e3f9e835e9efb74c5f98d43a4645716328de5 Mon Sep 17 00:00:00 2001 From: Pablo Varela Date: Wed, 28 Jun 2017 19:21:13 -0400 Subject: [PATCH] Hide repo description when it's empty (#553) * Hide repo description when it's empty * Hide empty description only for users without edit permissions * Fix indentation * Hide empty description to save space --- extension/content.css | 5 +++++ src/content.js | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/extension/content.css b/extension/content.css index 15cbfa2..b54ade0 100644 --- a/extension/content.css +++ b/extension/content.css @@ -681,3 +681,8 @@ tt, a.tabnav-extra[href$="mastering-markdown/"] { display: none !important; } + +/* Hide empty description of repo */ +.repository-meta.mb-3 > .repository-meta-content > em { + display: none !important; +} diff --git a/src/content.js b/src/content.js index 697bcfc..0f37f8f 100644 --- a/src/content.js +++ b/src/content.js @@ -106,6 +106,15 @@ function renameInsightsDropdown() { } } +function hideEmptyMeta() { + if (pageDetect.isRepoRoot()) { + const meta = select('.repository-meta'); + if (select.exists('em', meta) && !select.exists('.js-edit-repo-meta-button')) { + meta.style.display = 'none'; + } + } +} + function addReleasesTab() { const $repoNav = $('.js-repo-nav'); let $releasesTab = $repoNav.children('[data-selected-links~="repo_releases"]'); @@ -518,6 +527,7 @@ function init(options) { if (pageDetect.isRepo()) { gitHubInjection(window, () => { + hideEmptyMeta(); addReleasesTab(); removeProjectsTab(); addCompareLink();