input_stack: wrap an array instead of inherit from Array
[conkeror.git] / modules / extensions / adblockplus.js
blob5caf6c962a2fe2ed58ce9483d5402932e81b870f
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 in_module(null);
10 var adblockplus_service = Cc["@mozilla.org/adblockplus;1"]
11     .createInstance().wrappedJSObject;
13 function adblockplus_settings (buffer, uri_string) {
14     var frame = null;
15     if (buffer)
16         frame = buffer.top_frame;
17     adblockplus_service.openSettingsDialog(frame, uri_string);
19 interactive("adblockplus-settings",
20     "Show the Adblock Plus settings dialog.",
21     function (I) { adblockplus_settings(I.buffer); });
24 interactive("adblockplus-add",
25     "Add a pattern to Adblock Plus.",
26     function (I) {
27         var element = yield read_browser_object(I);
28         var spec = load_spec(element);
29         var pattern = yield I.minibuffer.read_url(
30             $prompt = "Adblock:",
31             $initial_value = load_spec_uri_string(spec),
32             $history = "url");
33         adblockplus_service.addPatterns([load_spec_uri_string(pattern)]);
34         I.buffer.web_navigation.reload(Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
35     },
36     $browser_object = browser_object_images,
37     $prompt = "Adblock");
39 provide("adblockplus");