Skip to content

Instantly share code, notes, and snippets.

@vicramon
Created November 28, 2013 18:08
Show Gist options
  • Select an option

  • Save vicramon/7696084 to your computer and use it in GitHub Desktop.

Select an option

Save vicramon/7696084 to your computer and use it in GitHub Desktop.

Revisions

  1. vicramon created this gist Nov 28, 2013.
    33 changes: 33 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    // 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()
    });