I intend, if desired, to submit the following code as a patch, but I
was hoping for some advice on some points first. The "todo" comments
mark those points.
The main point is that it seems that prefix commands do not get
applied to functions called via M-x. I had not intended to bind this
command to a key (I don't need it often), but it's better if prefix
commands work with it.
regards, David
--8<-- snip, snip
/* Add a pattern to adblockplus based on a target. Allows you to
select a target and then edit it. Defaults to images, as they are
most frequently what I want to block. */
default_browser_object_classes.adblock = "images";
interactive("adblockplus-add",
"Add a pattern to Adblock Plus.",
function (I) {
var element = yield I.read_browser_object("adblock", "Adblock");
var spec = element_get_load_spec(element);
if (spec == null)
throw interactive_error("Element has no associated URI");
var pattern = yield I.minibuffer.read_url(
$prompt = "Adblock:",
$initial_value = load_spec_uri_string(spec),
$history = "url");
// todo: should it be a separate history?
// todo: maybe adblockplus_service.normalizeFilter()
adblockplus_service.addPatterns([pattern]);
I.buffer.web_navigation.reload(Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
});
// todo: prefix commands only work with keystrokes, not M-x
define_key(content_buffer_normal_keymap, "C-c a", "adblockplus-add",
$category = "Browser object");
--
IMPORTANT: This email remains the property of the Australian Defence
Organisation and is subject to the jurisdiction of section 70 of the
CRIMES ACT 1914. If you have received this email in error, you are
requested to contact the sender and delete the email.
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror