feat: 0.0.7 去除debug模式
This commit is contained in:
parent
77ab9ba830
commit
af37b42d6d
19
index.html
19
index.html
@ -76,14 +76,14 @@ disableDevtool();</code>
|
|||||||
|
|
||||||
<h3>1.2 script attribute configuration</h3>
|
<h3>1.2 script attribute configuration</h3>
|
||||||
|
|
||||||
<p><code><script id='disable-devtool' src='https://cdn.jsdelivr.net/npm/disable-devtool/disable-devtool.min.js'></script></code></p>
|
<p><code><script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool/disable-devtool.min.js'></script></code></p>
|
||||||
|
|
||||||
<p>Or use cdn with version:</p>
|
<p>Or use cdn with version:</p>
|
||||||
|
|
||||||
<p><code><!--Use a specific version-->
|
<p><code><!--Use a specific version-->
|
||||||
<script id='disable-devtool' src='https://cdn.jsdelivr.net/npm/disable-devtool@x.x.x/disable-devtool.min.js'></script>
|
<script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool@x.x.x/disable-devtool.min.js'></script>
|
||||||
<!--Use latest version-->
|
<!--Use latest version-->
|
||||||
<script id='disable-devtool' src='https://cdn.jsdelivr.net/npm/disable-devtool@latest/disable-devtool.min.js'></script></code></p>
|
<script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool@latest/disable-devtool.min.js'></script></code></p>
|
||||||
|
|
||||||
<h2>2. Function</h2>
|
<h2>2. Function</h2>
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ disableDevtool(options);</code></p>
|
|||||||
<h3>3.2 script uses attribute configuration</h3>
|
<h3>3.2 script uses attribute configuration</h3>
|
||||||
|
|
||||||
<p><code><script
|
<p><code><script
|
||||||
id='disable-devtool'
|
disable-devtool-auto
|
||||||
src='https://cdn.jsdelivr.net/npm/disable-devtool/disable-devtool.min.js'
|
src='https://cdn.jsdelivr.net/npm/disable-devtool/disable-devtool.min.js'
|
||||||
md5='xxx'
|
md5='xxx'
|
||||||
url='xxx'
|
url='xxx'
|
||||||
@ -163,7 +163,7 @@ disableDevtool(options);</code></p>
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<p>Note:<br>
|
<p>Note:<br>
|
||||||
1. You must bring the id='disable-devtool'` attribute when configuring attributes<br>
|
1. You must bring the <strong>disable-devtool-auto</strong> attribute when configuring attributes<br>
|
||||||
2.Attribute configuration is optional, the fields are the same as in 3.1, the difference is that the hump form is
|
2.Attribute configuration is optional, the fields are the same as in 3.1, the difference is that the hump form is
|
||||||
changed to horizontal line division <br>
|
changed to horizontal line division <br>
|
||||||
3. The script tag is recommended to be placed at the bottom of the body</p>
|
3. The script tag is recommended to be placed at the bottom of the body</p>
|
||||||
@ -176,8 +176,13 @@ disableDevtool(options);</code></p>
|
|||||||
// The parameters are the same as in 3.1
|
// The parameters are the same as in 3.1
|
||||||
})
|
})
|
||||||
</script></code></p>
|
</script></code></p>
|
||||||
<script id='disable-devtool' md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='https://cdn.jsdelivr.net/npm/disable-devtool@latest/disable-devtool.min.js'></script>
|
<script
|
||||||
<!-- <script id='disable-devtool' md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='./npm/disable-devtool.min.js'></script> -->
|
disable-devtool-auto
|
||||||
|
md5='1aabac6d068eef6a7bad3fdf50a05cc8'
|
||||||
|
src='https://cdn.jsdelivr.net/npm/disable-devtool@latest/disable-devtool.min.js'
|
||||||
|
url='https://github.com/theajack/disable-devtool'
|
||||||
|
></script>
|
||||||
|
<!-- <script disable-devtool-auto md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='./npm/disable-devtool.min.js'></script> -->
|
||||||
<script>
|
<script>
|
||||||
function setText(text){
|
function setText(text){
|
||||||
document.getElementById('md5_value').innerText = text;
|
document.getElementById('md5_value').innerText = text;
|
||||||
|
2
npm/disable-devtool.min.js
vendored
2
npm/disable-devtool.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "disable-devtool",
|
"name": "disable-devtool",
|
||||||
"version": "0.0.6",
|
"version": "0.0.7",
|
||||||
"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": {
|
"scripts": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "disable-devtool",
|
"name": "disable-devtool",
|
||||||
"version": "0.0.6",
|
"version": "0.0.7",
|
||||||
"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",
|
||||||
|
40
src/main.js
40
src/main.js
@ -1,6 +1,6 @@
|
|||||||
import {disableKeyAndMenu} from './key-menu';
|
import {disableKeyAndMenu} from './key-menu';
|
||||||
import {initInterval, registInterval, clearTimeout} from './interval';
|
import {initInterval, registInterval, clearTimeout} from './interval';
|
||||||
import {formatName, getNowTime, getUrlParam} from './util';
|
import {formatName, getUrlParam} from './util';
|
||||||
import {mergeConfig, config} from './config';
|
import {mergeConfig, config} from './config';
|
||||||
import md5 from './md5';
|
import md5 from './md5';
|
||||||
import version from './version';
|
import version from './version';
|
||||||
@ -11,7 +11,7 @@ export function disableDevtool (opts) {
|
|||||||
initInterval();
|
initInterval();
|
||||||
disableKeyAndMenu();
|
disableKeyAndMenu();
|
||||||
initDevTool();
|
initDevTool();
|
||||||
initDebugger();
|
// initDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
disableDevtool.md5 = md5;
|
disableDevtool.md5 = md5;
|
||||||
@ -35,22 +35,22 @@ function checkTk () {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let disableDebug = false; // 当 initDevTool 方式生效时,去除debug断点
|
// let disableDebug = false; // 当 initDevTool 方式生效时,去除debug断点
|
||||||
|
// 去除debug的逻辑
|
||||||
function initDebugger () {
|
// function initDebugger () {
|
||||||
let debug = new Function('debugger');
|
// let debug = new Function('debugger');
|
||||||
registInterval(() => {
|
// registInterval(() => {
|
||||||
if (disableDebug) {
|
// if (disableDebug) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
var last = getNowTime();
|
// var last = getNowTime();
|
||||||
debug();
|
// // debug();
|
||||||
// interval 时间是 config.interval,设置config.debugDelay是为了给一个执行的时间
|
// // interval 时间是 config.interval,设置config.debugDelay是为了给一个执行的时间
|
||||||
if (getNowTime() - last > config.interval + config.debugDelay) {
|
// if (getNowTime() - last > config.interval + config.debugDelay) {
|
||||||
onDevToolOpen();
|
// onDevToolOpen();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
function initDevTool () {
|
function initDevTool () {
|
||||||
const isFF = ~navigator.userAgent.indexOf('Firefox');
|
const isFF = ~navigator.userAgent.indexOf('Firefox');
|
||||||
@ -58,13 +58,13 @@ function initDevTool () {
|
|||||||
if (isFF) {
|
if (isFF) {
|
||||||
toTest = /./;
|
toTest = /./;
|
||||||
toTest.toString = function () {
|
toTest.toString = function () {
|
||||||
disableDebug = true;
|
// disableDebug = true;
|
||||||
onDevToolOpen();
|
onDevToolOpen();
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
toTest = new Image();
|
toTest = new Image();
|
||||||
toTest.__defineGetter__('id', function () {
|
toTest.__defineGetter__('id', function () {
|
||||||
disableDebug = true;
|
// disableDebug = true;
|
||||||
onDevToolOpen();
|
onDevToolOpen();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
export default '0.0.6';
|
export default '0.0.7';
|
Loading…
x
Reference in New Issue
Block a user