8
8
} from './repo-issue.ts' ;
9
9
import { initUnicodeEscapeButton } from './repo-unicode-escape.ts' ;
10
10
import { initRepoBranchTagSelector } from '../components/RepoBranchTagSelector.vue' ;
11
- import {
12
- initRepoCloneButtons , initRepoCommonBranchOrTagDropdown , initRepoCommonFilterSearchDropdown ,
13
- } from './repo-common.ts' ;
11
+ import { initRepoCloneButtons } from './repo-common.ts' ;
14
12
import { initCitationFileCopyContent } from './citation.ts' ;
15
13
import { initCompLabelEdit } from './comp/LabelEdit.ts' ;
16
14
import { initRepoDiffConversationNav } from './repo-diff.ts' ;
@@ -36,6 +34,33 @@ export function initBranchSelectorTabs() {
36
34
} ) ;
37
35
}
38
36
37
+ function initRepoCommonBranchOrTagDropdown ( selector : string ) {
38
+ $ ( selector ) . each ( function ( ) {
39
+ const $dropdown = $ ( this ) ;
40
+ $dropdown . find ( '.reference.column' ) . on ( 'click' , function ( ) {
41
+ hideElem ( $dropdown . find ( '.scrolling.reference-list-menu' ) ) ;
42
+ showElem ( $ ( $ ( this ) . data ( 'target' ) ) ) ;
43
+ return false ;
44
+ } ) ;
45
+ } ) ;
46
+ }
47
+
48
+ function initRepoCommonFilterSearchDropdown ( selector : string ) {
49
+ const $dropdown = $ ( selector ) ;
50
+ if ( ! $dropdown . length ) return ;
51
+
52
+ $dropdown . dropdown ( {
53
+ fullTextSearch : 'exact' ,
54
+ selectOnKeydown : false ,
55
+ onChange ( _text , _value , $choice ) {
56
+ if ( $choice [ 0 ] . getAttribute ( 'data-url' ) ) {
57
+ window . location . href = $choice [ 0 ] . getAttribute ( 'data-url' ) ;
58
+ }
59
+ } ,
60
+ message : { noResults : $dropdown [ 0 ] . getAttribute ( 'data-no-results' ) } ,
61
+ } ) ;
62
+ }
63
+
39
64
export function initRepository ( ) {
40
65
if ( ! $ ( '.page-content.repository' ) . length ) return ;
41
66
0 commit comments