|
10 | 10 |
|
11 | 11 | <body>
|
12 | 12 | <script>
|
13 |
| -var Version="1.0.230820"; |
| 13 | +var Version="1.0.240804"; |
14 | 14 | console.log("LICENSE: GPL-3.0, https://github.com/xiangyuecn/ACME-HTML-Web-Browser-Client/blob/main/LICENSE");
|
15 | 15 | /***********************************
|
16 | 16 | 中英对照翻译主要来自:Chrome自带翻译+百度翻译,由中文翻译成English(作者英文很菜)。
|
|
174 | 174 | +"\nvar PageRawHTML=`"
|
175 | 175 | +PageRawHTML.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"$\\{")
|
176 | 176 | +"`;";
|
| 177 | + codes+="\nvar PageErrs="+JSON.stringify({ |
| 178 | + e0:Lang("运行失败,可能是此浏览器阻止了代码执行,请尝试换个浏览器。","Run failed, may be because the browser blocked the code execution, please try another browser.",true) |
| 179 | + ,e1:Lang("运行失败,解决办法:即将自动跳转到此站点的首页或404页,然后请再次粘贴代码运行","Run failed, solution: automatically jump to the homepage or 404 page of this site, then paste the code again to run",true) |
| 180 | + })+";"; |
177 | 181 | codes+="\n("+(function(){
|
178 | 182 | console.clear();
|
179 |
| - document.head.innerHTML=/<head[^>]*>([\S\s]+?)<\/head>/i.exec(PageRawHTML)[1]; |
180 |
| - document.body.innerHTML=/<body[^>]*>([\S\s]+)<\/body>/i.exec(PageRawHTML)[1]; |
181 |
| - var js=/<script[^>]*>([\S\s]+?)<\/script>/ig,m; |
182 |
| - while(m=js.exec(PageRawHTML)) eval.call(window, m[1]); |
183 |
| - }).toString()+")()"; |
| 183 | + try{ |
| 184 | + document.head.innerHTML=/<head[^>]*>([\S\s]+?)<\/head>/i.exec(PageRawHTML)[1]; |
| 185 | + document.body.innerHTML=/<body[^>]*>([\S\s]+)<\/body>/i.exec(PageRawHTML)[1]; |
| 186 | + var js=/<script[^>]*>([\S\s]+?)<\/script>/ig,m; |
| 187 | + while(m=js.exec(PageRawHTML)) eval.call(window, m[1]); |
| 188 | + ACME.Directory.toString(); //保证js已正确执行 |
| 189 | + }catch(e){ setTimeout(function(){ //部分浏览器json页面无法显示,跳转到根目录重试 |
| 190 | + console.error(e); |
| 191 | + var url0=location.href, url=/^(.+\/\/[^\/\?#]+)/.exec(url0)[1]; |
| 192 | + if(url==url0 || url+"/"==url0) return console.error(PageErrs.e0); |
| 193 | + console.log(PageErrs.e1); console.warn(PageErrs.e1); console.error(PageErrs.e1); |
| 194 | + alert(PageErrs.e1); location.href=url; |
| 195 | + }); } |
| 196 | + }).toString()+")();\n"; |
184 | 197 | $(".gotoCORSBox").hide();
|
185 | 198 | var stateEl=$(".acmeReadDirState").append(`
|
186 | 199 | <div class="gotoCORSBox" style="padding-top:15px">
|
|
1678 | 1691 |
|
1679 | 1692 | var logTitle='/********** '+Lang($(".clientNameCN").html(),$(".clientNameEN").html(),true)+' *********/';
|
1680 | 1693 | logTxts.push(logTitle);
|
1681 |
| - logTxts.push(Lang("在线网址(GitHub):","Online website (GitHub): ", true)+'https://xiangyuecn.github.io/ACME-HTML-Web-Browser-Client/ACME-HTML-Web-Browser-Client.html'); |
1682 |
| - logTxts.push(Lang("在线网址(Gitee):","Online website (Gitee): ", true)+'https://xiangyuecn.gitee.io/acme-html-web-browser-client/ACME-HTML-Web-Browser-Client.html'); |
| 1694 | + logTxts.push(Lang("在线网址:","Online website: ", true)+'https://xiangyuecn.github.io/ACME-HTML-Web-Browser-Client/ACME-HTML-Web-Browser-Client.html'); |
1683 | 1695 | logTxts.push("");
|
1684 | 1696 | logTxts.push('GitHub: https://github.com/xiangyuecn/ACME-HTML-Web-Browser-Client');
|
1685 | 1697 | logTxts.push('Gitee: https://gitee.com/xiangyuecn/ACME-HTML-Web-Browser-Client');
|
|
2760 | 2772 | "use strict";
|
2761 | 2773 |
|
2762 | 2774 | /************** Language **************/
|
2763 |
| -window.LangCur=/\b(zh|cn)\b/i.test(navigator.language)?"cn":"en"; |
| 2775 | +window.LangCur=/\b(zh|cn)\b/i.test((""+navigator.language).replace(/_/g," "))?"cn":"en"; |
2764 | 2776 | window.Lang=function(cn,en,txt){
|
2765 | 2777 | if((cn||en) && (!cn||!en))throw new Error("Lang bad args");
|
2766 | 2778 | if(txt)return LangCur=="cn"?cn:en;
|
|
0 commit comments