Skip to content

Commit bdad4ff

Browse files
Assure that there is only 1 primary button on GitHub pages
1 parent 4120ebd commit bdad4ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/injectors/github-injector.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ abstract class ButtonInjectorBase implements ButtonInjector {
105105
} else {
106106
actionbar.appendChild(btn);
107107
}
108+
109+
const primaryButtons = actionbar.getElementsByClassName("btn-primary");
110+
if (primaryButtons && primaryButtons.length > 1) {
111+
Array.from(primaryButtons)
112+
.slice(0, primaryButtons.length - 1)
113+
.forEach(primaryButton => primaryButton.classList.replace("btn-primary", "btn-secondary"));
114+
}
108115
}
109116

110117
protected renderButton(url: string, openAsPopup: boolean): HTMLElement {

0 commit comments

Comments
 (0)