From 2b43aaf5cde3f34c568344546b9590a875b86e6b Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 22 Nov 2018 21:15:42 +0800 Subject: [PATCH] Check console opened --- libs/utils.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/libs/utils.js b/libs/utils.js index 0a33d6da..ecf5178c 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -827,17 +827,10 @@ 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; - - 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; + var zoom = Math.min(window.outerWidth/window.innerWidth, window.outerHeight/window.innerHeight); + return window.outerWidth - zoom*window.innerWidth > threshold + || window.outerHeight - zoom*window.innerHeight > threshold; } utils.prototype.hashCode = function (obj) {