From 40f13ee987f551cb5bccfa8330e4738f1191c2a9 Mon Sep 17 00:00:00 2001 From: pekepeke Date: Sat, 1 Nov 2008 04:24:26 +0000 Subject: handling for 2.0pre git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@22491 d0d07461-0603-4401-acd4-de1884942a52 --- commandBookmarklet.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'commandBookmarklet.js') 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", -- cgit v1.2.3