diff options
author | pekepeke | 2008-11-01 04:24:26 +0000 |
---|---|---|
committer | pekepeke | 2008-11-01 04:24:26 +0000 |
commit | 40f13ee987f551cb5bccfa8330e4738f1191c2a9 (patch) | |
tree | bc7e78689711875e384b207bc99eba104bf7cad9 /commandBookmarklet.js | |
parent | adda95c12d27f64b046a9af4c36c9e40944d4c91 (diff) | |
download | vimperator-plugins-40f13ee987f551cb5bccfa8330e4738f1191c2a9.tar.bz2 |
handling for 2.0pre
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@22491 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'commandBookmarklet.js')
-rw-r--r-- | commandBookmarklet.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/commandBookmarklet.js b/commandBookmarklet.js index c0d552a..0f71a44 100644 --- a/commandBookmarklet.js +++ b/commandBookmarklet.js @@ -7,7 +7,7 @@ (function(){ var filter = "javascript:"; - var items = liberator.bookmarks.get(filter); + var items = bookmarks.get(filter); if (items.length == 0) { if (filter.length > 0) { @@ -19,18 +19,24 @@ items.forEach(function(item) { var [url, title] = item; + var desc = title; + title = escape( title.replace(/ +/g,'').toLowerCase() ); + if (title.match(/[^a-zA-Z]+/)) { + title = "bm"+title.replace(/[^a-zA-Z]+/g,''); + title = title.substr(0, title.length>50?50:title.length); + } if (width(title) > 50) { while (width(title) > 47) { title = title.slice(0, -2); } title += "..."; } - title = liberator.util.escapeHTML(title); + title = util.escapeHTML(title); var command = function () { liberator.open(url); }; - liberator.commands.addUserCommand( + commands.addUserCommand( [title], - "bookmarklet", + "bookmarklet : "+desc, command, { shortHelp: "Bookmarklet", |