mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: resolve page type more strictly
This commit is contained in:
parent
83c3b3e0e8
commit
eddc53e7ae
1 changed files with 2 additions and 1 deletions
|
|
@ -159,12 +159,13 @@ const PAGE_TYPES = {
|
|||
* TODO: distinguish type 'preview'
|
||||
*/
|
||||
export function getCurrentPageType() {
|
||||
const blobPathSelector = '#blob-path' // path next to branch switcher
|
||||
const blobWrapperSelector = '.repository-content .blob-wrapper table'
|
||||
const readmeSelector = '.repository-content .readme'
|
||||
const searchResultSelector = '.codesearch-results'
|
||||
return (
|
||||
$(searchResultSelector, () => PAGE_TYPES.SEARCH) ||
|
||||
$(blobWrapperSelector, () => PAGE_TYPES.RAW_TEXT) ||
|
||||
$(blobWrapperSelector, () => $(blobPathSelector, () => PAGE_TYPES.RAW_TEXT)) ||
|
||||
$(readmeSelector, () => PAGE_TYPES.RENDERED) ||
|
||||
PAGE_TYPES.OTHERS
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue