trjp
<head> <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0"/> <style> body { color: #333; font-family: sans-serif; font-size: .8em; margin: 0; padding: 0 .5em; } ul { display: flex; flex-wrap: wrap; list-style: none; padding: .5em 0; } body > ul > li { box-shadow: 0 0 3px #aaa; min-width: 20%; } li { flex-grow: 1; text-align: center; } textarea { border: none; border-radius: 0; box-shadow: 1px 1px 3px #aaa; display: block; font-family: sans-serif; font-size: .8em; height: 300px; padding: .75em; width: 100%; } textarea:focus { outline: none; } button { background: #a99; border: none; box-shadow: 1px 1px 3px #aaa; color: #fff; cursor: pointer; padding: .25em .5em; text-shadow: 0 0 2px; transition: all .25s ease; } button:hover, button:active { text-shadow: 0 0 2px, 0 0 3px, 0 0 4px; } button:disabled,button:disabled:hover { background: #aaa; color: #888; text-shadow: none; } label { display: block; margin: 0 0 0 1em; } label input { display: none; } label input:checked + span::after { opacity: 1; transform: rotate(45deg) scale3d(1,1,1); } label input:checked + span::before { border-color: #666; } label span { box-sizing: border-box; cursor: pointer; display: inline-block; padding: 5px 0 5px 30px; position: relative; width: auto; } label span::after { border-bottom: 3px solid #a99; border-right: 6px solid #a99; content: ''; display: block; height: 20px; left: 7px; margin: -17px 0 0 0; opacity: 0; position: absolute; top: 50%; transform: rotate(45deg) translate3d(0,2px,0) scale3d(.7,.7,1); transition: all .2s ease-in-out; width: 9px; } label span::before { background: #fff; box-shadow: 1px 1px 3px #aaa; content: ''; display: block; height: 16px; left: 5px; margin: -9px 0 0 0; position: absolute; top: 50%; width: 16px; } </style> <script type="module"> (async()=>{ var ul = document.querySelector('ul'); var ta = document.querySelector('textarea'); var bt = document.querySelector('button'); var ip = document.querySelector('input'); bt.disabled = true; bt.innerHTML = '読み込み中...'; var wk = new Worker('./2'); var pm = (type, data) => wk.postMessage({type:type,data:data}); var JSONP = (url, cbName) => { return new Promise((_r, _e) => { window[cbName] = j => { delete window[cbName]; _r(j); } var s = document.createElement("script"); s.src = url; document.head.appendChild(s); s.onerror = e => { delete window[cbName]; _e(e); s.remove(); } }); } var ex = await JSONP('https://script.google.com/macros/s/AKfycbwIApltFvVC14GX0Dwex51-EM9R0z80Qj5ZWP3NiJfzkdwgp8w/exec', 'TR_DICT'); pm('dict', ex); bt.disabled = false; bt.innerHTML = '解析'; bt.onclick = e => { pm('input', [ta.value, ip.checked]); bt.disabled = true; bt.innerHTML = '解析中...'; } wk.onmessage = e => { switch(e.data.type) { case 'awaiting': bt.innerHTML = `解析中... (${(~~(e.data.data*10))/10}%)`; break; case 'result': ul.innerHTML = `${e.data.data.map(v=>'<li>'+v.word+' ('+v.class+'/'+v.type+')'+'<ul><li>'+v.mean+'</li></ul></li>').join('')}`; bt.disabled = false; bt.innerHTML = '解析'; break; default: throw new Error('[Main] Invalid type'); } } })(); </script> </head> <body> <ul></ul> <textarea placeholder="英文を入力してください">Special Containment Procedures: A circular perimeter has been established 2km from SCP-1730, and a quarantine zone has been established 1km from SCP-1730. Personnel who are to enter SCP-1730 must first undergo Class VII Hazardous Contact preparation measures, including the application of a modified "Maxwell-Harden" hazardous material reinforced airtight suit. The application of these protective measures may only take place at the Provisional Site-23 quarantine main gate. Individuals attempting to exit the quarantined area must first submit to thorough decontamination protocols as administered by the quarantine security staff. Individuals failing to meet the quarantine extraction parameters are to be held for further decontamination or, in the event decontamination becomes unfeasible, termination. Containment Update ██/██/████: Dangerous biological and cognitohazardous entities have resulted in high casualties of security rescue teams. Mobile Task Force Zeta-9 "Mole Rats" has been assigned to all current exploration efforts. Containment Update ██/██/████: Due to the events detailed in Exploration Log 7, all future exploration of SCP-1730 has been suspended indefinitely, pending Overseer approval. Containment Update 02/01/2016: Due to information gathered by Foundation surveillance teams, exploration and recovery efforts into Site-13 are no longer indefinitely suspended. Details will be available on a need-to-know basis. Assigned Mobile Task Force units will be alerted by their superior officers.</textarea> <button></button><label><input type="checkbox"><span>活用形も含めて検索する(演算量が爆発的に増えるため、長い文章は入力しないでください)</span></label> </body>
var data = {}; var tx = s=>((rs)=>(s.split(/([^a-z])/i).map(v=> (r=>(v.replace(/^(.+?)(ied|ed|ing)$/i,(_,a,b)=>(r=( b=='ied' && a.match(/[^aeiou]$/i) ?[a+'y'] :b=='ed'||b=='ing' ?(m=>m&&m[1]==m[2]&&(b=='ed'||m[1]!=='e')?[a.replace(/\S$/,'')]:[a,a+'e'])(a.match(/(\S)(\S)$/)) :[] ))),r.constructor==Array||(r=[v]),r))(v.replace(/'(s|)$/,'')) ).forEach(a=>(rs=a.map(_=>rs.map(r=>r+_)).flat(1))),rs.push(s),rs))(['']); onmessage = e => { console.log('[Worker] Receiving...'); switch(e.data.type) { case 'dict': e.data.data.forEach(v=>(data[v.title] = { word: v.title, class: {1:'名詞',2:'動詞',3:'形容詞',4:'副詞',5:'その他'}[v['form_raw{type1}']], type: {1:'通常語',2:'造語'}[v['form_raw{type2}']], mean: v['form_raw{mean}'].replace(/<(\/|)p>|<br.*?>/g,'').trim(), desc: v['form_raw{desc}'] })); break; case 'input': var res = []; var ipt = e.data.data[1] ? tx(e.data.data[0]) : [e.data.data[0]]; ipt.forEach((d,i)=>{ postMessage({type: 'awaiting', data: i / ipt.length * 100}); for(var k in data) { if(d.match(k)) { res.push(data[k]); } } }) postMessage({type: 'result', data: res.filter((v,i,a)=>a.indexOf(v)==i)}); break; default: throw new Error('[Worker] Invalid type'); } console.log('[Worker] Complete'); }






