From caceac35d2bb51ee874639dc6d497d574f3227ec Mon Sep 17 00:00:00 2001
From: anekos
Date: Sun, 21 Dec 2008 10:40:59 +0000
Subject: Remove whitespaces. Add %TITLE%.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@27155 d0d07461-0603-4401-acd4-de1884942a52
---
applauncher.js | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
(limited to 'applauncher.js')
diff --git a/applauncher.js b/applauncher.js
index a49d58c..18fb9fe 100644
--- a/applauncher.js
+++ b/applauncher.js
@@ -4,7 +4,7 @@ var PLUGIN_INFO =
アプリケーションランチャー
Launch defined application
アプリケーションを起動します
- 0.10
+ 0.11
pekepeke
2.0pre
2.0pre
@@ -36,7 +36,7 @@ liberator.plugins.AppLauncher = (function(){
var Class = function(){ return function(){ this.initialize.apply(this, arguments); }};
var AppLauncher = new Class();
-
+
AppLauncher.prototype = {
initialize: function(){
this.buildMenu();
@@ -44,7 +44,7 @@ liberator.plugins.AppLauncher = (function(){
},
registerCommand: function(){
var self = this;
- commands.addUserCommand(['applaunch','runapp'], 'Run Defined Application',
+ commands.addUserCommand(['applaunch', 'runapp'], 'Run Defined Application',
function(arg){
arg = (typeof arg.string == undefined ? arg : arg.string);
self.launch(arg);
@@ -67,7 +67,7 @@ liberator.plugins.AppLauncher = (function(){
menu.setAttribute('id', AppName + 'Context');
menu.setAttribute('label', AppName);
menu.setAttribute('accesskey', 'L');
-
+
var menupopup = document.createElement('menupopup');
menupopup.setAttribute('id', AppName + 'ContextMenu');
menu.appendChild(menupopup);
@@ -81,16 +81,23 @@ liberator.plugins.AppLauncher = (function(){
}
document.getElementById('contentAreaContextMenu').appendChild(menu);
},
+ variables: {
+ __noSuchMethod__: function(name) name,
+ URL: function() gContextMenu && gContextMenu.onLink ? gContextMenu.getLinkURL() : buffer.URL,
+ SEL: function(){
+ var selection = window.content.window.getSelection();
+ var sel = '';
+ for (let i=0, l=selection.rangeCount; i '\ '
settings.some( function([name, app, args]){
args = args instanceof Array ? args : args ? [args] : [];
- args = args.map( function( val ) val.replace(/%URL%/g, url).replace(/%SEL%/g, sel) );
+ args = args.map( function( val ) val.replace(/%([A-Z]+)%/g, function( _, name ) self.variables[name]()) );
if (appName == name) {
io.run(app, args);
return true;
--
cgit v1.2.3