禁用浏览器的翻译功能。火狐和IE不支持。
该特性浏览器兼容情况: https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/translate
This commit is contained in:
parent
3d3dfd505f
commit
4272ee1d6e
10
package.json
10
package.json
|
@ -38,15 +38,7 @@
|
||||||
"workbox-webpack-plugin": "^6.4.2"
|
"workbox-webpack-plugin": "^6.4.2"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 10 Chrome versions",
|
"since 2015"
|
||||||
"last 10 Firefox versions",
|
|
||||||
"last 5 Edge versions",
|
|
||||||
"last 7 Safari versions",
|
|
||||||
"last 8 Android versions",
|
|
||||||
"last 8 ChromeAndroid versions",
|
|
||||||
"last 8 FirefoxAndroid versions",
|
|
||||||
"last 10 iOS versions",
|
|
||||||
"last 5 Opera versions"
|
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 12.22.1",
|
"node": ">= 12.22.1",
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
<meta name="x5-fullscreen" content="true" />
|
<meta name="x5-fullscreen" content="true" />
|
||||||
<meta name="screen-orientation" content="landscape" />
|
<meta name="screen-orientation" content="landscape" />
|
||||||
<meta name="x5-orientation" content="landscape" />
|
<meta name="x5-orientation" content="landscape" />
|
||||||
|
<meta name="google" content="notranslate" />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/*@cc_on window.location.href="http://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href); @*/
|
/*@cc_on window.location.href="http://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href); @*/
|
||||||
</script>
|
</script>
|
||||||
|
@ -54,22 +56,36 @@
|
||||||
</head>
|
</head>
|
||||||
<script src="./media_control_client_language.js"></script>
|
<script src="./media_control_client_language.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.user_search = {};
|
function parseSearch() {
|
||||||
var search = window.location.search;
|
window.user_search = {};
|
||||||
if (search.indexOf("?") != -1) {
|
var search = window.location.search;
|
||||||
search = search.substr(1);
|
if (search.indexOf("?") != -1) {
|
||||||
var temp = search.split("&");
|
search = search.substr(1);
|
||||||
for (var i = 0; i < temp.length; i++) {
|
var temp = search.split("&");
|
||||||
var info = temp[i].split("=");
|
for (var i = 0; i < temp.length; i++) {
|
||||||
if (info) {
|
var info = temp[i].split("=");
|
||||||
if (info.length >= 2) {
|
if (info) {
|
||||||
window.user_search[info[0]] = decodeURI(info[1]);
|
if (info.length >= 2) {
|
||||||
} else if (info.length >= 1) {
|
window.user_search[info[0]] = decodeURI(info[1]);
|
||||||
window.user_search[info[0]] = null;
|
} else if (info.length >= 1) {
|
||||||
|
window.user_search[info[0]] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setTranslateNo() {
|
||||||
|
for (let i = 0; i < document.children.length; ++i) {
|
||||||
|
const item = document.children[i];
|
||||||
|
if (item && item.nodeName.toUpperCase() == "HTML") {
|
||||||
|
item.setAttribute("translate", "no");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setTranslateNo();
|
||||||
|
parseSearch();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue