From 3dc8e4e07e475876801ff602bd9e047c92203934 Mon Sep 17 00:00:00 2001 From: teramako Date: Wed, 15 Oct 2008 15:28:45 +0000 Subject: namespaceの省略(vimperator CVS headと旧版との互換性維持のため) git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@21395 d0d07461-0603-4401-acd4-de1884942a52 --- bufferecho.js | 12 ++++++------ copy.js | 14 +++++++------- feedSomeKeys.js | 4 ++-- gmail_biff.js | 2 +- gmperator.js | 8 ++++---- ime_controller.js | 5 ++--- inspector.js | 8 ++++---- lookupDictionary.js | 4 ++-- sbmcommentsviewer.js | 8 ++++---- splitBrowser.js | 40 ++++++++++++++++++++-------------------- ubiquity.js | 6 +++--- xpathBlink.js | 4 ++-- 12 files changed, 57 insertions(+), 58 deletions(-) diff --git a/bufferecho.js b/bufferecho.js index dc287be..39398dc 100644 --- a/bufferecho.js +++ b/bufferecho.js @@ -24,27 +24,27 @@ function htmlEscape(str){ .replace(">",">","g"); } -liberator.commands.addUserCommand(['bufferecho','becho'],'Display results of JavaScript to a buffer(browser)', +commands.addUserCommand(['bufferecho','becho'],'Display results of JavaScript to a buffer(browser)', function(args, special){ liberator.plugins.buffer_echo.open(args, special); },{ - completer: function(filter) liberator.completion.javascript(filter) + completer: function(filter) completion.javascript(filter) },true ); var manager = { append: function(htmlString){ - var body = liberator.buffer.evaluateXPath('/html/body').snapshotItem(0); + var body = buffer.evaluateXPath('/html/body').snapshotItem(0); body.innerHTML += htmlString; }, open: function(str, forceNewTab) { var result = execute(str); - if (typeof(result) == "object") result = liberator.util.objectToString(result,true); + if (typeof(result) == "object") result = util.objectToString(result,true); var data = '

' + htmlEscape(str) + '

' + result + '
'; - if (liberator.buffer.title == title && !forceNewTab){ + if (buffer.title == title && !forceNewTab){ this.append(data); return; } - var where = liberator.buffer.URL == "about:blank" ? liberator.CURRENT_TAB : liberator.NEW_TAB; + var where = buffer.URL == "about:blank" ? liberator.CURRENT_TAB : liberator.NEW_TAB; liberator.open([prefix + ''+title+'' + data], where); } }; diff --git a/copy.js b/copy.js index e724efc..4bcd3e3 100644 --- a/copy.js +++ b/copy.js @@ -78,13 +78,13 @@ liberator.globalVariables.copy_templates.forEach(function(template){ // used when argument is none //const defaultValue = templates[0].label; -liberator.commands.addUserCommand(['copy'],'Copy to clipboard', +commands.addUserCommand(['copy'],'Copy to clipboard', function(arg, special){ liberator.plugins.exCopy.copy(arg, special); },{ completer: function(filter, special){ if (special){ - return liberator.completion.javascript(filter); + return completion.javascript(filter); } var templates = liberator.globalVariables.copy_templates.map(function(template) [template.label, template.value] @@ -103,7 +103,7 @@ liberator.commands.addUserCommand(['copy'],'Copy to clipboard', ); function addUserMap(label, map){ - liberator.mappings.addUserMap([liberator.modes.NORMAL,liberator.modes.VISUAL], map, + mappings.addUserMap([modes.NORMAL,modes.VISUAL], map, label, function(){ liberator.plugins.exCopy.copy(label); }, { rhs: label } @@ -126,8 +126,8 @@ function replaceVariable(str){ var serializer = new XMLSerializer(); htmlsel = serializer.serializeToString(sel.cloneContents()); } - return str.replace(/%TITLE%/g,liberator.buffer.title) - .replace(/%URL%/g,liberator.buffer.URL) + return str.replace(/%TITLE%/g,buffer.title) + .replace(/%URL%/g,buffer.URL) .replace(/%SEL%/g,sel.toString()) .replace(/%HTMLSEL%/g,htmlsel); } @@ -179,11 +179,11 @@ var exCopyManager = { copyString = replaceVariable(template.value); } } - liberator.util.copyToClipboard(copyString); + util.copyToClipboard(copyString); if (isError){ liberator.echoerr('CopiedErrorString: `' + copyString + "'"); } else { - liberator.echo('CopiedString: `' + liberator.util.escapeHTML(copyString) + "'"); + liberator.echo('CopiedString: `' + util.escapeHTML(copyString) + "'"); } } }; diff --git a/feedSomeKeys.js b/feedSomeKeys.js index 9543a49..ba4419a 100644 --- a/feedSomeKeys.js +++ b/feedSomeKeys.js @@ -174,13 +174,13 @@ function replaceUserMap(origKey, feedKey, useVkey){ origMaps.push(clone); } } - var map = new (liberator.Map)([modes.NORMAL], [origKey], origKey + ' -> ' + feedKey, + var map = new Map([modes.NORMAL], [origKey], origKey + ' -> ' + feedKey, function(count){ count = count > 1 ? count : 1; for (var i=0; i 0) return [0, list]; - return liberator.completion.javascript(filter); + return completion.javascript(filter); }, } ); diff --git a/lookupDictionary.js b/lookupDictionary.js index ebe69e2..f52b751 100644 --- a/lookupDictionary.js +++ b/lookupDictionary.js @@ -138,7 +138,7 @@ SpellChecker.prototype = { var spellChecker = buildSpellChecker(); SITE_DEFINITION.forEach(function(dictionary){ - liberator.commands.addUserCommand( + commands.addUserCommand( dictionary.names, dictionary.shortHelp, function(arg,special){ @@ -188,7 +188,7 @@ SITE_DEFINITION.forEach(function(dictionary){ } ); }); -liberator.commands.addUserCommand( +commands.addUserCommand( ['availabledictionaries'], 'display available dictionaries', function () { liberator.echo('available dictionaries: ' + spellChecker.getDictionaryList()); }, diff --git a/sbmcommentsviewer.js b/sbmcommentsviewer.js index 49abdc4..1117eb6 100644 --- a/sbmcommentsviewer.js +++ b/sbmcommentsviewer.js @@ -485,10 +485,10 @@ commands.addUserCommand(['viewSBMComments'], 'SBM Comments Viewer', //{{{ }, //}}} { options: [ - [['-t','-type'], liberator.commands.OPTION_STRING], - [['-f','-format'], liberator.commands.OPTION_LIST], - [['-c','-count'], liberator.commands.OPTION_NOARG], - [['-b','-browser'],liberator.commands.OPTION_NORARG] + [['-t','-type'], commands.OPTION_STRING], + [['-f','-format'], commands.OPTION_LIST], + [['-c','-count'], commands.OPTION_NOARG], + [['-b','-browser'],commands.OPTION_NORARG] ] } ); //}}} diff --git a/splitBrowser.js b/splitBrowser.js index 70460f3..293ae12 100644 --- a/splitBrowser.js +++ b/splitBrowser.js @@ -116,26 +116,26 @@ function focusSwitch(where, isAbsolute){ //{{{ } //}}} var commandExtra = { - completer: function(filter) liberator.completion.url(filter), - options: [ [['-l','-left'], liberator.commands.OPTION_NOARG], - [['-r','-right'], liberator.commands.OPTION_NOARG], - [['-t','-top'], liberator.commands.OPTION_NOARG], - [['-b','-bottom'], liberator.commands.OPTION_NOARG] ], + completer: function(filter) completion.url(filter), + options: [ [['-l','-left'], commands.OPTION_NOARG], + [['-r','-right'], commands.OPTION_NOARG], + [['-t','-top'], commands.OPTION_NOARG], + [['-b','-bottom'], commands.OPTION_NOARG] ], argCount: "*" }; /* ---------------------------------------------- * Commands * --------------------------------------------*/ -liberator.commands.addUserCommand(['sp[lit]'], 'split browser', //{{{ +commands.addUserCommand(['sp[lit]'], 'split browser', //{{{ function(args){ liberator.plugins.splitBrowser.openSubBrowser(args, SplitBrowser.POSITION_TOP); }, commandExtra ); //}}} -liberator.commands.addUserCommand(['vs[plit]'], 'split browser', //{{{ +commands.addUserCommand(['vs[plit]'], 'split browser', //{{{ function(args){ liberator.plugins.splitBrowser.openSubBrowser(args, SplitBrowser.POSITION_RIGHT); }, commandExtra ); //}}} -liberator.commands.addUserCommand(['on[ly]'], 'Close or gather all subbrowsers', //{{{ +commands.addUserCommand(['on[ly]'], 'Close or gather all subbrowsers', //{{{ function(args){ if (SplitBrowser.browsers.length == 0) { liberator.echoerr('SubBrowser is none'); @@ -152,11 +152,11 @@ liberator.commands.addUserCommand(['on[ly]'], 'Close or gather all subbrowsers', /* ---------------------------------------------- * Mappings * --------------------------------------------*/ -liberator.mappings.addUserMap([liberator.modes.NORMAL],['s'], 'SplitBrowser motion Map', //{{{ +mappings.addUserMap([modes.NORMAL],['s'], 'SplitBrowser motion Map', //{{{ function(key, count){ gBrowser = SplitBrowser.activeBrowser; try { - var map = liberator.mappings.get(liberator.modes.NORMAL, key) + var map = mappings.get(modes.NORMAL, key) map.execute(null, count); } catch(e) { liberator.log(e); @@ -164,12 +164,12 @@ liberator.mappings.addUserMap([liberator.modes.NORMAL],['s'], 'SplitBrowser moti gBrowser = document.getElementById('content'); } },{ - flags: liberator.Mappings.flags.MOTION + liberator.Mappings.flags.COUNT, + flags: Mappings.flags.MOTION + Mappings.flags.COUNT, rhs: 'Motion map for SplitBrowser' } ); //}}} -liberator.mappings.addUserMap([liberator.modes.NORMAL], [''], 'select subbrowser', //{{{ +mappings.addUserMap([modes.NORMAL], [''], 'select subbrowser', //{{{ function(count, key){ if (/[1-9]/.test(key)){ focusSwitch(parseInt(key), true); @@ -195,14 +195,14 @@ liberator.mappings.addUserMap([liberator.modes.NORMAL], [''], 'select subbr liberator.plugins.splitBrowser.closeSubBrowser(); break; case '': - liberator.plugins.splitBrowser.openSubBrowser(liberator.buffer.URL,SplitBrowser.POSITION_RIGHT); + liberator.plugins.splitBrowser.openSubBrowser(buffer.URL,SplitBrowser.POSITION_RIGHT); break; case '': - liberator.plugins.splitBrowser.openSubBrowser(liberator.buffer.URL,SplitBrowser.POSITION_TOP); + liberator.plugins.splitBrowser.openSubBrowser(buffer.URL,SplitBrowser.POSITION_TOP); break; } },{ - flags: liberator.Mappings.flags.COUNT + liberator.Mappings.flags.ARGUMENT, + flags: Mappings.flags.COUNT + Mappings.flags.ARGUMENT, rhs: 'select subbrowser' } ); //}}} @@ -212,9 +212,9 @@ liberator.mappings.addUserMap([liberator.modes.NORMAL], [''], 'select subbr * @see liberator.js::vimperaotr.open */ liberator.open = function(urls, where, force){ //{{{ - if (typeof urls == 'string') urls = liberator.util.stringToURLArray(urls); + if (typeof urls == 'string') urls = util.stringToURLArray(urls); if (urls.length > 20 && !force){ - liberator.commandline.input("This will open " + urls.length + " new tabs. Would you like to continue? (yes/[no])", + commandline.input("This will open " + urls.length + " new tabs. Would you like to continue? (yes/[no])", function (resp) { if (resp && resp.match(/^y(es)?$/i)) liberator.open(urls, where, true); }); return true; } @@ -274,15 +274,15 @@ var manager = { var position = defPosition || SplitBrowser.POSITION_TOP; position = getPositionForOpen(args) || position; if (args.arguments.length > 0){ - urls = liberator.util.stringToURLArray(args.arguments.join(', ')); + urls = util.stringToURLArray(args.arguments.join(', ')); if (urls.length == 0) { - url = liberator.buffer.URL; + url = buffer.URL; } else { url = urls[0]; urls.shift(); } } else { - url = liberator.buffer.URL; + url = buffer.URL; } var subBrowser = SplitBrowser.addSubBrowser(url, null, position); subBrowser.addEventListener('load',function(){ diff --git a/ubiquity.js b/ubiquity.js index 7f17236..ab3881e 100644 --- a/ubiquity.js +++ b/ubiquity.js @@ -42,12 +42,12 @@ function preExec(target,name,func){ } } -preExec(liberator.events, 'onEscape', function(){ +preExec(events, 'onEscape', function(){ if (ubiquityManager.panel.state == 'open') gUbiquity.closeWindow(); }); var focusedWindow = null; var focusedElement = null; -preExec(liberator.commandline, 'open', function(){ +preExec(commandline, 'open', function(){ focusedWindow = document.commandDispatcher.focusedWindow; focusedElement = document.commandDispatcher.focusedElement; }); @@ -63,7 +63,7 @@ preExec(gUbiquity, 'openWindow', function(anchor, flag){ // ------------------------------------------------- // Command // ------------------------------------------------- -liberator.commands.addUserCommand(['ubi[quity]'],'Vimperator Ubiquity Glue', +commands.addUserCommand(['ubi[quity]'],'Vimperator Ubiquity Glue', function(args){ if (!args){ gUbiquity.openWindow(getBrowser(), true); diff --git a/xpathBlink.js b/xpathBlink.js index 8898d95..ac94b71 100644 --- a/xpathBlink.js +++ b/xpathBlink.js @@ -39,11 +39,11 @@ function blink(aNode){ setTimeout(setOutline, i * 100); } } -liberator.commands.addUserCommand(['xpathb[link]','xb'],'XPath blink nodes', +commands.addUserCommand(['xpathb[link]','xb'],'XPath blink nodes', function(expression){ var result try { - result = liberator.buffer.evaluateXPath(expression); + result = buffer.evaluateXPath(expression); } catch(e) { liberator.echoerr('XPath blink: ' + e); } -- cgit v1.2.3