Created
July 22, 2016 06:39
-
-
Save pineoc/b1a96eea9b13a5b270b8b502a207e2df to your computer and use it in GitHub Desktop.
How to check Developer tool window open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInspectOpen() | |
{ | |
console.profile(); | |
console.profileEnd(); | |
if (console.clear) console.clear(); | |
return console.profiles.length > 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onresize = function() | |
{ | |
if ((window.outerHeight - window.innerHeight) > 100) | |
alert('Docked inspector was opened'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checkStatus; | |
var element = new Image(); | |
// var element = document.createElement('any'); | |
element.__defineGetter__('id', function() { | |
checkStatus = 'on'; | |
}); | |
setInterval(function() { | |
checkStatus = 'off'; | |
console.log(element); | |
console.clear(); | |
document.querySelector('#devtool-status').innerHTML = checkStatus; | |
}, 1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var element = new Image(); | |
Object.defineProperty(element, 'id', { | |
get: function () { | |
/* TODO */ | |
alert('囧'); | |
} | |
}); | |
console.log('%cHello', element); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment