Browse Source

Add 'More' dropdown to GH Enterprise (#619)

master
Scott Busche 7 years ago
committed by Federico Brigante
parent
commit
a34e350c4b
  1. 5
      extension/content.css
  2. 17
      src/content.js

5
extension/content.css

@ -694,3 +694,8 @@ a.tabnav-extra[href$="mastering-markdown/"] {
font-size: 11px !important;
padding: 2px 3px 3px 3px !important;
}
/* Fix for GHE More Dropdown positioning */
.reponav-dropdown.active .dropdown-menu {
left: auto !important;
}

17
src/content.js

@ -104,6 +104,21 @@ function renameInsightsDropdown() {
const dropdown = select('.reponav-item.reponav-dropdown');
if (dropdown) {
dropdown.firstChild.textContent = 'More ';
} else {
// GHE doesn't have the Insights dropdown currently, so create a dropdown
const moreDropdown = <div class="reponav-dropdown js-menu-container">
<button type="button" class="btn-link reponav-item reponav-dropdown js-menu-target " data-no-toggle="" aria-expanded="false" aria-haspopup="true">More <svg aria-hidden="true" class="octicon octicon-triangle-down v-align-middle text-y" height="11" version="1.1" viewBox="0 0 12 16" width="8"><path fill-rule="evenodd" d="M0 5l6 6 6-6z"></path></svg></button>
<div class="dropdown-menu-content js-menu-content">
<div class="dropdown-menu dropdown-menu-sw"></div>
</div>
</div>;
const settingsTab = select('[data-selected-links~="repo_settings"]');
if (settingsTab) {
settingsTab.parentNode.insertBefore(moreDropdown, settingsTab);
} else {
select('.reponav').appendChild(moreDropdown);
}
}
}
@ -559,10 +574,10 @@ async function onDomReady() {
if (pageDetect.isRepo()) {
gitHubInjection(window, () => {
hideEmptyMeta();
renameInsightsDropdown();
addReleasesTab();
removeProjectsTab();
addCompareLink();
renameInsightsDropdown();
addTitleToEmojis();
addReadmeButtons();

Loading…
Cancel
Save