88} from './repo-issue.ts' ;
99import { initUnicodeEscapeButton } from './repo-unicode-escape.ts' ;
1010import { initRepoBranchTagSelector } from '../components/RepoBranchTagSelector.vue' ;
11- import {
12- initRepoCloneButtons , initRepoCommonBranchOrTagDropdown , initRepoCommonFilterSearchDropdown ,
13- } from './repo-common.ts' ;
11+ import { initRepoCloneButtons } from './repo-common.ts' ;
1412import { initCitationFileCopyContent } from './citation.ts' ;
1513import { initCompLabelEdit } from './comp/LabelEdit.ts' ;
1614import { initRepoDiffConversationNav } from './repo-diff.ts' ;
@@ -36,6 +34,33 @@ export function initBranchSelectorTabs() {
3634 } ) ;
3735}
3836
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+
3964export function initRepository ( ) {
4065 if ( ! $ ( '.page-content.repository' ) . length ) return ;
4166
0 commit comments