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 --- appendAnchor.js | 2 +- exopen.js | 10 ++++------ hatenabookmark_show.js | 20 ++++++++++---------- prevent_focus_ietab.js | 13 ++++++------- tombloo.js | 8 ++++---- 5 files changed, 25 insertions(+), 28 deletions(-) diff --git a/appendAnchor.js b/appendAnchor.js index c0d0e7e..8ad8754 100644 --- a/appendAnchor.js +++ b/appendAnchor.js @@ -41,7 +41,7 @@ let PLUGIN_INFO = // process global variable if (stringToBoolean(liberator.globalVariables.auto_append_anchor, 'false')) { let originalHintsShow = liberator.modules.hints.show; - let once = stringToBoolean(liberator.globalVariables.auto_append_anchor_once, 'false') + let once = stringToBoolean(liberator.globalVariables.auto_append_anchor_once, 'false'); hints.show = function () { if (!content.document.anchor_appended) { content.document.anchor_appended = true; diff --git a/exopen.js b/exopen.js index 2105ecd..0126306 100644 --- a/exopen.js +++ b/exopen.js @@ -127,18 +127,16 @@ liberator.plugins.exOpen = (function() { case '%SEL%': if (sel) return sel; else if (selection.rangeCount < 1) return ''; - for (let i=0, c=selection.rangeCount; i - 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 } diff --git a/prevent_focus_ietab.js b/prevent_focus_ietab.js index fae6aa1..c4deb1f 100644 --- a/prevent_focus_ietab.js +++ b/prevent_focus_ietab.js @@ -12,12 +12,11 @@ This software distribute under term of new BSD style license. */ (function() { -if (gIeTab && gIeTab.onTabSelected) { - liberator.log("replace IeTab.onTabSelected() function"); - var func = gIeTab.onTabSelected.toSource(); - var newFunc = func.replace(/window\.setTimeout\(gIeTab\.focusIeTab, 0\);/, ''); - gIeTab.removeEventListener("appcontent", "select", gIeTab.onTabSelected); - gIeTab.addEventListener("appcontent", "select", new Function(newFunc)); -} +if (!gIeTab || !gIeTab.onTabSelected) return; +liberator.log("replace IeTab.onTabSelected() function"); +var func = gIeTab.onTabSelected.toSource(); +var newFunc = func.replace(/window\.setTimeout\(gIeTab\.focusIeTab, 0\);/, ''); +gIeTab.removeEventListener("appcontent", "select", gIeTab.onTabSelected); +gIeTab.addEventListener("appcontent", "select", new Function(newFunc)); })(); diff --git a/tombloo.js b/tombloo.js index 323b494..c5f7744 100644 --- a/tombloo.js +++ b/tombloo.js @@ -1,4 +1,4 @@ -let PLUGIN_INFO = +let PLUGIN_INFO = {NAME} Tombloo integrate plugin @@ -77,7 +77,7 @@ commands.addUserCommand( 'Post by Tombloo', function (args, special) { //let f = Tombloo.Service.extractors[args.string]; - let arg = args.string.replace(/\\\u0020/g, '\u0020'); + let arg = args.string.replace(/\\(?=\u0020)/g, ''); liberator.log(args.string, 0); liberator.log(arg, 0); @@ -96,8 +96,8 @@ commands.addUserCommand( context.completions = candidates.filter( function($_) this.test($_[0]), new RegExp(context.filter, 'i') - ) - }, + ); + } } ); -- cgit v1.2.3