aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bookmarktoolbar-hint.js31
-rw-r--r--commandBookmarklet.js14
-rw-r--r--copy.js9
-rw-r--r--encodingSwitcherCommand.js20
-rw-r--r--feedSomeKeys.js35
-rw-r--r--gmperator.js2
-rw-r--r--xpcom_inspector.js6
7 files changed, 81 insertions, 36 deletions
diff --git a/bookmarktoolbar-hint.js b/bookmarktoolbar-hint.js
index 297a7a7..a37ab94 100644
--- a/bookmarktoolbar-hint.js
+++ b/bookmarktoolbar-hint.js
@@ -18,6 +18,7 @@
//
liberator.plugins.bookmarkToolbarHints = (function(){
+ if (typeof plugins == 'undefined') plugins = liberator.plugins; // for 2.0 pre
function createTooltip(){
var tooltip = document.createElement('tooltip');
tooltip.setAttribute('style','padding:0;margin:0;');
@@ -63,7 +64,7 @@ liberator.plugins.bookmarkToolbarHints = (function(){
liberator.open(target.node.uri, where);
}
closeMenus(target);
- liberator.options.guioptions = manager.go;
+ liberator.modules.options.guioptions = manager.go;
}
function folderOpen(target){
target.firstChild.showPopup();
@@ -94,11 +95,11 @@ liberator.plugins.bookmarkToolbarHints = (function(){
this.go = options.guioptions;
options.guioptions += "b";
this.where = where;
- liberator.modes.setCustomMode('BookmarksToolbar-Hint', function(){return;}, this.quit);
+ liberator.modules.modes.setCustomMode('BookmarksToolbar-Hint', function(){return;}, this.quit);
this.show();
},
show:function(node){
- liberator.modes.set(liberator.modes.CUSTOM, liberator.modes.QUICK_HINT);
+ liberator.modules.modes.set(liberator.modules.modes.CUSTOM, liberator.modules.modes.QUICK_HINT);
hints = [];
window.addEventListener('keypress',onKeyPress,true);
current = node || getToolbar();
@@ -112,14 +113,15 @@ liberator.plugins.bookmarkToolbarHints = (function(){
updateSelector();
},
onEvent: function(event){
- var key = liberator.events.toString(event);
+ var key = liberator.modules.events.toString(event);
switch(key){
case "<Esc>":
case "<C-[>":
closeMenus(current);
- liberator.options.guioptions = this.go;
+ liberator.modules.options.guioptions = this.go;
break;
case "<Return>":
+ case "<Right>":
if (toolbarOpen(hints[currentNum])) return;
break;
case "f":
@@ -131,9 +133,11 @@ liberator.plugins.bookmarkToolbarHints = (function(){
return;
case "<Tab>":
case "j":
+ case "<Down>":
case "<S-Tab>":
case "k":
- if (key == "j" || key == "<Tab>"){
+ case "<Up>":
+ if (key == "j" || key == "<Tab>" || key == "<Down>"){
currentNum = hints.length -1 == currentNum ? 0 : currentNum + 1;
} else {
currentNum = currentNum == 0 ? hints.length -1 : currentNum - 1;
@@ -155,7 +159,7 @@ liberator.plugins.bookmarkToolbarHints = (function(){
case "h":
if (current == this.toolbar){
closeMenus(current);
- liberator.options.guioptions = this.go;
+ liberator.modules.options.guioptions = this.go;
this.quit();
} else {
current.hidePopup();
@@ -185,7 +189,7 @@ liberator.plugins.bookmarkToolbarHints = (function(){
currentNum = 0;
useShift = false;
window.removeEventListener('keypress',onKeyPress,true);
- liberator.modes.reset(true);
+ liberator.modules.modes.reset(true);
while(tooltipbox.hasChildNodes()){
tooltipbox.firstChild.hidePopup();
tooltipbox.removeChild(tooltipbox.firstChild);
@@ -194,18 +198,19 @@ liberator.plugins.bookmarkToolbarHints = (function(){
};
var tooltipbox = document.createElement('box');
tooltipbox.setAttribute('id','liberator-tooltip-container');
- document.getElementById('liberator-container').appendChild(tooltipbox);
+ //document.getElementById('liberator-container').appendChild(tooltipbox);
+ document.getElementById('browser').appendChild(tooltipbox);
return manager;
})();
-liberator.mappings.addUserMap([liberator.modes.NORMAL], ['<Leader>f'],
+liberator.modules.mappings.addUserMap([liberator.modules.modes.NORMAL], ['<Leader>f'],
'Start Toolbar-HINTS (open current tab)',
- function(){ plugins.bookmarkToolbarHints.startup(liberator.CURRENT_TAB); },
+ function(){ liberator.plugins.bookmarkToolbarHints.startup(liberator.CURRENT_TAB); },
{ rhs: 'Bookmarks Toolbar-HINTS (current-tab)'}
);
-liberator.mappings.addUserMap([liberator.modes.NORMAL], ['<Leader>F'],
+liberator.modules.mappings.addUserMap([liberator.modules.modes.NORMAL], ['<Leader>F'],
'Start Toolbar-HINTS (open new tab)',
- function(){ plugins.bookmarkToolbarHints.startup(liberator.NEW_TAB); },
+ function(){ liberator.plugins.bookmarkToolbarHints.startup(liberator.NEW_TAB); },
{ rhs: 'Bookmarks Toolbar-HINTS (new-tab)' }
);
diff --git a/commandBookmarklet.js b/commandBookmarklet.js
index c0d552a..0f71a44 100644
--- a/commandBookmarklet.js
+++ b/commandBookmarklet.js
@@ -7,7 +7,7 @@
(function(){
var filter = "javascript:";
- var items = liberator.bookmarks.get(filter);
+ var items = bookmarks.get(filter);
if (items.length == 0) {
if (filter.length > 0) {
@@ -19,18 +19,24 @@
items.forEach(function(item) {
var [url, title] = item;
+ var desc = title;
+ title = escape( title.replace(/ +/g,'').toLowerCase() );
+ if (title.match(/[^a-zA-Z]+/)) {
+ title = "bm"+title.replace(/[^a-zA-Z]+/g,'');
+ title = title.substr(0, title.length>50?50:title.length);
+ }
if (width(title) > 50) {
while (width(title) > 47) {
title = title.slice(0, -2);
}
title += "...";
}
- title = liberator.util.escapeHTML(title);
+ title = util.escapeHTML(title);
var command = function () { liberator.open(url); };
- liberator.commands.addUserCommand(
+ commands.addUserCommand(
[title],
- "bookmarklet",
+ "bookmarklet : "+desc,
command,
{
shortHelp: "Bookmarklet",
diff --git a/copy.js b/copy.js
index 4bcd3e3..a382e6c 100644
--- a/copy.js
+++ b/copy.js
@@ -79,8 +79,8 @@ liberator.globalVariables.copy_templates.forEach(function(template){
// used when argument is none
//const defaultValue = templates[0].label;
commands.addUserCommand(['copy'],'Copy to clipboard',
- function(arg, special){
- liberator.plugins.exCopy.copy(arg, special);
+ function(args, special){
+ liberator.plugins.exCopy.copy(args, special);
},{
completer: function(filter, special){
if (special){
@@ -120,7 +120,7 @@ function replaceVariable(str){
var win = new XPCNativeWrapper(window.content.window);
var sel = '',htmlsel = '';
if (str.indexOf('%SEL%') >= 0 || str.indexOf('%HTMLSEL%') >= 0){
- sel = win.getSelection().getRangeAt(0);
+ sel = win.getSelection().rangeCount()>0? win.getSelection().getRangeAt(0): '';
}
if (str.indexOf('%HTMLSEL%') >= 0){
var serializer = new XMLSerializer();
@@ -143,7 +143,8 @@ var exCopyManager = {
get: function(label){
return getCopyTemplate(label);
},
- copy: function(arg, special){
+ copy: function(args, special){
+ var arg = args.string == undefined ? args: args.string;
var copyString = '';
var isError = false;
if (special && arg){
diff --git a/encodingSwitcherCommand.js b/encodingSwitcherCommand.js
index 8ca0982..bf3cba6 100644
--- a/encodingSwitcherCommand.js
+++ b/encodingSwitcherCommand.js
@@ -80,7 +80,8 @@ function completion(array, filter){
return array.filter(function(v)
v[0].toLowerCase().indexOf(filter) == 0);
}
-liberator.commands.addUserCommand(['fileencoding','fenc'],'set the charactor encoding for the current page', function(value) {
+liberator.modules.commands.addUserCommand(['fileencoding','fenc'],'set the charactor encoding for the current page', function(args) {
+ var value = args.string == undefined ? args: args.string;
if(!value) {
var fenc = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset;
liberator.echo("fileencoding: "+fenc);
@@ -99,7 +100,8 @@ liberator.commands.addUserCommand(['fileencoding','fenc'],'set the charactor enc
[0,completion( encodings, filter)]
}
);
-liberator.commands.addUserCommand(['autodetector','audet'],'set auto detect character encoding', function(value) {
+liberator.modules.commands.addUserCommand(['autodetector','audet'],'set auto detect character encoding', function(args) {
+ var value = args.string == undefined ? args: args.string;
var pref = Cc['@mozilla.org/preferences-service;1'].getService(Ci.nsIPrefBranch);
if(!value) {
var audet = pref.getComplexValue('intl.charset.detector',Ci.nsISupportsString).data;
@@ -146,17 +148,19 @@ function listCharset(arg, current, list){
str.push('</table>');
liberator.echo( str.join(''), true);
}
-liberator.commands.addUserCommand(['listencoding','lsenc'],'list all encodings',
- function(arg){
- listCharset(arg, liberator.options.fileencoding, encodings);
+liberator.modules.commands.addUserCommand(['listencoding','lsenc'],'list all encodings',
+ function(args){
+ var arg = args.string == undefined ? args: args.string;
+ listCharset(arg, liberator.modules.options.fileencoding, encodings);
},{
completer: function(filter)
[0,completion(encodings, filter)]
}
);
-liberator.commands.addUserCommand(['listdetector','lsdet'],'list all auto detectors',
- function(arg){
- listCharset(arg, liberator.options.autodetector, detectors);
+liberator.modules.commands.addUserCommand(['listdetector','lsdet'],'list all auto detectors',
+ function(args){
+ var arg = args.string == undefined ? args: args.string;
+ listCharset(arg, liberator.modules.options.autodetector, detectors);
},{
completer: function(filter)
[0,completion(detectors, filter)]
diff --git a/feedSomeKeys.js b/feedSomeKeys.js
index ba4419a..7c3bb77 100644
--- a/feedSomeKeys.js
+++ b/feedSomeKeys.js
@@ -41,6 +41,15 @@ EOF
* 頭についている3の意味は3番目のフレームの意味。通常のmapと違い3回の意味ではないので注意
*
* Greasemonkey LDRizeの場合などにも使用可
+ *
+ * ※ 2008/11/1 に fmaps コマンドを追加
+ *
+ * .vimperatorrc に以下を追加することで、上記と同様のことができます。
+ * == LDR の場合 ==
+autocmd LocationChange http://reader\\.livedoor\\.com/reader fmaps j k s a p o v c <Space> <S-Space> z b < >
+ * == Gmail の場合 ==
+autocmd LocationChange mail\\.google\\.com/mail fmaps -d 4 c / j k n p o u e x s r a # [ ] z ? gi gs gt gd ga gc
+ *
*/
liberator.plugins.feedKey = (function(){
@@ -295,10 +304,12 @@ function feedKeyIntoContent(keys, useVkey){
// --------------------------
commands.addUserCommand(['feedmap','fmap'],'Feed Map a key sequence',
function(args, bang){
- if(!args){
- echo(feedMaps.map(function(map) map.description.replace(/</g,'&lt;').replace(/>/g,'&gt;')),true);
+ var arg = args.string == undefined ? args: args.string;
+ if(!arg){
+ liberator.echo(feedMaps.map(function(map) map.description.replace(/</g,'&lt;').replace(/>/g,'&gt;')),true);
+ return;
}
- var [ ,lhs,rhs] = args.match(/(\S+)(?:\s+(.+))?/);
+ var [ ,lhs,rhs] = arg.match(/(\S+)(?:\s+(.+))?/);
if (!rhs){
replaceUserMap(lhs,lhs,bang);
} else {
@@ -315,6 +326,24 @@ var converter = {
setup: init,
reset: destroy
};
+commands.addUserCommand(['feedmaps','fmaps'], '',
+ function(args, bang){
+ var feedkey = args["-depth"];
+ var vkey = '-vkey' in args ? true: false;
+ var keys = args.arguments;
+ if ('-' in args) keys.push('-');
+
+ if (feedkey) keys = keys.map( function(i) [i, (feedkey+"")+i] );
+ liberator.plugins.feedKey.setup(keys, vkey);
+ }, {
+ bang : true,
+ argCount : "*",
+ options : [ [['-depth', '-d'], commands.OPTION_INT],
+ [['-vkey', '-v'], commands.OPTION_NOARG],
+ [['-'], commands.OPTION_NOARG ]
+ ]
+ }
+);
return converter;
})();
// vim: fdm=marker sw=4 ts=4 et:
diff --git a/gmperator.js b/gmperator.js
index 24b2e36..e26c447 100644
--- a/gmperator.js
+++ b/gmperator.js
@@ -162,7 +162,7 @@ liberator.plugins.gmperator = (function(){ //{{{
});
function getPanelID(win){
var tabs = getBrowser().mTabs;
- for (var i=0; tabs.length; i++){
+ for (var i=0; i<tabs.length; i++){
var tab = tabs.item(i);
if (tab.linkedBrowser.contentWindow == win){
return tab.linkedPanel;
diff --git a/xpcom_inspector.js b/xpcom_inspector.js
index 1132fee..e4ac07f 100644
--- a/xpcom_inspector.js
+++ b/xpcom_inspector.js
@@ -104,13 +104,13 @@ for (let c in Cc){
// ----------------------------------------------
// Commands
// ----------------------------------------------
-liberator.commands.addUserCommand(['lscc'], 'List XPCOM class',
+commands.addUserCommand(['lscc'], 'List XPCOM class',
function(arg){
if (!arg){
liberator.echoerr('No arguments');
return;
}
- var args = liberator.commands.parseArgs(arg).arguments;
+ var args = args.arguments ? args.arguments: commands.parseArgs(arg).arguments;
if (args.length == 1){
liberator.echo(liberator.XPCOM.listClass(args[0], null, true), true);
} else if (args[1] in Ci){
@@ -122,7 +122,7 @@ liberator.commands.addUserCommand(['lscc'], 'List XPCOM class',
}, {
completer: function(filter){
if (!filter) return [];
- var args = liberator.commands.parseArgs(filter).arguments;
+ var args = filter.arguments? filter.filter: commands.parseArgs(filter).arguments;
var list = [];
var position = 0;
var reg;