Skip to content

Commit 3842552

Browse files
Assure that there is only 1 primary button on GitLab pages
1 parent bdad4ff commit 3842552

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/injectors/gitlab-injector.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ class RepositoryInjector implements ButtonInjector {
6969

7070
const btn = this.renderButton(currentUrl, openAsPopup);
7171
parent.firstElementChild.appendChild(btn);
72+
73+
const primaryButtons = parent.firstElementChild.getElementsByClassName("btn-primary");
74+
if (primaryButtons && primaryButtons.length > 1) {
75+
Array.from(primaryButtons)
76+
.slice(0, primaryButtons.length - 1)
77+
.forEach(primaryButton => {
78+
primaryButton.classList.remove("btn-primary");
79+
Array.from(primaryButton.getElementsByTagName("svg")).forEach(svg => svg.style.fill = "currentColor")
80+
});
81+
}
7282
}
7383

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

0 commit comments

Comments
 (0)