mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: resolve new GitHub DOM
This commit is contained in:
parent
db8ec597df
commit
17f785e5c4
3 changed files with 9 additions and 6 deletions
|
|
@ -5,6 +5,14 @@ import { $ } from 'utils/DOMHelper'
|
|||
import { renderReact } from 'utils/general'
|
||||
import { CopyFileButton, copyFileButtonClassName } from './CopyFileButton'
|
||||
|
||||
export function isInRepoPage() {
|
||||
const repoHeadSelector = '.repohead' // legacy
|
||||
const authorNameSelector = '.author[itemprop="author"]'
|
||||
return Boolean(
|
||||
document.querySelector(repoHeadSelector) || document.querySelector(authorNameSelector),
|
||||
)
|
||||
}
|
||||
|
||||
export function isInCodePage() {
|
||||
const branchListSelector = ['#branch-select-menu', '.branch-select-menu'].join()
|
||||
return Boolean($(branchListSelector))
|
||||
|
|
|
|||
|
|
@ -24,11 +24,6 @@ export function parseSHA() {
|
|||
return type === 'blob' || type === 'tree' ? path[0] : undefined
|
||||
}
|
||||
|
||||
export function isInRepoPage() {
|
||||
const repoHeaderSelector = '.repohead'
|
||||
return Boolean(document.querySelector(repoHeaderSelector))
|
||||
}
|
||||
|
||||
export function isInPullPage() {
|
||||
const { type, path } = parse()
|
||||
return type === 'pull' ? path[0] : false
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export function isEnterprise() {
|
|||
export const GitHub: Platform = {
|
||||
isEnterprise,
|
||||
resolveMeta() {
|
||||
if (!URLHelper.isInRepoPage()) {
|
||||
if (!DOMHelper.isInRepoPage()) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue