mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: show pull request title
This commit is contained in:
parent
e4a9277d12
commit
86a06f098b
2 changed files with 9 additions and 1 deletions
|
|
@ -10,6 +10,12 @@ export function isInCodePage() {
|
|||
return Boolean($(branchListSelector))
|
||||
}
|
||||
|
||||
export function getIssueTitle() {
|
||||
const title = $('.gh-header-title .js-issue-title')?.textContent
|
||||
const id = $('.gh-header-title .gh-header-number')?.textContent
|
||||
if (title && id) return `${id} ${title}`
|
||||
}
|
||||
|
||||
export function getCurrentBranch() {
|
||||
const selectedBranchButtonSelector = [
|
||||
'.repository-content #branch-select-menu summary',
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ export const GitHub: Platform = {
|
|||
}
|
||||
|
||||
let detectedBranchName
|
||||
if (DOMHelper.isInCodePage()) {
|
||||
if (URLHelper.isInPullPage()) {
|
||||
detectedBranchName = DOMHelper.getIssueTitle()
|
||||
} else if (DOMHelper.isInCodePage()) {
|
||||
// not working well with non-branch blob
|
||||
// cannot handle '/' split branch name, should not use when possibly on branch page
|
||||
detectedBranchName = DOMHelper.getCurrentBranch() || URLHelper.parseSHA()
|
||||
|
|
|
|||
Loading…
Reference in a new issue