feat: 0.1.8 add disable macos option+commond+i
This commit is contained in:
parent
f8d01801b8
commit
ef686997b1
@ -60,3 +60,8 @@
|
|||||||
2. Add FuncToString monitoring type
|
2. Add FuncToString monitoring type
|
||||||
3. Add detectors configuration
|
3. Add detectors configuration
|
||||||
4. Fix ios 15 accidental injury problem
|
4. Fix ios 15 accidental injury problem
|
||||||
|
|
||||||
|
## 0.1.8
|
||||||
|
1. Disable macos option+commond+i
|
||||||
|
2. Delete some debugging code and useless code
|
||||||
|
3. Modify the event model
|
@ -60,3 +60,8 @@
|
|||||||
2. 增加 FuncToString 监测类型
|
2. 增加 FuncToString 监测类型
|
||||||
3. 增加 detectors 配置
|
3. 增加 detectors 配置
|
||||||
4. 修复ios 15误伤问题
|
4. 修复ios 15误伤问题
|
||||||
|
|
||||||
|
## 0.1.8
|
||||||
|
1. 禁用 macos option+commond+i
|
||||||
|
2. 删除部分调试代码与无用代码
|
||||||
|
3. 修改事件模型
|
@ -184,7 +184,7 @@ declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3;</code></p>
|
|||||||
<script
|
<script
|
||||||
disable-devtool-auto
|
disable-devtool-auto
|
||||||
md5='1aabac6d068eef6a7bad3fdf50a05cc8'
|
md5='1aabac6d068eef6a7bad3fdf50a05cc8'
|
||||||
src='https://cdn.jsdelivr.net/npm/disable-devtool@0.1.7/disable-devtool.min.js#use'
|
src='https://cdn.jsdelivr.net/npm/disable-devtool@0.1.8/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>
|
||||||
|
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.1.7",
|
"version": "0.1.8",
|
||||||
"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",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "disable-devtool",
|
"name": "disable-devtool",
|
||||||
"version": "0.1.7",
|
"version": "0.1.8",
|
||||||
"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",
|
||||||
|
@ -6,12 +6,13 @@ import disableDevtool from '../src';
|
|||||||
disableDevtool({
|
disableDevtool({
|
||||||
md5: '0b9e05caf5000360ec1c263335bd83fe', // ddtk
|
md5: '0b9e05caf5000360ec1c263335bd83fe', // ddtk
|
||||||
// url: 'https://www.qq.com',
|
// url: 'https://www.qq.com',
|
||||||
// ondevtoolopen: () => {
|
ondevtoolopen: (type) => {
|
||||||
// window.location.href = 'https://www.qq.com';
|
// window.location.href = 'https://www.qq.com';
|
||||||
// },
|
document.body.innerHTML = '1111' + type;
|
||||||
|
},
|
||||||
interval: 1000,
|
interval: 1000,
|
||||||
// tkName: 'ddtk',
|
// tkName: 'ddtk',
|
||||||
// disableMenu: false
|
disableMenu: false,
|
||||||
// url: 'https://www.baidu.com'
|
// url: 'https://www.baidu.com'
|
||||||
// detectors: [disableDevtool.DETECTOR_TYPE.DATE_TO_STRING],
|
// detectors: [disableDevtool.DETECTOR_TYPE.DATE_TO_STRING],
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: theajack
|
* @Author: theajack
|
||||||
* @Date: 2021-07-24 23:16:34
|
* @Date: 2021-07-24 23:16:34
|
||||||
* @LastEditor: theajack
|
* @LastEditor: theajack
|
||||||
* @LastEditTime: 2021-11-15 23:55:08
|
* @LastEditTime: 2021-11-16 08:48:48
|
||||||
* @Description: Coding something
|
* @Description: Coding something
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -55,7 +55,6 @@ export function initDetectors () {
|
|||||||
|
|
||||||
export function triggerOnDevOpen (type = DETECTOR_TYPE.UNKONW) {
|
export function triggerOnDevOpen (type = DETECTOR_TYPE.UNKONW) {
|
||||||
console.warn(`You ar not allow to use DEVTOOL! 【type = ${type}】`);
|
console.warn(`You ar not allow to use DEVTOOL! 【type = ${type}】`);
|
||||||
document.body.innerHTML = `You ar not allow to use DEVTOOL! 【type = ${type}】`;
|
|
||||||
// alert(`You ar not allow to use DEVTOOL! 【type = ${type}】`);
|
// alert(`You ar not allow to use DEVTOOL! 【type = ${type}】`);
|
||||||
if (config.clearIntervalWhenDevOpenTrigger) {
|
if (config.clearIntervalWhenDevOpenTrigger) {
|
||||||
clearDDInterval();
|
clearDDInterval();
|
||||||
|
@ -1,22 +1,27 @@
|
|||||||
import {config} from './config';
|
import {config} from './config';
|
||||||
|
import {isMacOs} from './util';
|
||||||
|
|
||||||
export function disableKeyAndMenu () {
|
export function disableKeyAndMenu () {
|
||||||
|
let key1 = 'shiftKey', key2 = 'ctrlKey';
|
||||||
|
if (isMacOs()) {
|
||||||
|
key1 = 'metaKey';
|
||||||
|
key2 = 'altKey';
|
||||||
|
}
|
||||||
window.addEventListener('keydown', (e) => {
|
window.addEventListener('keydown', (e) => {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
const keyCode = e.keyCode || e.which;
|
const keyCode = e.keyCode || e.which;
|
||||||
// alert(e.keyCode);
|
if (keyCode === 123 || (e[key1] && e[key2] && e.keyCode === 73)) {
|
||||||
if (keyCode === 123 || (e.shiftKey && e.ctrlKey && e.keyCode === 73)) {
|
|
||||||
e.returnValue = false;
|
e.returnValue = false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}, false);
|
}, true);
|
||||||
if (config.disableMenu) {
|
if (config.disableMenu) {
|
||||||
window.addEventListener('contextmenu', (e) => {
|
window.addEventListener('contextmenu', (e) => {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
e.returnValue = false;
|
e.returnValue = false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}, false);
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
36
src/util.js
36
src/util.js
@ -13,7 +13,7 @@ export function closeWindow () {
|
|||||||
try {
|
try {
|
||||||
window.opener = null;
|
window.opener = null;
|
||||||
window.open('', '_self');
|
window.open('', '_self');
|
||||||
// 需要是有js跳转到这个页面才可以关闭这个页面
|
// 需要是由js跳转到这个页面才可以关闭这个页面
|
||||||
window.close();
|
window.close();
|
||||||
window.history.back();
|
window.history.back();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -107,36 +107,6 @@ export function hackAlert (before, after) {
|
|||||||
window.prompt = mod(_prompt);
|
window.prompt = mod(_prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isIE () {
|
|
||||||
const userAgent = navigator.userAgent; // 取得浏览器的userAgent字符串
|
|
||||||
const isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; // 判断是否IE<11浏览器
|
|
||||||
const isEdge = userAgent.indexOf('Edge') > -1 && !isIE; // 判断是否IE的Edge浏览器
|
|
||||||
const isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf('rv:11.0') > -1;
|
|
||||||
return isIE || isEdge || isIE11;
|
|
||||||
// if (isIE) {
|
|
||||||
// let reIE = new RegExp('MSIE (\\d+\\.\\d+);');
|
|
||||||
// reIE.test(userAgent);
|
|
||||||
// let fIEVersion = parseFloat(RegExp['$1']);
|
|
||||||
// if (fIEVersion == 7) {
|
|
||||||
// return 7;
|
|
||||||
// } else if (fIEVersion == 8) {
|
|
||||||
// return 8;
|
|
||||||
// } else if (fIEVersion == 9) {
|
|
||||||
// return 9;
|
|
||||||
// } else if (fIEVersion == 10) {
|
|
||||||
// return 10;
|
|
||||||
// } else {
|
|
||||||
// return 6;// IE版本<=7
|
|
||||||
// }
|
|
||||||
// } else if (isEdge) {
|
|
||||||
// return 'edge';// edge
|
|
||||||
// } else if (isIE11) {
|
|
||||||
// return 11; // IE11
|
|
||||||
// } else {
|
|
||||||
// return -1;// 不是ie浏览器
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isQQBrowser () {
|
export function isQQBrowser () {
|
||||||
return hasUaName('qqbrowser');
|
return hasUaName('qqbrowser');
|
||||||
}
|
}
|
||||||
@ -145,6 +115,10 @@ export function isFirefox () {
|
|||||||
return hasUaName('firefox');
|
return hasUaName('firefox');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isMacOs () {
|
||||||
|
return hasUaName('macintosh');
|
||||||
|
}
|
||||||
|
|
||||||
function hasUaName (name) {
|
function hasUaName (name) {
|
||||||
return navigator.userAgent.toLocaleLowerCase().indexOf(name) !== -1;
|
return navigator.userAgent.toLocaleLowerCase().indexOf(name) !== -1;
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
export default '0.1.7';
|
export default '0.1.8';
|
Loading…
x
Reference in New Issue
Block a user