1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 00:17:58 +01:00

Make sure, search engine aliases are unique

This commit is contained in:
Martin Stubenschrott
2007-07-31 15:41:56 +00:00
parent b4dfb2540b
commit ca5e2d080d
3 changed files with 23 additions and 8 deletions

5
TODO
View File

@@ -5,9 +5,8 @@ Priority list:
BUGS: BUGS:
- switching tabs while HINT_MODE_ALWAYS is on does not redisplay hints in new tabs, but exits hint mode - switching tabs while HINT_MODE_ALWAYS is on does not redisplay hints in new tabs, but exits hint mode
- autoupdate does not work - autoupdate does not work
- multiple windows to not work at all, so :q will close the whole browser session, even when there are other windows which has tabs - multiple windows do not work at all, so :q will close the whole browser session, even when there are other windows which has tabs
- http://en.wikipedia.org/wiki/Portal:Current_events - 'f' shows more hints than 'F' (on left side of nav bar) - http://en.wikipedia.org/wiki/Portal:Current_events - 'f' shows more hints than 'F' (on left side of nav bar)
- gu and gU don't work on local files properly
- dpb| 09:09:56 dpb :: when I save a page with vimperator, it adds <hints - dpb| 09:09:56 dpb :: when I save a page with vimperator, it adds <hints
id="hah_hints"></hints> near the end of it.. kinda annoying id="hah_hints"></hints> near the end of it.. kinda annoying
dpb| 09:11:50 dpb :: and this happens only when saving the complete dpb| 09:11:50 dpb :: and this happens only when saving the complete
@@ -15,9 +14,9 @@ BUGS:
- add window resize support to hints - add window resize support to hints
- can't reverse tab through the vimperator toolbar - can't reverse tab through the vimperator toolbar
- gu doesn't work when the current URL contains a trailing slash - gu doesn't work when the current URL contains a trailing slash
- gu and gU don't work on local files properly
FEATURES: FEATURES:
9 :map commands to keys
9 :command for new commands 9 :command for new commands
8 middleclick in content == p, and if command line is open, paste there the clipboard buffer 8 middleclick in content == p, and if command line is open, paste there the clipboard buffer
8 Use our own find-as-you-type mechanism (like conkeror does) 8 Use our own find-as-you-type mechanism (like conkeror does)

View File

@@ -162,11 +162,25 @@ function Bookmarks() //{{{
var firefox_engines = search_service.getVisibleEngines({ }); var firefox_engines = search_service.getVisibleEngines({ });
for (var i in firefox_engines) for (var i in firefox_engines)
{ {
if (!firefox_engines[i].alias || !firefox_engines[i].alias.match(/^[a-z0-9_]+$/)) var alias = firefox_engines[i].alias;
if (!alias || !alias.match(/^[a-z0-9_-]+$/))
alias = firefox_engines[i].name.replace(/^\W*([a-zA-Z_-]+).*/, "$1").toLowerCase();
if (!alias)
alias = "search"; // for search engines which we can't find a suitable alias
// make sure we can use search engines which would have the same alias (add numbers at the end)
var newalias = alias;
for (var j = 1; j <= 10; j++) // <=10 is intentional
{ {
var alias = firefox_engines[i].name.replace(/^\W*(\w+).*/, "$1").toLowerCase(); if (!search_engines.some( function(item) { return (item[0] == newalias); } ))
firefox_engines[i].alias = alias; break;
newalias = alias + j.toString();
} }
// only write when it changed, writes are really slow
if (firefox_engines[i].alias != newalias)
firefox_engines[i].alias = newalias;
search_engines.push([firefox_engines[i].alias, firefox_engines[i].description]); search_engines.push([firefox_engines[i].alias, firefox_engines[i].description]);
} }

View File

@@ -709,8 +709,10 @@ function Commands() //{{{
"<ul><li><code class=\"command\">:open ...</code> with current location <code>\"http://www.example.com/dir1/dir2/file.html\"</code> will open <code>\"http://www.example.com\"</code></li>" + "<ul><li><code class=\"command\">:open ...</code> with current location <code>\"http://www.example.com/dir1/dir2/file.html\"</code> will open <code>\"http://www.example.com\"</code></li>" +
"<li><code class=\"command\">:open ./foo.html</code> with current location <code>\"http://www.example.com/dir1/dir2/file.html\"</code> will open <code>\"http://www.example.com/dir1/dir2/foo.html\"</code></li></ul></li>" + "<li><code class=\"command\">:open ./foo.html</code> with current location <code>\"http://www.example.com/dir1/dir2/file.html\"</code> will open <code>\"http://www.example.com/dir1/dir2/foo.html\"</code></li></ul></li>" +
"<li>Opened with the specified search engine if the token looks like a search string " + "<li>Opened with the specified search engine if the token looks like a search string " +
"and the first word of the token is the name of a search engine (<code class=\"command\">:open wikipedia linus torvalds</code> " + "and the first word is the name of a search engine (<code class=\"command\">:open wikipedia linus torvalds</code> " +
"will open the wikipedia entry for linux torvalds).</li>" + "will open the wikipedia entry for linux torvalds). The short name of a search engine is automatically guessed from it's name. " +
"If you want to set a custom name, open the $FIREFOX_PROFILE/searchplugins/*.xml file of the search engine, and add/change " +
"&lt;Alias&gt;myalias&lt;/Alias&gt; </li>" +
" <li>Opened with the default search engine or keyword (specified with the <code class=\"option\">'defsearch'</code> option) " + " <li>Opened with the default search engine or keyword (specified with the <code class=\"option\">'defsearch'</code> option) " +
"if the first word is no search engine (<code class=\"command\">:open linus torvalds</code> will open a google search for linux torvalds).</li>" + "if the first word is no search engine (<code class=\"command\">:open linus torvalds</code> will open a google search for linux torvalds).</li>" +
" <li>Passed directly to Firefox in all other cases (<code class=\"command\">:open www.osnews.com, www.slashdot.org</code> will " + " <li>Passed directly to Firefox in all other cases (<code class=\"command\">:open www.osnews.com, www.slashdot.org</code> will " +