From 2f9e028eecea5b93109708958cb4a79b34ac3f8e Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 22 Nov 2018 20:56:58 +0800 Subject: [PATCH] Check Console Opened --- libs/utils.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libs/utils.js b/libs/utils.js index 206a0ea3..0a33d6da 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -825,12 +825,19 @@ utils.prototype.decodeCanvas = function (arr, width, height) { } utils.prototype.consoleOpened = function () { + if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized) + return true; + var zoom = [1,1.1,1.25,1.5,1.75,2]; + var ow = window.outerWidth, oh = window.outerHeight; + var iw = window.innerWidth, ih = window.innerHeight; var threshold = 160; - var widthThreshold = window.outerWidth - window.innerWidth > threshold; - var heightThreshold = window.outerHeight - window.innerHeight > threshold; - return !(heightThreshold && widthThreshold) && - ((window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized) - || widthThreshold || heightThreshold); + + for (var i in zoom) { + var cw = iw * zoom[i], ch = ih * zoom[i]; + if (cw>ow-threshold && ch>oh-threshold) return false; + if (cw>ow-threshold || ch>oh-threshold) return true; + } + return false; } utils.prototype.hashCode = function (obj) {