mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: handle search result page type
This commit is contained in:
parent
e0de62e968
commit
a5ddde1f7f
1 changed files with 3 additions and 0 deletions
|
|
@ -143,6 +143,7 @@ export function loadWithPJAX(URL: string) {
|
|||
const PAGE_TYPES = {
|
||||
RAW_TEXT: 'raw_text',
|
||||
RENDERED: 'rendered',
|
||||
SEARCH: 'search',
|
||||
// PREVIEW: 'preview',
|
||||
OTHERS: 'others',
|
||||
}
|
||||
|
|
@ -158,7 +159,9 @@ const PAGE_TYPES = {
|
|||
export function getCurrentPageType() {
|
||||
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) ||
|
||||
$(readmeSelector, () => PAGE_TYPES.RENDERED) ||
|
||||
PAGE_TYPES.OTHERS
|
||||
|
|
|
|||
Loading…
Reference in a new issue