From dcca60ea0cd7939f3e9aa7657bd3ae30bf909608 Mon Sep 17 00:00:00 2001 From: drry Date: Thu, 22 Jan 2009 19:32:06 +0000 Subject: * cosmetic changes. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@28871 d0d07461-0603-4401-acd4-de1884942a52 --- hatenabookmark_show.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'hatenabookmark_show.js') diff --git a/hatenabookmark_show.js b/hatenabookmark_show.js index b4e22f8..5c943be 100644 --- a/hatenabookmark_show.js +++ b/hatenabookmark_show.js @@ -1,16 +1,16 @@ -// Vimperator plugin: 'Show Hatena Bookmark Comments' +// Vimperator plugin: "Show Hatena Bookmark Comments" // Last Change: 21-Mar-2008. Jan 2008 // License: Creative Commons // Maintainer: Trapezoid - http://unsigned.g.hatena.ne.jp/Trapezoid // -// show hatena bookmark comments script for Vimperator 2.0pre +// show Hatena Bookmark comments script for Vimperator 2.0pre (function(){ function showComments(url){ const endPoint = "http://b.hatena.ne.jp/entry/json/"; var xhr = new XMLHttpRequest(); var tagString,showString = "
"; - xhr.open("GET",endPoint + url.replace(/#/,"%23") ,false); + xhr.open("GET",endPoint + url.replace(/#/,"%23"),false); xhr.send(null); var response; if(!(response = window.eval(xhr.responseText))){ @@ -21,26 +21,26 @@ bookmarks.forEach(function(bookmark){ tagString = bookmark.tags.length ? "[" + bookmark.tags.join("][") + "]":""; - showString += "
" + bookmark.user + "
"; - showString += "
" + showString += '
' + bookmark.user + "
"; + showString += '
' showString += tagString + (bookmark.tags.length > 0 && bookmark.comment ? "
":"") + bookmark.comment + "
"; }); showString += "
"; - liberator.modules.commandline.echo(showString, liberator.modules.commandline.HL_NORMAL, liberator.modules.commandline.FORCE_MULTILINE); + liberator.modules.commandline.echo(showString,liberator.modules.commandline.HL_NORMAL,liberator.modules.commandline.FORCE_MULTILINE); } - liberator.modules.commands.addUserCommand(["hbinfo"], "show hatena bookmark comments", + liberator.modules.commands.addUserCommand(["hbinfo"],"show Hatena Bookmark comments", function(arg,special){ var clipboard = readFromClipboard(); var url = arg.string; - if(special) + if(special) url = window.content.document.getSelection() || clipboard; showComments(url ? encodeURIComponent(url): liberator.modules.buffer.URL); - },{ + },{ completer: liberator.modules.completion.url, bang: true } ); - liberator.modules.mappings.addUserMap([liberator.modules.modes.VISUAL], [",h"], "show hatena bookmark comments", + liberator.modules.mappings.addUserMap([liberator.modules.modes.VISUAL],[",h"],"show Hatena Bookmark comments", function(count){ showComments(window.content.document.getSelection()); },{ noremap: true } -- cgit v1.2.3