adblockplus.js: update for changes in Adblock Plus
[conkeror.git] / modules / extensions / adblockplus.js
blob4b73e723d17df4f5bf6f11bbbfbc93ae165a106f
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);
11 function adblockplus_settings (buffer, uri_string) {
12     Components.utils.import("chrome://adblockplus-modules/content/Utils.jsm");
13     var frame = null;
14     if (buffer)
15         frame = buffer.top_frame;
16     Utils.openSettingsDialog(frame, uri_string);
18 interactive("adblockplus-settings",
19     "Show the Adblock Plus settings dialog.",
20     function (I) { adblockplus_settings(I.buffer); });
23 interactive("adblockplus-add",
24     "Add a pattern to Adblock Plus.",
25     function (I) {
26         Components.utils.import("chrome://adblockplus-modules/content/Public.jsm");
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.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");