diff options
author | teramako | 2008-10-15 15:28:45 +0000 |
---|---|---|
committer | teramako | 2008-10-15 15:28:45 +0000 |
commit | 3dc8e4e07e475876801ff602bd9e047c92203934 (patch) | |
tree | d41e994a207d77c8ba74c80bce7a0879b2517c10 | |
parent | 4ca3ee635c6624add6514b2b8a5675ef61c67813 (diff) | |
download | vimperator-plugins-3dc8e4e07e475876801ff602bd9e047c92203934.tar.bz2 |
namespaceの省略(vimperator CVS headと旧版との互換性維持のため)
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@21395 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | bufferecho.js | 12 | ||||
-rw-r--r-- | copy.js | 14 | ||||
-rw-r--r-- | feedSomeKeys.js | 4 | ||||
-rw-r--r-- | gmail_biff.js | 2 | ||||
-rw-r--r-- | gmperator.js | 8 | ||||
-rw-r--r-- | ime_controller.js | 5 | ||||
-rw-r--r-- | inspector.js | 8 | ||||
-rw-r--r-- | lookupDictionary.js | 4 | ||||
-rw-r--r-- | sbmcommentsviewer.js | 8 | ||||
-rw-r--r-- | splitBrowser.js | 40 | ||||
-rw-r--r-- | ubiquity.js | 6 | ||||
-rw-r--r-- | 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 = '<div><h1>' + htmlEscape(str) + '</h1><pre>' + result + '</pre></div>'; - 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>'+title+'</title>' + data], where); } }; @@ -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<count; i++){ feedKeyIntoContent(feedKey, useVkey); } - }, { flags:liberator.Mappings.flags.COUNT, rhs:feedKey, noremap:true }); + }, { flags:Mappings.flags.COUNT, rhs:feedKey, noremap:true }); addUserMap(map); if (feedMaps.some(function(fmap){ if (fmap.names[0] != origKey) return false; diff --git a/gmail_biff.js b/gmail_biff.js index 5086eab..378832b 100644 --- a/gmail_biff.js +++ b/gmail_biff.js @@ -37,7 +37,7 @@ 'k9UMW8vzxTtMN0ZvrATDio05GxM3hm/cMvFrhlvno2dxDF9Nbh+9Gn/19NUzUHj66kkgPH91y1WH'+
'O1e/yzEQjk0CAAARc29gwOvTnwAAAABJRU5ErkJggg==';
- var gmailBiffIntervals = parseInt(globalVariables.gmbf_check_intervals || 30) * 1000;
+ var gmailBiffIntervals = parseInt(liberator.globalVariables.gmbf_check_intervals || 30) * 1000;
var gmailBiffIcon = document.createElement('statusbarpanel');
gmailBiffIcon.setAttribute('id','gmail-biff-icon');
diff --git a/gmperator.js b/gmperator.js index 404f9d8..f047105 100644 --- a/gmperator.js +++ b/gmperator.js @@ -193,15 +193,15 @@ liberator.plugins.gmperator = (function(){ //{{{ * @param {String} filename script filename */ function triggerGMEvent(name, uri, filename){ - liberator.autocommands.trigger(name, uri+'\n'+filename); + autocommands.trigger(name, uri+'\n'+filename); liberator.log('gmpeartor: '+ name + ' ' + uri+'\n'+filename, 8); } getBrowser().mTabContainer.addEventListener('TabClose',updateGmContainerList,false); getBrowser().mTabBox.addEventListener('TabSelect',dispatchGMTabSelect,false); - liberator.config.autocommands.push(["GMInjectedScript","Triggered when UserScript is injected"]); - liberator.config.autocommands.push(["GMActiveScript","Triggered when location is changed and injected UserScripts are exist"]); - liberator.config.dialogs.push(["userscriptmanager", "Greasemonkey Manager", function(){GM_openUserScriptManager();}]); + config.autocommands.push(["GMInjectedScript","Triggered when UserScript is injected"]); + config.autocommands.push(["GMActiveScript","Triggered when location is changed and injected UserScripts are exist"]); + config.dialogs.push(["userscriptmanager", "Greasemonkey Manager", function(){GM_openUserScriptManager();}]); // }}} return manager; })(); //}}} diff --git a/ime_controller.js b/ime_controller.js index bc8588c..a3dc97c 100644 --- a/ime_controller.js +++ b/ime_controller.js @@ -33,7 +33,6 @@ * */ -if(!liberator.plugins) vimperator.plugins = {}; liberator.plugins.imeController = (function(){ var inputElement = document.getAnonymousElementByAttribute( document.getElementById('liberator-commandline-command'),'anonid','input' @@ -52,8 +51,8 @@ liberator.plugins.imeController = (function(){ liberator.plugins.imeController.set(inputElement, getMode('ex_ime_mode')); }); preExec(events,'onEscape',function(){ - if (liberator.mode == liberator.modes.INSERT && (liberator.modes.extended & liberator.modes.TEXTAREA) && !liberator.options.insertmode){ - var inputField = liberator.buffer.lastInputField; + if (liberator.mode == modes.INSERT && (modes.extended & modes.TEXTAREA) && !options.insertmode){ + var inputField = buffer.lastInputField; if (liberator.plugins.imeController.set(inputField, getMode('textarea_ime_mode'))){ inputField.blur(); setTimeout(function(){inputField.focus();},0); diff --git a/inspector.js b/inspector.js index 8652097..00b8da3 100644 --- a/inspector.js +++ b/inspector.js @@ -37,8 +37,8 @@ function getFrameList(){ } return list; } -liberator.commands.addUserCommand(['inspect','dominspect'],'run DOM Inspector', - function(arg, special){ +commands.addUserCommand(['inspect','dominspect'],'run DOM Inspector', + function(arg, bang){ if (!arg){ bang ? inspectDOMDocument(document) : inspectDOMDocument(content.document); return; @@ -59,9 +59,9 @@ liberator.commands.addUserCommand(['inspect','dominspect'],'run DOM Inspector', },{ bang: true, completer: function(filter){ - var list = liberator.completion.filter(getFrameList(), filter, true); + var list = completion.filter(getFrameList(), filter, true); if (list.length > 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], ['<C-w>'], 'select subbrowser', //{{{ +mappings.addUserMap([modes.NORMAL], ['<C-w>'], 'select subbrowser', //{{{ function(count, key){ if (/[1-9]/.test(key)){ focusSwitch(parseInt(key), true); @@ -195,14 +195,14 @@ liberator.mappings.addUserMap([liberator.modes.NORMAL], ['<C-w>'], 'select subbr liberator.plugins.splitBrowser.closeSubBrowser(); break; case '<C-v>': - liberator.plugins.splitBrowser.openSubBrowser(liberator.buffer.URL,SplitBrowser.POSITION_RIGHT); + liberator.plugins.splitBrowser.openSubBrowser(buffer.URL,SplitBrowser.POSITION_RIGHT); break; case '<C-s>': - 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], ['<C-w>'], '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); } |