Skip to content

Commit fa08ec2

Browse files
committed
Support global SSO banner
1 parent 87d14cb commit fa08ec2

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

dist/github-auto-sso.user.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name GitHub - Auto SSO
33
// @namespace mkobayashime
4-
// @version 1.1.1
4+
// @version 1.2.0
55
// @description Attempt SSO if the banner exists on every pageload
66
// @icon https://www.google.com/s2/favicons?domain=github.com
77
// @author mkobayashime
@@ -14,6 +14,16 @@
1414

1515
// src/userscripts/github-auto-sso/index.user.ts
1616
void (() => {
17+
const globalSSOBannerSection = document.querySelector(
18+
"[data-testid='global-sso-banner']",
19+
);
20+
const ssoBannerActionAnchor = globalSSOBannerSection?.querySelector(
21+
"[class*='-Banner-BannerActionsContainer-'] a",
22+
);
23+
if (ssoBannerActionAnchor instanceof HTMLElement) {
24+
ssoBannerActionAnchor.click();
25+
return;
26+
}
1727
const ssoFormSubmitButton = document.querySelector(
1828
".business-sso-panel form button[type='submit']",
1929
);

src/userscripts/github-auto-sso/index.user.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@ import { defineUserScript } from "bundlemonkey";
22

33
export default defineUserScript({
44
name: "GitHub - Auto SSO",
5-
version: "1.1.1",
5+
version: "1.2.0",
66
description: "Attempt SSO if the banner exists on every pageload",
77
match: ["https://github.com/*"],
88
icon: "https://www.google.com/s2/favicons?domain=github.com",
99
main: () => {
10+
const globalSSOBannerSection = document.querySelector(
11+
"[data-testid='global-sso-banner']",
12+
);
13+
const ssoBannerActionAnchor = globalSSOBannerSection?.querySelector(
14+
"[class*='-Banner-BannerActionsContainer-'] a",
15+
);
16+
if (ssoBannerActionAnchor instanceof HTMLElement) {
17+
ssoBannerActionAnchor.click();
18+
return;
19+
}
20+
1021
const ssoFormSubmitButton = document.querySelector(
1122
".business-sso-panel form button[type='submit']",
1223
);

0 commit comments

Comments
 (0)