Created
November 28, 2013 18:08
-
-
Save vicramon/7696084 to your computer and use it in GitHub Desktop.
Vimium Detection
This file contains 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
// Detect the Vimium Chrome extension by Evan Hahn (evanhahn.com) | |
;(function(doc) { | |
doc.hasVimium = function() { | |
return doc.getElementsByClassName('vimiumReset').length > 0; | |
}; | |
doc.onDetectVimium = function(callback, scope) { | |
scope || (scope = window); | |
if (doc.hasVimium()) { | |
callback.call(scope); | |
} | |
else { | |
var interval = setInterval(function() { | |
if (doc.hasVimium()) { | |
clearInterval(interval); | |
callback.call(scope); | |
} | |
}, 1000); | |
} | |
}; | |
})(document); | |
document.onDetectVimium(function() { | |
$('#vimium_warning').show() | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment