禁用浏览器的翻译功能。火狐和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"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 10 Chrome versions",
|
||||
"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"
|
||||
"since 2015"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.22.1",
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
<meta name="x5-fullscreen" content="true" />
|
||||
<meta name="screen-orientation" content="landscape" />
|
||||
<meta name="x5-orientation" content="landscape" />
|
||||
<meta name="google" content="notranslate" />
|
||||
|
||||
<script>
|
||||
/*@cc_on window.location.href="http://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href); @*/
|
||||
</script>
|
||||
|
@ -54,6 +56,7 @@
|
|||
</head>
|
||||
<script src="./media_control_client_language.js"></script>
|
||||
<script type="text/javascript">
|
||||
function parseSearch() {
|
||||
window.user_search = {};
|
||||
var search = window.location.search;
|
||||
if (search.indexOf("?") != -1) {
|
||||
|
@ -70,6 +73,19 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
<body>
|
||||
|
|
Loading…
Reference in New Issue