File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -102,18 +102,21 @@ function drawAddTokenBtn(accessToken) {
102
102
JQ_POPUP_TITLE . html ( verb + ' GitHub Access Token' ) ;
103
103
}
104
104
105
- function automaticSearch ( split_url ) {
106
- JQ_REPO_FIELD . val ( split_url [ 1 ] ) ;
105
+ function automaticSearch ( searchValue ) {
106
+ JQ_REPO_FIELD . val ( searchValue ) ;
107
107
JQ_SEARCH_BTN . click ( ) ;
108
108
}
109
109
110
- /* Automatically queries when an URL parameter is present. */
111
- let url = window . location . href . split ( '?repository=' ) ;
112
- if ( url . length === 2 ) {
113
- automaticSearch ( url ) ;
114
- } else {
115
- url = window . location . href . split ( '?repo=' ) ;
116
- if ( url . length === 2 ) {
117
- automaticSearch ( url ) ;
110
+ function getRepoNameFromUrl ( ) {
111
+ let repo = new URLSearchParams ( location . search ) . get ( 'repo' ) ;
112
+ if ( ! repo ) {
113
+ repo = new URLSearchParams ( location . search ) . get ( 'repository' ) ;
118
114
}
115
+ return repo ;
116
+ }
117
+
118
+ /* Automatically queries when an URL parameter is present. */
119
+ const query = getRepoNameFromUrl ( ) ;
120
+ if ( query ) {
121
+ automaticSearch ( query ) ;
119
122
}
You can’t perform that action at this time.
0 commit comments