feat: 0.1.8 add disable macos option+commond+i

This commit is contained in:
tackchen 2021-11-16 09:18:22 +08:00
parent f8d01801b8
commit ef686997b1
11 changed files with 37 additions and 48 deletions

View File

@ -60,3 +60,8 @@
2. Add FuncToString monitoring type
3. Add detectors configuration
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

View File

@ -60,3 +60,8 @@
2. 增加 FuncToString 监测类型
3. 增加 detectors 配置
4. 修复ios 15误伤问题
## 0.1.8
1. 禁用 macos option+commond+i
2. 删除部分调试代码与无用代码
3. 修改事件模型

View File

@ -184,7 +184,7 @@ declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3;</code></p>
<script
disable-devtool-auto
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 disable-devtool-auto md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='./npm/disable-devtool.min.js'></script> -->
<script>

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -6,12 +6,13 @@ import disableDevtool from '../src';
disableDevtool({
md5: '0b9e05caf5000360ec1c263335bd83fe', // ddtk
// url: 'https://www.qq.com',
// ondevtoolopen: () => {
ondevtoolopen: (type) => {
// window.location.href = 'https://www.qq.com';
// },
document.body.innerHTML = '1111' + type;
},
interval: 1000,
// tkName: 'ddtk',
// disableMenu: false
disableMenu: false,
// url: 'https://www.baidu.com'
// detectors: [disableDevtool.DETECTOR_TYPE.DATE_TO_STRING],
});

View File

@ -2,7 +2,7 @@
* @Author: theajack
* @Date: 2021-07-24 23:16:34
* @LastEditor: theajack
* @LastEditTime: 2021-11-15 23:55:08
* @LastEditTime: 2021-11-16 08:48:48
* @Description: Coding something
*/
@ -55,7 +55,6 @@ export function initDetectors () {
export function triggerOnDevOpen (type = DETECTOR_TYPE.UNKONW) {
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}】`);
if (config.clearIntervalWhenDevOpenTrigger) {
clearDDInterval();

View File

@ -1,22 +1,27 @@
import {config} from './config';
import {isMacOs} from './util';
export function disableKeyAndMenu () {
let key1 = 'shiftKey', key2 = 'ctrlKey';
if (isMacOs()) {
key1 = 'metaKey';
key2 = 'altKey';
}
window.addEventListener('keydown', (e) => {
e = e || window.event;
const keyCode = e.keyCode || e.which;
// alert(e.keyCode);
if (keyCode === 123 || (e.shiftKey && e.ctrlKey && e.keyCode === 73)) {
if (keyCode === 123 || (e[key1] && e[key2] && e.keyCode === 73)) {
e.returnValue = false;
e.preventDefault();
return false;
}
}, false);
}, true);
if (config.disableMenu) {
window.addEventListener('contextmenu', (e) => {
e = e || window.event;
e.returnValue = false;
e.preventDefault();
return false;
}, false);
}, true);
}
}

View File

@ -13,7 +13,7 @@ export function closeWindow () {
try {
window.opener = null;
window.open('', '_self');
// 需要是js跳转到这个页面才可以关闭这个页面
// 需要是js跳转到这个页面才可以关闭这个页面
window.close();
window.history.back();
} catch (e) {
@ -107,36 +107,6 @@ export function hackAlert (before, after) {
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 () {
return hasUaName('qqbrowser');
}
@ -145,6 +115,10 @@ export function isFirefox () {
return hasUaName('firefox');
}
export function isMacOs () {
return hasUaName('macintosh');
}
function hasUaName (name) {
return navigator.userAgent.toLocaleLowerCase().indexOf(name) !== -1;
}

View File

@ -1 +1 @@
export default '0.1.7';
export default '0.1.8';