var PLUGIN_INFO = AppLauncher アプリケーションランチャー Launch defined application アプリケーションを起動します 0.12 pekepeke 2.0pre 2.0pre https://github.com/vimpr/vimperator-plugins/raw/master/applauncher.js || js < liberator.plugins.AppLauncher = (function(){ const UConv = Cc['@mozilla.org/intl/scriptableunicodeconverter'].getService(Ci.nsIScriptableUnicodeConverter); const AppName = 'AppLauncher'; var global = liberator.globalVariables; var settings = global.applauncher_list || []; var defaultCharset = global.applauncher_charset; if (!settings || settings.length <= 0) return; var completer = settings.map( function([name, app, args]) [name, args ? app + ' ' + args.toString(): app] ); var Class = function() function(){ this.initialize.apply(this, arguments); }; var AppLauncher = new Class(); AppLauncher.prototype = { initialize: function(){ this.buildMenu(); this.registerCommand(); }, registerCommand: function(){ var self = this; commands.addUserCommand(['applaunch', 'runapp'], 'Run Defined Application', function(arg){ arg = (typeof arg.string == 'undefined' ? arg : arg.string); self.launch(arg); }, { completer: function(context, arg){ var filter = context.filter; context.title = [ 'Name', 'Description']; if (!filter){ context.completions = completer; return; } filter = filter.toLowerCase(); context.completions = completer.filter( function(el) el[0].toLowerCase().indexOf(filter) == 0); } }); }, buildMenu: function(){ var self = this; var menu = document.getElementById('contentAreaContextMenu') .appendChild(document.createElement('menu')); menu.setAttribute('id', AppName + 'Context'); menu.setAttribute('label', AppName); menu.setAttribute('accesskey', 'L'); var menupopup = menu.appendChild(document.createElement('menupopup')); menupopup.setAttribute('id', AppName + 'ContextMenu'); for (let i=0, l=settings.length; i '\ ' settings.some( function([name, app, args]){ args = args instanceof Array ? args : args ? [args] : []; args = args.map( function( val ) val.replace(/%([A-Z]+)%/g, function( _, name ) self.variables[name]()) ); if (defaultCharset){ UConv.charset = defaultCharset; args = args.map( function( val ) UConv.ConvertFromUnicode(val) ); } if (appName == name){ io.run(app, args); return true; } return false; }); } } return new AppLauncher(); })(); '>50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159