[Vimperator] Addon search keywords

Kipling Inscore k at bijna.net
Mon Jun 9 17:52:51 PDT 2008


On Mon, Jun 9, 2008 at 4:06 PM, Martin Stubenschrott
<stubenschrott at gmx.net> wrote:
> Kipling Inscore wrote:
>
>> So I see Vimperator checks the search aliases followed by bookmark shortcuts.
>> Turns out the del.icio.us addon overrides getShortcutOrURI so its
>> shortcuts don't show up in either of these services.
>
> Good investiagtion.
>
>>> method for Vimperator 1.x. I'll be working on a patch, particularly to
>>> support del.icio.us bookmark shortcuts through the official
>>> del.icio.us addon, so guidance on where I should be looking or whether
>>> I should be doing this would be appreciated.
>
> If possible, i think the best way to do del.icio.us integration would be
> to do a vimperator plugin.

Ah, yes, I forgot about that route. Probably the way to go. I was
hoping since del.icio.us uses somewhat standard methods this would be
more than just a del.icio.us feature but I don't know of other addons
that need special URL handling (i.e. override getShortcutOrURI or
otherwise make shortcuts available through Firefox address bar but not
Vimperator open command) so that should be sufficient.
A getShortcutOrURI plugin seems a bit odd as it's either the right
thing to do and should be in Vimperator or is the wrong thing to do
and shouldn't be in a plugin either.
A del.icio.us-specific Vimperator plugin would duplicate some of what
the official delicious addon does but wouldn't carry around all that
useless GUI code. Could also have better integration of searching
del.icio.us bookmarks by tags.

>
>> Below is a patch against Vimperator CVS (2008-06-09T14:20Z-0700) which
>> modifies stringToURLArray in util.js to use getShortcutOrURI between
>> specific and default calls to getSearchURL; overall behavior should be
>> unchanged if no addons with an overloaded getShortcutOrURI are
>> installed and enabled. Perhaps getShortcutOrURI, if acceptable, should
>> be added to or replace most of liberator.bookmarks.getSearchURL?
>> Perhaps there's an extra feature of getSearchURL that I'm not seeing
>> (so I haven't removed calls to getSearchURL) but getShortcutOrURI
>> checks search aliases and bookmark shortcuts as long as it hasn't been
>> overridden by a function that doesn't fall back on the default
>> function (the del.icio.us addon overriding function does fall back on
>> the default).
>
> I had not yet time to test the patch, but it seems that you aren't handling the
> postdata from getShortcutOrURI, because in:
>
> var searchURL = liberator.bookmarks.getSearchURL(text, alias);
> searchURL is [uri, postdata]

An oversight on my part. getShortcutOrURI uses its second argument as
a reference to post data and returns a string.

>
> but maybe it still works with your way. Fully replacing bookmarks.getSearchURL
> is not recommended, but maybe the part which is dealing with keywords/bookmarks
> is ok.

I see that getSearchURL has a default engine option, which
getShortcutOrURI doesn't, and has a somewhat different call/return but
otherwise they seem to do the same thing. If being able to use addons
that tie into the address bar (rather than search aliases or bookmark
keywords) isn't a general concern for Vimperator there's probably
little if any advantage to changing the code to use getShortcutOrURI
(individual keyword services can be integrated more directly with
Vimperator via plugins).

>
> However, I think, it would be much better to replace the parts of getSearchURL()
> and keep stringToURLArray quite unmodified.

An easy enough change if I redo the patch. Pending recommendation I'll
work on the plugin but could do another patch or both.

>
> Comments welcome by other vimp devs, haven't looked at that code for a long time.
>
> --
> Martin
> _______________________________________________
> Vimperator mailing list
> Vimperator at mozdev.org
> https://www.mozdev.org/mailman/listinfo/vimperator
>


More information about the Vimperator mailing list