add AI engines
[uweb.git] / zh / searchurl / txt / mdict.html
blob94399516366d4560a365cc4330c1922443561597
1 <!DOCTYPE html>
2 <html lang="en-us">
3 <head>
4 <meta charset="UTF-8">
5 <base href="https://fastly.jsdelivr.net/gh/fengdh/mdict-js/">
6 <title>mdict</title>
7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <link rel="stylesheet" type="text/css" href="selectize.default.css" media="screen">
9 <style>
10 #btnLookup {
11 border: none;
12 height: 36px;
13 font-size: 12pt;
14 font-weight: bold;
15 vertical-align: top;
16 border-radius: 3px;
19 #btnLookup:not([disabled]) {
20 background: #1A4FDD;
21 color: white;
24 #dict-title {
25 display:none;
28 #word + .selectize-control {
29 display: inline-block;
30 min-width: 18em;
33 </style>
34 <script type="text/javascript" src="conf.js"></script>
35 <script src="require.js" data-main="mdict"></script>
36 </head>
37 <body>
38 Choose a dictionary file (*.mdx + optional *.mdd): <input id="dictfile" type="file" multiple>
39 <p>
40 <input id="word" type="text" value="">
41 <input id="btnLookup" type="button" value="look up" disabled="false">
43 <div id="dict-title"></div>
44 <div id="definition">
45 </div>
46 <script>
47 //?file=.../xx.xx,.../xx.xxx#word=
48 var dictinput = document.getElementById('dictfile');
49 var wordinput = document.getElementById('word');
50 var btnLookup = document.getElementById('btnLookup');
52 window.onhashchange = function() {
53 let v = location.hash.substring(6);
54 if(v.length>0){
55 wordinput.value = v;
56 //wordinput.dispatchEvent(new Event('change', {'bubbles': true}));
57 btnLookup.click();
62 let v = decodeURIComponent(location.hash.substring(6));
63 wordinput.value = v;
67 let filenames = location.search.substring(6);
68 window.onload = function(){
69 if(filenames.length>0){
70 let clickurl = "i:5fdictinput.click():"+filenames;
71 location.href=clickurl;
72 //setTimeout(()=>{dictinput.dispatchEvent(new Event('change', {'bubbles': true}));},100);
74 var callbackTimer = setInterval(function() {
75 let files = dictinput.files;
76 if(files.length>0){
77 if(!btnLookup.disabled){
78 clearInterval(callbackTimer);
79 return;
81 }else
82 location.href=clickurl;
83 dictinput.dispatchEvent(new Event('change', {'bubbles': true}));
84 }, 100);
89 </script>
90 </body>
91 </html>