Skip to content

Commit

Permalink
feat: 0.2.3 - view version.md for details
Browse files Browse the repository at this point in the history
  • Loading branch information
theajack committed Feb 9, 2022
1 parent 21d17b2 commit a36c93b
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.cn.md
Expand Up @@ -114,6 +114,7 @@ declare interface optionStatic {
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控 默认为false, 在使用ondevtoolclose时该参数无效
detactors?: Array<DETECTOR_TYPE>; // 启用的检测器 检测器详情见 3.5 默认为全部,建议使用全部
clearLog?: boolean; // 是否每次都清除log
}

declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 45; // 检测器详情见 3.5
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -112,6 +112,7 @@ declare interface optionStatic {
disableMenu?: boolean; // Whether to disable the right-click menu The default is true
clearIntervalWhenDevOpenTrigger?: boolean; // Whether to stop monitoring after triggering The default is false. This parameter is invalid when using ondevtoolclose
detactors?: Array<DETECTOR_TYPE>; // Enabled detectors For details of detectors, see 3.5. The default is all, it is recommended to use all
clearLog?: boolean; // Whether to clear the log every time
}

declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 45; // For details of the detector, see 3.5
Expand Down
6 changes: 5 additions & 1 deletion helper/version.en.md
Expand Up @@ -84,4 +84,8 @@
1. Add ondevtoolclose configuration
2. Add isDevToolOpened api
3. Fix the accidental injury problem of ios mobile chrome
4. Added a debug page
4. Added a debug page

## 0.2.3
1. Opening the sidebar under edge will cause accidental injury, so disable sizeDetector under edge
2. Increase the clearLog parameter to control whether the console is required for each situation, the default is true
6 changes: 5 additions & 1 deletion helper/version.md
Expand Up @@ -85,4 +85,8 @@
1. 增加 ondevtoolclose 配置
2. 增加 isDevToolOpened api
3. 修复 ios mobile chrome 的误伤问题
4. 增加了一个debug页面
4. 增加了一个debug页面

## 0.2.3
1. edge 下打开侧边栏会误伤,所以禁用edge下的sizeDetector
2. 增加clearLog参数,控制是否需要每次情况控制台,默认为true
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -183,7 +183,7 @@ <h3>3.3 script does not use attribute configuration</h3>
<script
disable-devtool-auto
md5='1aabac6d068eef6a7bad3fdf50a05cc8'
src='https://cdn.jsdelivr.net/npm/disable-devtool@0.2.2/disable-devtool.min.js#use'
src='https://cdn.jsdelivr.net/npm/disable-devtool@0.2.3/disable-devtool.min.js#use'
></script>
<!-- <script disable-devtool-auto md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='./npm/disable-devtool.min.js'></script> -->
<script>
Expand Down
1 change: 1 addition & 0 deletions npm/README.md
Expand Up @@ -112,6 +112,7 @@ declare interface optionStatic {
disableMenu?: boolean; // Whether to disable the right-click menu The default is true
clearIntervalWhenDevOpenTrigger?: boolean; // Whether to stop monitoring after triggering The default is false. This parameter is invalid when using ondevtoolclose
detactors?: Array<DETECTOR_TYPE>; // Enabled detectors For details of detectors, see 3.5. The default is all, it is recommended to use all
clearLog?: boolean; // Whether to clear the log every time
}

declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 45; // For details of the detector, see 3.5
Expand Down
2 changes: 1 addition & 1 deletion npm/disable-devtool.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions npm/index.d.ts
Expand Up @@ -11,6 +11,7 @@ declare interface optionStatic {
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控
detectors: Array<DETECTOR_TYPE>; // 启用的监测器 默认为全部
clearLog?: boolean; // 是否每次都清除log
}
declare interface DDTStatic {
(option?: optionStatic): void;
Expand Down
2 changes: 1 addition & 1 deletion npm/package.json
@@ -1,6 +1,6 @@
{
"name": "disable-devtool",
"version": "0.2.2",
"version": "0.2.3",
"description": "Disable web developer tools from the f12 button, right-click and browser ",
"main": "disable-devtool.min.js",
"unpkg": "disable-devtool.min.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "disable-devtool",
"version": "0.2.2",
"version": "0.2.3",
"description": "Disable web developer tools from the f12 button, right-click and browser ",
"main": "disable-devtool.min.js",
"unpkg": "disable-devtool.min.js",
Expand Down
1 change: 1 addition & 0 deletions public/main.js
Expand Up @@ -22,6 +22,7 @@ disableDevtool({
interval: 1000,
// tkName: 'ddtk',
disableMenu: false,
clearLog: false,
// url: 'https://www.baidu.com'
// detectors: [disableDevtool.DETECTOR_TYPE.DATE_TO_STRING],
});
Expand Down
6 changes: 5 additions & 1 deletion src/detector/size.js
Expand Up @@ -8,7 +8,7 @@
*/

import {clearDevToolOpenState} from '../utils/open-state';
import {isInIframe} from '../utils/util';
import {isEdge, isInIframe} from '../utils/util';
import {DETECTOR_TYPE, triggerOnDevOpen} from './detector';

function checkWindowSizeUneven () {
Expand Down Expand Up @@ -46,6 +46,10 @@ export default function detector () {
console.warn('SizeDetector is disabled in IFrame');
return;
}
if (isEdge) {
console.warn('SizeDetector is disabled in Edge');
return;
}
checkWindowSizeUneven();
window.addEventListener('resize', () => {
setTimeout(checkWindowSizeUneven, 100);
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Expand Up @@ -11,6 +11,7 @@ declare interface optionStatic {
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控
detectors: Array<DETECTOR_TYPE>; // 启用的监测器 默认为全部
clearLog?: boolean; // 是否每次都清除log
}
declare interface DDTStatic {
(option?: optionStatic): void;
Expand Down
1 change: 1 addition & 0 deletions src/utils/config.js
Expand Up @@ -11,6 +11,7 @@ export const config = {
stopIntervalTime: 5000, // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger: false, // 是否在触发之后停止监控
detectors: 'all',
clearLog: true,
};

const MultiTypeKeys = ['detectors', 'ondevtoolclose'];
Expand Down
10 changes: 8 additions & 2 deletions src/utils/log.js
Expand Up @@ -2,9 +2,10 @@
* @Author: tackchen
* @Date: 2021-12-24 13:18:23
* @LastEditors: tackchen
* @FilePath: /disable-devtool/src/log.js
* @FilePath: /disable-devtool/src/utils/log.js
* @Description: Coding something
*/
import {config} from './config';
import {isIE} from './util';

const console = window.console || {
Expand All @@ -18,7 +19,12 @@ export const log = (() => {
return isIE ? ((...args) => {return console.log(...args);}) : console.log;
})();

export const clearLog = (() => {
const clearLogFunc = (() => {
// ie 不支持缓存使用 log等方法
return isIE ? (() => {return console.clear();}) : console.clear;
})();

export function clearLog () {
if (config.clearLog)
clearLogFunc();
}
4 changes: 3 additions & 1 deletion src/utils/util.js
Expand Up @@ -107,7 +107,9 @@ export const isFirefox = hasUaName('firefox');

export const isMacOs = hasUaName('macintosh');

export const isOldEdge = hasUaName('edge') && !hasUaName('chrome');
export const isEdge = hasUaName('edge');

export const isOldEdge = isEdge && !hasUaName('chrome');

export const isIE = isOldEdge || hasUaName('trident') || hasUaName('msie');

Expand Down
2 changes: 1 addition & 1 deletion src/version.js
@@ -1 +1 @@
export default '0.2.2';
export default '0.2.3';

0 comments on commit a36c93b

Please sign in to comment.