var PLUGIN_INFO =
AppLauncher
アプリケーションランチャー
Launch defined application
アプリケーションを起動します
0.12
pekepeke
2.0pre
2.0pre
http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/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, special){
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// Vimperator plugin: 'Ex Autocmd'
// Last Change: 21-Oct-2008. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
//
// extends autocmd for Vimperator
// Ex Events:
// TabSelect
// TabLeave
// CurrentPageLoad
var recentTabURI = null;
function tabSelect(e){
liberator.modules.autocommands.trigger("TabLeave",recentTabURI || "");
liberator.modules.autocommands.trigger("TabSelect",gBrowser.selectedTab.linkedBrowser.contentWindow.location.href);
recentTabURI = gBrowser.selectedTab.linkedBrowser.contentWindow.location.href;
}
gBrowser.tabContainer.addEventListener("TabSelect",tabSelect,false);
function currentPageLoad(e){
var doc = e.originalTarget;
if (doc instanceof HTMLDocument && doc == gBrowser.contentDocument){
liberator.modules.autocommands.trigger("CurrentPageLoad",doc.documentURI);
recentTabURI = doc.documentURI;
}
}
gBrowser.addEventListener("load", currentPageLoad, true);