Skip to content

Commit

Permalink
Hide repo description when it's empty (refined-github#553)
Browse files Browse the repository at this point in the history
* Hide repo description when it's empty

* Hide empty description only for users without edit permissions

* Fix indentation

* Hide empty description to save space
  • Loading branch information
pablopunk authored and hkdobrev committed Jun 28, 2017
1 parent bdb655a commit b00e3f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extension/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
10 changes: 10 additions & 0 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]');
Expand Down Expand Up @@ -518,6 +527,7 @@ function init(options) {

if (pageDetect.isRepo()) {
gitHubInjection(window, () => {
hideEmptyMeta();
addReleasesTab();
removeProjectsTab();
addCompareLink();
Expand Down

0 comments on commit b00e3f9

Please sign in to comment.