feat: support for version 3.12 and later (#298)

This commit is contained in:
조종훈 2024-03-28 16:49:56 +09:00 committed by GitHub
parent 69b0111382
commit 40dff715f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -66,20 +66,27 @@ export function processTree(tree: TreeNode[]): TreeNode {
}
export function isEnterprise() {
if (window.location.host === 'github.com') return false
return (
(window.location.host !== 'github.com' &&
/**
* <a class="Header-link " href="https://host.com/" data-hotkey="g d" aria-label="Homepage Enterprise">
* <span>Enterprise</span>
* </a>
*/
$(
[
'a.Header-link[aria-label="Homepage Enterprise"]',
'a.Header-link[aria-label="Homepage"]', // legacy support
].join(),
e => e.textContent?.trim() === 'Enterprise',
)) ||
/**
* <a class="AppHeader-logo" href="https://host.com/" data-hotkey="g d" aria-label="Homepage Enterprise">
* <svg></svg>
* </a>
*/
$('a.AppHeader-logo[aria-label="Homepage Enterprise"]') !== null ||
/**
* <a class="Header-link " href="https://host.com/" data-hotkey="g d" aria-label="Homepage Enterprise">
* <span>Enterprise</span>
* </a>
*/
$(
[
'a.Header-link[aria-label="Homepage Enterprise"]',
'a.Header-link[aria-label="Homepage"]', // legacy support
].join(),
e => e.textContent?.trim() === 'Enterprise',
) ||
false
)
}