venkman.js, adblockplus.js: whitespace, style, 'require' fix
[conkeror/arlinius.git] / modules / extensions / adblockplus.js
blobd3041382ce31acb938f211e0d6a1da1d31e823b5
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 require("extension.js");
10 if (!extension_is_enabled("{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}"))
11     throw skip_module_load;
14 var adblockplus_service = Cc["@mozilla.org/adblockplus;1"]
15     .createInstance().wrappedJSObject;
18 function adblockplus_settings (buffer, uri_string) {
19     var frame = null;
20     if (buffer)
21         frame = buffer.top_frame;
22     adblockplus_service.openSettingsDialog(frame, uri_string);
24 interactive("adblockplus-settings",
25     "Show the Adblock Plus settings dialog.",
26     function (I) { adblockplus_settings(I.buffer); });
29 interactive("adblockplus-add",
30     "Add a pattern to Adblock Plus.",
31     function (I) {
32         var element = yield read_browser_object(I);
33         var spec = load_spec(element);
34         var pattern = yield I.minibuffer.read_url(
35             $prompt = "Adblock:",
36             $initial_value = load_spec_uri_string(spec),
37             $history = "url");
38         adblockplus_service.addPatterns([load_spec_uri_string(pattern)]);
39         I.buffer.web_navigation.reload(Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
40     },
41     $browser_object = browser_object_images,
42     $prompt = "Adblock");