feat: 0.1.1 优化

This commit is contained in:
tackchen 2021-01-25 10:29:25 +08:00
parent ef04db223c
commit ec4cdc8c4b
8 changed files with 21 additions and 14 deletions

View File

@ -34,4 +34,8 @@
1. 修复firefox和qq浏览器下无效的问题 1. 修复firefox和qq浏览器下无效的问题
2. 启用 disableMenu 配置 2. 启用 disableMenu 配置
3. 去除内部debug逻辑 3. 去除内部debug逻辑
4. 增加默认跳转的404页面 4. 增加默认跳转的404页面
## 0.1.1
1. 增加history.back 之后跳转默认页的延迟
2. 优化ondeltoolopen 逻辑

View File

@ -178,7 +178,7 @@ disableDevtool(options);</code></p>
<script <script
disable-devtool-auto disable-devtool-auto
md5='1aabac6d068eef6a7bad3fdf50a05cc8' md5='1aabac6d068eef6a7bad3fdf50a05cc8'
src='https://cdn.jsdelivr.net/npm/disable-devtool@0.1.0/disable-devtool.min.js#use' src='https://cdn.jsdelivr.net/npm/disable-devtool@0.1.1/disable-devtool.min.js#use'
></script> ></script>
<!-- <script disable-devtool-auto md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='./npm/disable-devtool.min.js'></script> --> <!-- <script disable-devtool-auto md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='./npm/disable-devtool.min.js'></script> -->
<script> <script>

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,8 @@
{ {
"name": "disable-devtool", "name": "disable-devtool",
"version": "0.1.0", "version": "0.1.1",
"description": "Disable web developer tools from the f12 button, right-click and browser ", "description": "Disable web developer tools from the f12 button, right-click and browser ",
"main": "disable-devtool.min.js", "main": "disable-devtool.min.js",
"scripts": {
},
"unpkg": "disable-devtool.min.js", "unpkg": "disable-devtool.min.js",
"jsdelivr": "disable-devtool.min.js", "jsdelivr": "disable-devtool.min.js",
"typings": "index.d.ts", "typings": "index.d.ts",

View File

@ -1,6 +1,6 @@
{ {
"name": "disable-devtool", "name": "disable-devtool",
"version": "0.1.0", "version": "0.1.1",
"description": "Disable web developer tools from the f12 button, right-click and browser ", "description": "Disable web developer tools from the f12 button, right-click and browser ",
"main": "disable-devtool.min.js", "main": "disable-devtool.min.js",
"unpkg": "disable-devtool.min.js", "unpkg": "disable-devtool.min.js",

View File

@ -20,11 +20,12 @@ let hasOpened = false;
export function onDevToolOpen () { export function onDevToolOpen () {
let time = new Date().getTime(); let time = new Date().getTime();
console.log('You ar not allow to use DEVTOOL!', time); console.log('You ar not allow to use DEVTOOL!', time);
if (hasOpened) {return {time, next () {}};}
if (!isQQBrowser()) { if (!isQQBrowser()) {
if (hasOpened) {return {time, next () {}};}
hasOpened = true; hasOpened = true;
} }
return {time, next () { return {time, next () {
hasOpened = true;
clearTimeout(); clearTimeout();
config.ondevtoolopen(); config.ondevtoolopen();
}}; }};

View File

@ -9,13 +9,17 @@ export function closeWindow () {
if (config.url) { if (config.url) {
window.location.href = config.url; window.location.href = config.url;
} else { } else {
window.opener = null; try {
window.open('', '_self'); window.opener = null;
window.close(); window.open('', '_self');
window.history.back(); window.close();
window.history.back();
} catch (e) {
console.log(e);
}
setTimeout(() => { setTimeout(() => {
window.location.href = `https://tackchen.gitee.io/404.html?h=${encodeURIComponent(location.host)}`; window.location.href = `https://tackchen.gitee.io/404.html?h=${encodeURIComponent(location.host)}`;
}, 100); }, 500);
} }
// 否则执行跳转到 url // 否则执行跳转到 url
} }

View File

@ -1 +1 @@
export default '0.1.0'; export default '0.1.1';