File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -864,6 +864,10 @@ header .nav a.uplink {
864
864
color : white;
865
865
}
866
866
867
+ header .nav div # searchbox {
868
+ margin-inline-start : auto;
869
+ }
870
+
867
871
body .page a .showmap {
868
872
color : white;
869
873
text-decoration : none;
Original file line number Diff line number Diff line change @@ -214,12 +214,48 @@ const PageContents = {
214
214
` ,
215
215
} ;
216
216
217
+ const SearchBox = {
218
+ components : { } ,
219
+ props : { } ,
220
+ methods : {
221
+ keyup ( event ) {
222
+ if ( event . key === "Enter" || event ?. keycode === 13 ) {
223
+ this . search ( ) ;
224
+ }
225
+ } ,
226
+ updateSearch ( event ) {
227
+ this . searchText = event . target . value ;
228
+ } ,
229
+ search ( ) {
230
+ const text = this . searchText ;
231
+ if ( ! text || ! text . trim ( ) ) return ;
232
+ const u = new URL (
233
+ "https://www.google.com/search?q=site%3Acldr.unicode.org%2F+"
234
+ ) ;
235
+ let q = u . searchParams . get ( "q" ) ;
236
+ q = q + text ; // append their search
237
+ u . searchParams . set ( "q" , q ) ;
238
+ document . location . assign ( u ) ; // Go!
239
+ } ,
240
+ } ,
241
+ setup ( ) {
242
+ const searchText = ref ( "" ) ;
243
+ return {
244
+ searchText,
245
+ } ;
246
+ } ,
247
+ template : `
248
+ <input size="30" placeholder="Search CLDR…" @keyup="keyup" :value="searchText" @input="updateSearch"/><button id="searchbutton" title="search" @click="search">🔎</button>
249
+ ` ,
250
+ } ;
251
+
217
252
const app = Vue . createApp (
218
253
{
219
254
components : {
220
255
AncestorPages,
221
256
SubPagesPopup,
222
257
SiteMap,
258
+ SearchBox,
223
259
} ,
224
260
setup ( props ) {
225
261
// the tree.json data
@@ -332,6 +368,9 @@ const app = Vue.createApp(
332
368
<AncestorPages :ancestorPages="ancestorPages"/>
333
369
334
370
</div>
371
+ <div id="searchbox">
372
+ <SearchBox />
373
+ </div>
335
374
</div>
336
375
</div>` ,
337
376
} ,
You can’t perform that action at this time.
0 commit comments