2021-09-26 13:00:26 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en-us">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
2022-06-07 22:46:18 +00:00
|
|
|
<base href="https://fastly.jsdelivr.net/gh/fengdh/mdict-js/">
|
2021-09-26 13:00:26 +00:00
|
|
|
<title>mdict</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<link rel="stylesheet" type="text/css" href="selectize.default.css" media="screen">
|
|
|
|
<style>
|
|
|
|
#btnLookup {
|
|
|
|
border: none;
|
|
|
|
height: 36px;
|
|
|
|
font-size: 12pt;
|
|
|
|
font-weight: bold;
|
|
|
|
vertical-align: top;
|
|
|
|
border-radius: 3px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#btnLookup:not([disabled]) {
|
|
|
|
background: #1A4FDD;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
|
|
|
|
#dict-title {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
max-width: 300px;
|
|
|
|
font-size: 10px;
|
|
|
|
opacity: 0.9;
|
|
|
|
background: #DDD;
|
|
|
|
box-shadow: -2px -2px 4px 4px rgba(0, 0, 0, 0.3);
|
|
|
|
}
|
|
|
|
|
|
|
|
#dict-title * {
|
|
|
|
font-size: 10px!important;
|
|
|
|
}
|
|
|
|
|
|
|
|
#mdict-online-viewer {
|
|
|
|
font-size: 14px;
|
|
|
|
font-family: "Georgia", "Times New Roman";
|
2022-08-01 01:37:01 +00:00
|
|
|
height: 100%;
|
2021-09-26 13:00:26 +00:00
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
#mdict-online-viewer #definition {
|
|
|
|
font-size: 14px;
|
2022-08-01 01:37:01 +00:00
|
|
|
height: 100%;
|
2021-09-26 13:00:26 +00:00
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
#word + .selectize-control {
|
|
|
|
display: inline-block;
|
|
|
|
min-width: 18em;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
2021-10-19 07:31:46 +00:00
|
|
|
<script type="text/javascript" src="conf.js"></script>
|
|
|
|
<script src="require.js" data-main="mdict"></script>
|
2021-09-26 13:00:26 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<section class="main-content">
|
|
|
|
|
|
|
|
<div id="mdict-online-viewer">
|
|
|
|
Choose a dictionary file (*.mdx + optional *.mdd): <input id="dictfile" type="file" multiple>
|
|
|
|
<p>
|
|
|
|
<input id="word" type="text" value="">
|
|
|
|
<input id="btnLookup" type="button" value="look up" disabled="false">
|
|
|
|
|
|
|
|
<div id="dict-title"></div>
|
|
|
|
<div id="definition">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</section>
|
2021-10-19 07:31:46 +00:00
|
|
|
<script>
|
2022-09-11 11:44:16 +00:00
|
|
|
//?file=.../xx.xx,.../xx.xxx#word=
|
2022-09-10 11:44:17 +00:00
|
|
|
var dictinput = document.getElementById('dictfile');
|
|
|
|
var wordinput = document.getElementById('word');
|
|
|
|
var btnLookup = document.getElementById('btnLookup');
|
2022-08-03 08:57:07 +00:00
|
|
|
|
2022-09-11 11:44:16 +00:00
|
|
|
window.onhashchange = function() {
|
2022-09-10 11:25:14 +00:00
|
|
|
let v = location.hash.substring(6);
|
2022-09-11 11:44:16 +00:00
|
|
|
if(v.length>0){
|
|
|
|
wordinput.value = v;
|
|
|
|
//wordinput.dispatchEvent(new Event('change', {'bubbles': true}));
|
|
|
|
btnLookup.click();
|
|
|
|
}
|
|
|
|
};
|
2022-09-10 11:25:14 +00:00
|
|
|
|
2022-09-11 11:44:16 +00:00
|
|
|
{
|
|
|
|
let v = location.hash.substring(6);
|
|
|
|
wordinput.value = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2022-09-10 10:53:02 +00:00
|
|
|
let filenames = location.search.substring(6);
|
2022-09-11 11:44:16 +00:00
|
|
|
window.onload = function(){
|
2022-09-10 10:53:02 +00:00
|
|
|
if(filenames.length>0){
|
2022-09-11 11:44:16 +00:00
|
|
|
let clickurl = "i:5fdictinput.click():"+filenames;
|
|
|
|
location.href=clickurl;
|
|
|
|
//setTimeout(()=>{dictinput.dispatchEvent(new Event('change', {'bubbles': true}));},100);
|
|
|
|
|
|
|
|
var callbackTimer = setInterval(function() {
|
|
|
|
let files = dictinput.files;
|
|
|
|
if(files.length>0){
|
|
|
|
if(!btnLookup.disabled){
|
|
|
|
clearInterval(callbackTimer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}else
|
|
|
|
location.href=clickurl;
|
|
|
|
dictinput.dispatchEvent(new Event('change', {'bubbles': true}));
|
|
|
|
}, 100);
|
|
|
|
|
2022-09-10 10:53:02 +00:00
|
|
|
}
|
2022-09-10 11:25:14 +00:00
|
|
|
};
|
2022-07-26 09:05:35 +00:00
|
|
|
}
|
2021-10-19 07:31:46 +00:00
|
|
|
</script>
|
2021-09-26 13:00:26 +00:00
|
|
|
</body>
|
|
|
|
</html>
|