fix: update DOM selectors

This commit is contained in:
EnixCoda 2020-06-20 19:16:28 +08:00
parent 8ae4834d67
commit 6043fe79ec
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -6,12 +6,15 @@ import { renderReact } from 'utils/general'
import { CopyFileButton, copyFileButtonClassName } from './CopyFileButton'
export function isInCodePage() {
const branchListSelector = '#branch-select-menu.branch-select-menu'
const branchListSelector = ['#branch-select-menu', '.branch-select-menu'].join()
return Boolean($(branchListSelector))
}
export function getCurrentBranch() {
const selectedBranchButtonSelector = '.repository-content .branch-select-menu summary'
const selectedBranchButtonSelector = [
'.repository-content #branch-select-menu summary',
'.repository-content .branch-select-menu summary',
].join()
const branchButtonElement: HTMLElement = $(selectedBranchButtonSelector)
if (branchButtonElement) {
const branchNameSpanElement = branchButtonElement.querySelector('span')