[Conkeror] my first command

Jeremy Maitin-Shepard jeremy at jeremyms.com
Mon Sep 1 16:40:11 PDT 2008


Jim Burton <jim at sdf-eu.org> writes:

> Hi, I want a command that posts urls to citeulike.org (a bookmarking
> type site for academic references). In firefox this is simply done
> with a bookmark like this:


> javascript:location.href='http://www.citeulike.org/posturl?username=USER&bml=nopopup&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);

> I don't seem to be able to add such a bookmark -- is this because of
> the protocol? So, I tried a command -- see below. This moves to the
> new location but the minibuffer and status bar disappear and conkeror
> stops responding to commands. I have to kill the window to start
> again. What am I doing wrong? Thanks.

> /*citeulike*/
> function citeulike_post (i) {
>     var w = i.window;
>     w.location.href='http://www.citeulike.org/posturl?username=USER&bml=nopopup&url='+encodeURIComponent(w.location.href)+'&title='+encodeURIComponent(i.buffer.document.title);
> }

i.window refers to the top-level window that contains the Conkeror UI,
and therefore you should not be accessing it like that.  Instead try:

check_buffer(i.buffer, content_buffer);
let title = i.buffer.title;
let url = i.buffer.display_URI_string;
i.buffer.load("http://www.citeulike.org/posturl?username=USER&bml=nopopup&url="+encodeURIComponent(url)+'&title='+encodeURIComponent(title));


> interactive ("citeulike-post", "post the current location to citeulike",
>     function (I) {
>         citeulike_post (I);
>     });

No need for this extra wrapper, you can just do:

interactive("citeulike-post", "post the current location to citeulike", citeulike_post);

> I'd like to tell you which version I'm using but don't know how to
> find out! I got rid of the tarball, the version number doesn't seem to
> be in any of the readmes etc and M-x conkeror-version prints
> $CONKEROR_VERSION$, unhelpfully.

Yes, for git snapshots the version is not contained in the snapshot.  If
you use git this is not so much of a problem.


-- 
Jeremy Maitin-Shepard


More information about the Conkeror mailing list