Show me the code! – By Davanum Srinivas

September 3, 2008

[ubiquity] Block pesky browser plugins (flash etc)

Filed under: Uncategorized — Davanum Srinivas @ 1:06 pm

Inspired by the greasemonkey script here.

CmdUtils.CreateCommand({
    name: "block-plugins",
    execute: function(input) {
        var document = context.focusedWindow.document;

        e = document.evaluate("//embed", document, null, 6, null);
        for (i = 0; i < e.snapshotLength; i++) {
            var object = e.snapshotItem(i);
            object.parentNode.removeChild(object);
        }

        e = document.evaluate("//object", document, null, 6, null);
        for (i = 0; i < e.snapshotLength; i++) {
            var object = e.snapshotItem(i);
            object.parentNode.removeChild(object);
        }
    }
});

1 Comment »

  1. Couldn’t you replace the document.evaluate() calls with jquery $(//embed) call since ubiquity already requires JQuery

    Comment by Shakeel Mahate — September 5, 2008 @ 10:50 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.