aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_libly.js9
-rw-r--r--access_hatena.js5
-rw-r--r--addhatebu.js2
-rw-r--r--appendAnchor.js2
-rw-r--r--auto_detect_link.js5
-rw-r--r--auto_source.js2
-rw-r--r--caret-hint.js2
-rw-r--r--commandBookmarklet.js5
-rw-r--r--copy.js2
-rw-r--r--direct_bookmark.js23
-rw-r--r--edit-vimperator-files.js2
-rw-r--r--escape-from-iframe.js71
-rw-r--r--feedSomeKeys_3.js2
-rw-r--r--gmail-commando.js50
-rw-r--r--google-translator.js2
-rw-r--r--hatena-bookmark-search.js2
-rw-r--r--hints-for-embedded.js6
-rw-r--r--ldrize_cooperation.js851
-rw-r--r--loginManager.js88
-rw-r--r--migemized_find.js33
-rw-r--r--multi_requester.js2
-rw-r--r--nextlink.js2
-rw-r--r--pluginManager.js6
-rw-r--r--scenario-actor.js2
-rw-r--r--session-manager.js2
-rw-r--r--sl.js16
-rw-r--r--stella.js20
-rw-r--r--twaudio.js81
-rw-r--r--twittperator.js21
-rw-r--r--twittperator/pong.tw2
-rw-r--r--twittperator/twlist-win.tw4
-rw-r--r--usi.js6
-rw-r--r--walk-input.js2
-rw-r--r--zip-de-download.js12
-rw-r--r--跳.js4
35 files changed, 704 insertions, 642 deletions
diff --git a/_libly.js b/_libly.js
index b62e34a..dfbb65b 100644
--- a/_libly.js
+++ b/_libly.js
@@ -1,5 +1,6 @@
/*** BEGIN LICENSE BLOCK {{{
Copyright (c) 2008 suVene<suvene@zeromemory.info>
+ Copyright (c) 2008-2011 anekos<anekos@snca.net>
distributable under the terms of an MIT-style license.
http://www.opensource.jp/licenses/mit-license.html
@@ -11,10 +12,10 @@ var PLUGIN_INFO =
<description>Vimperator plugins library?</description>
<description lang="ja">適当なライブラリっぽいものたち。</description>
<author mail="suvene@zeromemory.info" homepage="http://zeromemory.sblo.jp/">suVene</author>
+ <author mail="anekos@snca.net" homepage="http://snca.net/">anekos</author>
<license>MIT</license>
- <version>0.1.34</version>
+ <version>0.1.35</version>
<minVersion>2.3pre</minVersion>
- <maxVersion>3.0</maxVersion>
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/_libly.js</updateURL>
<detail><![CDATA[
== Objects ==
@@ -275,7 +276,7 @@ libly.$U = {//{{{
let self = this, args = arguments;
return func.call(self, function (_args) original.apply(self, _args || args), args);
};
- libly.$U.extend(current, {original: original.original || original, restore: restore});
+ libly.$U.extend(current, {original: original && original.original || original, restore: restore});
return libly.$U.extend({
original: original,
current: current,
@@ -682,7 +683,7 @@ libly.Wedata.prototype = {
var logger = this.logger;
var STORE_KEY = 'plugins-libly-wedata-' + this.dbname + '-items';
- var store = storage.newMap(STORE_KEY, true);
+ var store = storage.newMap(STORE_KEY, {store: true});
var cache = store && store.get('data');
if (store && cache && new Date(store.get('expire')) > new Date()) {
diff --git a/access_hatena.js b/access_hatena.js
index 3cb56ce..b291b02 100644
--- a/access_hatena.js
+++ b/access_hatena.js
@@ -133,7 +133,7 @@ map ; :accesshatena
root.containerOpen = true;
for (var i = 0, length = root.childCount; i < length; i++) {
var page = root.getChild(i);
- page.uri.match('^https?://([a-zA-Z0-9.]+)\\.hatena\\.ne\\.jp/([a-zA-Z][a-zA-Z0-9_-]{1,30}[a-zA-Z0-9]/?)?');
+ page.uri.match('^https?://([a-zA-Z0-9.]+)\\.hatena\\.ne\\.jp/([a-zA-Z][a-zA-Z0-9_-]{1,30}[a-zA-Z0-9](?:\\+[a-zA-Z0-9_-]{1,30})?/?)?');
var host = RegExp.$1;
var id = RegExp.$2;
var _recent_hosts_length = recentHosts.length;
@@ -218,7 +218,8 @@ map ; :accesshatena
} else if (args.length == 2) {
var host = args[0].toString();
context.title = ["ID", "Page"];
- context.completions = [[ids[i], title.get(host, ids[i])] for (i in ids) if (ids.hasOwnProperty(i))];
+ var _completions = [[ids[i], title.get(host, ids[i])] for (i in ids) if (ids.hasOwnProperty(i))];
+ context.completions = host != 'd' ? _completions.filter(function(i){ return !/\+/.test(i[0]) }) : _completions;
}
}
}
diff --git a/addhatebu.js b/addhatebu.js
index b45be21..7fff76e 100644
--- a/addhatebu.js
+++ b/addhatebu.js
@@ -7,7 +7,7 @@ var INFO =
<author email="mitsugu.oyama@gmail.com">Mitsugu Oyama</author>
<license href="http://opensource.org/licenses/mit-license.php">MIT</license>
<project name="Vimperator" minVersion="2.3"/>
- <p>Toggle login box of <link topic="http://www.pixiv.net/">pixiv</link> by this plugin. </p>
+ <p>Add contents to Hatena Bookmarks. </p>
<item>
<tags>'addhatebu'</tags>
<spec>:addhatebu</spec>
diff --git a/appendAnchor.js b/appendAnchor.js
index 77496e8..8ca02a2 100644
--- a/appendAnchor.js
+++ b/appendAnchor.js
@@ -73,7 +73,7 @@ let PLUGIN_INFO =
// build URL
let scheme = RegExp.$1, host = RegExp.$2, lastMatch = RegExp.lastMatch;
- if (/^ttps?$/(scheme)) scheme = 'h' + scheme;
+ if (/^ttps?$/.test(scheme)) scheme = 'h' + scheme;
let href = scheme + '://' + host;
// reset range
diff --git a/auto_detect_link.js b/auto_detect_link.js
index c2083af..4f11cc8 100644
--- a/auto_detect_link.js
+++ b/auto_detect_link.js
@@ -3,10 +3,9 @@ var PLUGIN_INFO =
<name>Auto Detect Link</name>
<description>Find (next|previous) link, and jump.</description>
<description lang="ja">(次|前)っぽいページへのリンクを探してジャンプ</description>
- <version>1.8.2</version>
+ <version>1.8.3</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<minVersion>2.0pre</minVersion>
- <maxVersion>2.4</maxVersion>
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/auto_detect_link.js</updateURL>
<license document="http://creativecommons.org/licenses/by-sa/3.0/">
Creative Commons Attribution-Share Alike 3.0 Unported
@@ -182,7 +181,7 @@ var PLUGIN_INFO =
// 要素をクリックする
function clickElement (elem)
- buffer.followLink(elem);
+ buffer.followLink(elem, liberator.CURRENT_TAB);
// 開いたURIなどの表示
diff --git a/auto_source.js b/auto_source.js
index b1ff95f..5b979fd 100644
--- a/auto_source.js
+++ b/auto_source.js
@@ -135,7 +135,7 @@ let INFO =
function source (filepath) {
io.source(filepath);
- if (/\.js$/(filepath)) {
+ if (/\.js$/.test(filepath)) {
let ctx = liberator.plugins.contexts[filepath];
if (ctx) {
if (typeof liberator.plugins[ctx.NAME] === 'undefined')
diff --git a/caret-hint.js b/caret-hint.js
index ba6772e..60c6ec0 100644
--- a/caret-hint.js
+++ b/caret-hint.js
@@ -288,7 +288,7 @@ let INFO =
// Vimperator 3.0 までと 3.1 以降に両対応
const [CaretKey, VisualKey] =
- /caret/(mappings.getDefault(modes.NORMAL, 'i').description) ? ['i', 'v'] : ['c', 'v'];
+ /caret/.exec(mappings.getDefault(modes.NORMAL, 'i').description) ? ['i', 'v'] : ['c', 'v'];
function moveCaret (elem, head, select) {
let doc = elem.ownerDocument;
diff --git a/commandBookmarklet.js b/commandBookmarklet.js
index 3375dce..811691c 100644
--- a/commandBookmarklet.js
+++ b/commandBookmarklet.js
@@ -75,8 +75,11 @@ if (!items.length) {
}
items.forEach(function (item) {
+ let name = toValidCommandName(item.title);
+ if (commands.get(name))
+ return;
commands.addUserCommand(
- [toValidCommandName(item.title)],
+ [name],
'bookmarklet : ' + item.title,
function () evalScript(item.url),
{ shortHelp: 'Bookmarklet' },
diff --git a/copy.js b/copy.js
index 8e353da..b4a57a4 100644
--- a/copy.js
+++ b/copy.js
@@ -265,7 +265,7 @@ function wedataRegister(item){
return function(value, value2){
var STORE_KEY = 'plugins-copy-ok-func';
- var store = storage.newMap(STORE_KEY, true);
+ var store = storage.newMap(STORE_KEY, {store: true});
var check = store.get(item.label);
var ans;
diff --git a/direct_bookmark.js b/direct_bookmark.js
index 1d3688b..37f80b6 100644
--- a/direct_bookmark.js
+++ b/direct_bookmark.js
@@ -1,4 +1,4 @@
-// Last Change: 21-Jan-2010. Jan 2008
+// Last Change: 27-May-2011. Jan 2008
var PLUGIN_INFO =
<VimperatorPlugin>
<name>{NAME}</name>
@@ -28,6 +28,7 @@ for Migemo search: require XUL/Migemo Extension
'h': Hatena Bookmark
'd': del.icio.us
'l': livedoor clip
+ 'g': Google Bookmarks
'p': Places (Firefox bookmarks)
Usage: let g:direct_sbm_use_services_by_tag = "hdl"
||<
@@ -490,7 +491,7 @@ for Migemo search: require XUL/Migemo Extension
poster:function(user,password,url,title,comment,tags){
var request_url = 'http://www.google.com/bookmarks/mark';
var params = [
- ['bkmk', url], ['title', title], ['labels', tags.join(',')]
+ ['bkmk', url], ['title', title], ['labels', tags.join(',')], ['annotation', comment]
].map(function(p) p[0] + '=' + encodeURIComponent(p[1])).join('&');
return Deferred.http({
method: "post",
@@ -503,7 +504,23 @@ for Migemo search: require XUL/Migemo Extension
if(xhr.status != 200) throw "Google Bookmarks: failed";
});
},
- tags:function(user,password) [],
+ tags:function(user,password){
+ var returnValue = [];
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "https://www.google.com/bookmarks", false, user, password);
+ xhr.send(null);
+
+ var html = parseHTML(xhr.responseText);
+ var tags = getElementsByXPath('//a[contains(@id,"lbl_m_")]/text()',html);
+
+ tags.forEach(function(tag){
+ var text = tag.textContent;
+ if(text.match(/\S/)) {
+ returnValue.push(text);
+ }
+ });
+ return returnValue;
+ },
},
'f': {
description:'foves',
diff --git a/edit-vimperator-files.js b/edit-vimperator-files.js
index 0ee97fc..544c562 100644
--- a/edit-vimperator-files.js
+++ b/edit-vimperator-files.js
@@ -99,7 +99,7 @@ let INFO =
[
[file.path, dir]
for ([, file] in Iterator(io.File(dir).readDirectory(false)))
- if (file.isFile() && /^[\._]vimperatorrc|\.(js|vimp|css)$/(file.leafName))
+ if (file.isFile() && /^[\._]vimperatorrc|\.(js|vimp|css)$/.test(file.leafName))
]
for ([, dir] in Iterator(dirs))
]);
diff --git a/escape-from-iframe.js b/escape-from-iframe.js
new file mode 100644
index 0000000..7eede18
--- /dev/null
+++ b/escape-from-iframe.js
@@ -0,0 +1,71 @@
+/* NEW BSD LICENSE {{{
+Copyright (c) 2011, anekos.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+
+
+###################################################################################
+# http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license #
+# に参考になる日本語訳がありますが、有効なのは上記英文となります。 #
+###################################################################################
+
+}}} */
+
+// INFO {{{
+let INFO =
+<>
+ <plugin name="Escape from iframe." version="1.0.0"
+ href="http://vimpr.github.com/"
+ summary="Escape from iframe (focus to parent window)."
+ lang="en-US"
+ xmlns="http://vimperator.org/namespaces/liberator">
+ <author email="anekos@snca.net">anekos</author>
+ <license>New BSD License</license>
+ <project name="Vimperator" minVersion="3.0"/>
+ <p>Just install this plugin.</p>
+ <item>
+ <tags><![CDATA[<Esc>]]></tags>
+ <spec>&lt;Esc></spec>
+ <description><p>Escape from iframe (focus to parent window).</p></description>
+ </item>
+ </plugin>
+</>;
+// }}}
+
+(function () {
+ //let map = mappings.getDefault(modes.NORMAL, '<ESC>');
+ mappings.addUserMap(
+ [modes.NORMAL],
+ ['<ESC>'],
+ 'Focus to parent window',
+ function() {
+ if (modes.passNextKey || modes.passAllKeys)
+ return events.onEscape();
+ Buffer.focusedWindow = Buffer.focusedWindow.parent;
+ },
+ {}
+ );
+})();
+
+// vim:sw=2 ts=2 et si fdm=marker:
diff --git a/feedSomeKeys_3.js b/feedSomeKeys_3.js
index e265084..b8891c5 100644
--- a/feedSomeKeys_3.js
+++ b/feedSomeKeys_3.js
@@ -520,7 +520,7 @@ let INFO = <>
const ModeStringsCompleter = [
[name, disp + ' mode' + (char ? ' (alias: ' + char + ')' : '')]
for ([n, {name, char, disp, extended}] in Iterator(modes._modeMap))
- if (!extended && /^\D+$/(n))
+ if (!extended && /^\D+$/.test(n))
];
diff --git a/gmail-commando.js b/gmail-commando.js
index 25ca2a3..8a33b0c 100644
--- a/gmail-commando.js
+++ b/gmail-commando.js
@@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
// INFO {{{
let INFO =
<>
- <plugin name="GMailCommando" version="1.4.5"
+ <plugin name="GMailCommando" version="1.4.8"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail-commando.js"
summary="The handy commands for GMail"
lang="en-US"
@@ -72,7 +72,7 @@ let INFO =
</description>
</item>
</plugin>
- <plugin name="GMailコマンドー" version="1.4.5"
+ <plugin name="GMailコマンドー" version="1.4.8"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail-commando.js"
summary="便利なGMail用コマンドー"
lang="ja"
@@ -118,6 +118,9 @@ let INFO =
function A (list)
Array.slice(list);
+ function click (elem)
+ buffer.followLink(elem, liberator.CURRENT_TAB);
+
const Conf = (function () {
let gv = liberator.globalVariables;
let conf = {};
@@ -229,12 +232,14 @@ let INFO =
const Elements = {
get doc() content.frames[3].document,
- get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/(it.href))),
+ get hasBuzz () !!this.doc.querySelector('input#\\:re'),
+
+ get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/.test(it.href))),
- // 入力欄 - input
- get input() this.doc.getElementById(':re'),
+ // 入力欄 と 検索ボタンは Buzz の有効無効によって ID が変わる
+ get input() this.doc.querySelector('input#\\:' + (this.hasBuzz ? 're' : 'rf')),
- get searchButton() this.doc.getElementById(':ri'),
+ get searchButton() this.doc.querySelector('div#\\:' + (this.hasBuzz ? 'ri' : 'rj')),
get translateButton () (this.mail && this.mail.querySelector('tr > td.SA > .iL.B9')),
get translateButtons () A(this.doc.querySelectorAll('tr > td.SA > .iL.B9')),
@@ -262,9 +267,9 @@ let INFO =
if (result)
return A(result);
- buffer.followLink(show());
+ click(show());
result = labels();
- buffer.followLink(show());
+ click(show());
return A(result);
},
@@ -275,17 +280,10 @@ let INFO =
Elements.doc.querySelectorAll('.NRYPqe > .J-Zh-I.J-J5-Ji.J-Zh-I.J-Zh-I-Js-Zq')[2]
};
- //'.J-M-JJ > input'
- //let (e = Elements.doc.querySelector('.J-LC-Jz')) {
- // liberator.log(e);
- // buffer.followLink(e);
- // //plugins.feedSomeKeys_3.API.feed('<Cr>', ['keydown'], e)
- //}
-
const Commando = {
get inGmail () {
try {
- var result = /^mail\.google\.com$/(Elements.doc.location.hostname)
+ var result = /^mail\.google\.com$/.test(Elements.doc.location.hostname)
} catch (e) {}
return result;
},
@@ -295,7 +293,7 @@ let INFO =
if (this.inGmail && !newtab) {
Elements.input.value = args;
- buffer.followLink(Elements.searchButton);
+ click(Elements.searchButton);
} else {
liberator.open(URL + encodeURIComponent(args), liberator.NEW_TAB);
}
@@ -307,20 +305,20 @@ let INFO =
const Commands = {
translate: function () {
let button = Elements.translateButton || Elements.translateButtons[0];
- buffer.followLink(button);
+ click(button);
},
- translateThread: function () buffer.followLink(Elements.translateThreadButton),
- fold: function () buffer.followLink(Elements.foldButton),
- unfold: function () buffer.followLink(Elements.unfoldButton),
+ translateThread: function () click(Elements.translateThreadButton),
+ fold: function () click(Elements.foldButton),
+ unfold: function () click(Elements.unfoldButton),
label: function (names) {
Elements.labelButtons.forEach(function (e) {
if (names.some(function (v) (v == e.textContent)))
- buffer.followLink(e);
+ click(e);
liberator.log('pressed: ' + e.textContent);
});
},
- important: function () buffer.followLink(Elements.importantButton),
- unimportant: function () buffer.followLink(Elements.unimportantButton)
+ important: function () click(Elements.importantButton),
+ unimportant: function () click(Elements.unimportantButton)
};
@@ -393,7 +391,7 @@ let INFO =
let input = args.string.slice(0, context.caret);
let m;
- if (m = /([a-z]+):(?:([^\s\(\)\{\}]*)|[\(\{]([^\(\)\{\}]*))$/(input)) {
+ if (m = /([a-z]+):(?:([^\s\(\)\{\}]*)|[\(\{]([^\(\)\{\}]*))$/.exec(input)) {
if (m[2]) {
context.advance(input.length - m[2].length);
} else {
@@ -402,7 +400,7 @@ let INFO =
}
let key = m[1];
KeywordValueCompleter[key](context, args);
- } else if (m = /[-\s]*([^-\s:\(\)\{\}]*)$/(input)) {
+ } else if (m = /[-\s]*([^-\s:\(\)\{\}]*)$/.exec(input)) {
context.advance(input.length - m[1].length);
context.completions = [
[v + ':', v] for ([, v] in Iterator(GMailSearchKeyword))
diff --git a/google-translator.js b/google-translator.js
index a34819e..49d272b 100644
--- a/google-translator.js
+++ b/google-translator.js
@@ -201,7 +201,7 @@ let INFO =
context.completions = [
[it, '']
for ([, it] in Iterator(getTexts()))
- if (it.length > 3 && !/^\s*</(it))
+ if (it.length > 3 && !/^\s*</.test(it))
];
}
diff --git a/hatena-bookmark-search.js b/hatena-bookmark-search.js
index 746843f..22fc58d 100644
--- a/hatena-bookmark-search.js
+++ b/hatena-bookmark-search.js
@@ -245,7 +245,7 @@ HatenaBookmark.Cache = {
get store() {
if (!this._store) {
let key = 'plugins-hatena-bookmark-search-data';
- this._store = storage.newMap(key, true);
+ this._store = storage.newMap(key, {store: true});
}
return this._store;
},
diff --git a/hints-for-embedded.js b/hints-for-embedded.js
index 221e8fd..061dd7c 100644
--- a/hints-for-embedded.js
+++ b/hints-for-embedded.js
@@ -185,7 +185,7 @@ let INFO =
if (elem.tagName === 'IMG' && elem.src) {
if (openParent) {
let p = elem.parentNode;
- if (p.tagName === 'A' && /(gif|png|jpe?g)$/i(p.href))
+ if (p.tagName === 'A' && /(gif|png|jpe?g)$/i.test(p.href))
return liberator.open(p.href, liberator.NEW_TAB);
}
return liberator.open(elem.src, liberator.NEW_TAB);
@@ -201,7 +201,7 @@ let INFO =
if (site) {
for each (let [n, v] in info) {
[n, v] = [String(n), String(v)];
- if (site.name && !site.name(n))
+ if (site.name && !site.name.test(n))
continue;
let m = n.match(site.value) || v.match(site.value);
if (m)
@@ -209,7 +209,7 @@ let INFO =
}
}
- let urls = info.filter(function ([n, v]) /^https?:\/\//(v));
+ let urls = info.filter(function ([n, v]) /^https?:\/\//.test(v));
if (!urls.length)
return liberator.echoerr('Could not found URL');
diff --git a/ldrize_cooperation.js b/ldrize_cooperation.js
index 35952e4..7a361c8 100644
--- a/ldrize_cooperation.js
+++ b/ldrize_cooperation.js
@@ -1,425 +1,426 @@
-// Vimperator plugin: 'Cooperation LDRize Mappings'
-// Version: 0.25
-// Last Change: 07-Jan-2011. Jan 2008
-// License: Creative Commons
-// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
-//
-// Cooperation LDRize Mappings for Vimperator
-//
-// Variables:
-// g:ldrc_captureMapping
-// Specifies keys that capture by LDRize
-// usage: let g:ldrc_captureMappings = "['j','k','p','o','?']"
-// g:ldrc_enable
-// LDRize Cooperation be Enable by default or not
-// usage: let g:ldrc_enable = "false"
-// default: true
-// g:ldrc_hints
-// Narrows "hinttags" based on Siteinfo.
-// usage: let g:ldrc_hints = "true"
-// default: false
-// g:ldrc_intelligence_bind
-// More inteligence cooperation bind
-// usage: let g:ldrc_intelligence_bind = "true"
-// default: false
-// g:ldrc_skip
-// length in which paragraph is skipped (use by inteligence bind mode)
-// usage: let g:ldrc_hints = "true"
-// default: 0.5
-// Mappings:
-// Mappings for LDRize
-// default: 'j','k','p','o'
-// Commands:
-// 'm' or 'mb' or 'minibuffer':
-// Execute args as Minibuffer Command
-// usage: :minibuffer pinned-link | open | clear-pin
-// 'pin':
-// View pinned link list
-// usage: :pin
-// 'pindownload':
-// Download View pinned link by handler function or outer promgram. please see 'handlerInfo' also
-// usage: :pindownload
-// 'ldrc' or 'toggleldrizecooperation':
-// Toggle LDRize Cooperation
-// usage: :toggleldrizecooperation
-// Hints:
-// ';l':
-// narrow down the candidates to LDRize paragraphes
-// ';L':
-// narrow down the candidates to LDRize paragraphes (in a new tab)
-// Options:
-// 'ldrc'
-// Enable LDRize Cooperation
-// usage: :set ldrc
-// 'noldrc'
-// Disable LDRize Cooperation
-// usage: :set noldrc
-//
-// 'ldrchints'
-// Enable "Narrows Hinttags based on Siteinfo"
-// usage: :set ldrchints
-// 'noldrchints'
-// Disable "Narrows Hinttags based on Siteinfo"
-// usage: :set noldrchints
-if (liberator.plugins.LDRizeCooperation == undefined) (function(){
- //pattern: wildcard
- //include: [regexp,option] or regexp
- //handler: [programPath,[args]] or programPath or function(url,title)
- var handlerInfo = [
- //{
- // pattern: "http://www.nicovideo.jp/*",
- // handler: {
- // download: ["c:\\usr\\SmileDownloader\\SmileDownloader.exe",["%URL%"]]
- // },
- // wait: 5000
- //},
- //{
- // handler: ["C:\\usr\\irvine\\irvine.exe",["%URL%"]],
- //},
- ];
- const DISABLE_ICON = "data:image/png;base64,"
- +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAA7E"
- +"AAAOxAGVKw4bAAACL0lEQVR4nF2Sy0tUYRjGf9+Z4/HMjJfjBUZEMM2MSDII"
- +"REjSVtVecBFZi6Bdi4RW/SFBq2oR0R8gSaUJhVJIBkEEMZOWl5kuM+fqnPN9"
- +"52sxQ4kPv837Pu+zel4xMjkz/3h5p87pbhyDw4o1mzUOkubYbvLo2kVx+4Pe"
- +"rAKMdTGQ5YgiWK/8z+QT3yyVUTFAzaBXHQ0IONPKOxepAH65dUOGSB/pM9LC"
- +"whjyy/sg4DB3TjGZbjVuVIihQhKfxGdzmzhhNBvGXhr7NDiRY+fr573ibmtC"
- +"4pN4GNJDukiXusvbIuMnh9K9YujSYKKPl6vrZu+EI5EuyheG9JEe0qPusfSR"
- +"4cGBbPA98og8LMlAPlor2ZEvVIT0kD6G9EhcEpfY58c+xbKYHBaRl4Ye432s"
- +"rqyo7pnQo/qTxEW62gy2CKoAbheu4mGGm5eHgsViOTh+5Sp37+2X4gJQC0gU"
- +"Otb0j2hhaCG06NfC0K22/radzs6uTM3ojY1SobDcdHNaCC2Mimn2YZmQggEd"
- +"kPJ0UczfyOzVWHr1xnVmrS5I0R6pgTC1mXdoUwB2Jj5QFvDsBc8fTCkpL82l"
- +"uW6rWWEPQBoL07JwCgAaywbgd8ynIrultTB3wWk73LtWdS3OXtd/fBwH2+Yg"
- +"xM4R14kqrzMZzM5pO9dcNlQrl832wTSoGiEok84eOrK0ZGB0+shTJYpyFUv7"
- +"In/s/LlbTyq+/ufZFlkTK4MhAJKUMCGs6x473rg/9xe9wS0xVA1n/AAAAABJ"
- +"RU5ErkJggg==";
- const ENABLE_ICON = "data:image/png;base64,"
- +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsT"
- +"AAALEwEAmpwYAAACI0lEQVR4nGWSzU7yQBSGp84UKalDY0MkLsSdYWtCIok3"
- +"4YKV7tx7MWy9A6/ABZDgHbhghdFqU9M0FpH57cyUcdFA8Pue3fl5T07Oe5zz"
- +"8/PhcEgpbbfbtVoN7LBer9M01VpX4f7+/t3dnfP4+JimKQDg6OgIYwz+UpZl"
- +"HMdbjbUWZVkmpQQAEEJc1wX/EYZhHMdlWQIAKKV7cgPG+PLy8uPjg/+l3+/7"
- +"vl/1KKVQURRCCABAFEVa6yAIOOeO41Tjj4+PoyiK49h1XSkl53xPbOCcz+fz"
- +"bre7WCzYhpOTk+l0GoYhhFAIIaXck1JuNc/Pz51OpyiKahkAAMb49fVVCKGU"
- +"qgTw4uKCUqq1RggZY05PT8uyTJJEa312dvby8rJcLq21y+WSUiqlhN1uN89z"
- +"xpgxJs9zQkiv1xuNRlmWXV9f39/ff39/53meZRmllBCCZrNZkiTWWowxIWQ6"
- +"nV5dXRFCGGOfn59PT0+MMWut67pa6/V6jZrNpjHGWus4TqPRsNaORqPBYCCE"
- +"GI/Hvu/7vm+trc4KAEC+71dGQggrdyaTyXA4NMbc3NxsvW82mwCAoihQrVY7"
- +"PDzctVYIEUXR29tbo9GAEO6WpJTO7e0tIQRjXK/XhRCe5ymlsiyDEAZB4Hle"
- +"lawEX19fqNVqVS/kOE6r1fI8DyHU6XT++ShjzM/Pz8HBAXx/f+/3+9X2WmvO"
- +"uVKq3GCMUUoxxlarVb1ef3h4+AWNW50eXTIBjgAAAABJRU5ErkJggg==";
-
- var Class = function() function(){this.initialize.apply(this,arguments)};
-
- var _isEnable;
-
- function replaceMap (mode,key,desc,aroundFunc,extra){
- var old = liberator.modules.mappings.getDefault(mode,key);
- var oldAction = old.action;
- old.description = desc;
- old.action = function()
- let (self = this,args = arguments)
- aroundFunc(function() oldAction.apply(self,args));
- }
-
- var LDRizeCooperation = new Class();
- LDRizeCooperation.prototype = {
- initialize: function(){
- var self = this;
- this.LDRize = {getSiteinfo: function() undefined};
- this.Minibuffer = null;
- this.handlerInfo = handlerInfo;
-
- this.LDRizeCooperationPanel = this.setupStatusbarPanel();
-
- this.isEnable = liberator.globalVariables.ldrc_enable != undefined ?
- window.eval(liberator.globalVariables.ldrc_enable) : true ;
- this.isIntelligenceBind = liberator.globalVariables.ldrc_intelligence_bind != undefined ?
- window.eval(liberator.globalVariables.ldrc_intelligence_bind) : false ;
- this.isModHints = liberator.globalVariables.ldrc_hints != undefined ?
- window.eval(liberator.globalVariables.ldrc_hints) : false ;
- this.captureMappings = window.eval(liberator.globalVariables.ldrc_captureMappings) || ["j","k","p","o"];
- this.skipHeight = liberator.globalVariables.ldrc_skip != undefined ?
- window.eval(liberator.globalVariables.ldrc_skip) : 0.5 ;
-
- this.convertHandlerInfo(this.handlerInfo);
- this.hookGreasemonkey();
- this.initLDRizeCaptureKeys(this.captureMappings);
- this.initLDRizeCooperationFuture();
-
-
- if(liberator.plugins.LDRizeCooperationPlugins != undefined){
- liberator.plugins.LDRizeCooperationPlugins.forEach(function(func){
- func.apply(self,arguments);
- });
- delete liberator.plugins.LDRizeCooperationPlugins;
- }
- },
- setupStatusbarPanel: function(){
- var self = this;
- var LDRizeCooperationPanel = document.createElement("statusbarpanel");
- LDRizeCooperationPanel.setAttribute("id","ldrizecopperation-status");
- LDRizeCooperationPanel.setAttribute("class","statusbarpanel-iconic");
- LDRizeCooperationPanel.setAttribute("src",this.isEnable ? ENABLE_ICON : DISABLE_ICON);
- LDRizeCooperationPanel.addEventListener("click",function(e){
- self.isEnable = !self.isEnable;
- },false);
- var ref = document.getElementById("security-button") ? document.getElementById("security-button").nextSibling
- : document.getElementById("status-bar").firstChild;
- document.getElementById("status-bar").insertBefore(LDRizeCooperationPanel,ref);
-
- return LDRizeCooperationPanel;
- },
- hookGreasemonkey: function(){
- var self = this;
- var GreasemonkeyService;
- try{
- GreasemonkeyService = Cc["@greasemonkey.mozdev.org/greasemonkey-service;1"].getService().wrappedJSObject;
- this.addAfter(GreasemonkeyService,"evalInSandbox",function(){
- var gmVersion = liberator.extensions.filter(function(e)e.name=='Greasemonkey')[0].version;
- var versionChecker = Cc["@mozilla.org/xpcom/version-comparator;1"]
- .getService(Ci.nsIVersionComparator);
- if (versionChecker.compare(gmVersion, "0.8.*") > 0) {
- var [code,sandbox] = arguments;
- } else {
- var [code,codebase,sandbox] = arguments;
- }
- if(sandbox.window.LDRize != undefined && sandbox.window.Minibuffer != undefined){
- sandbox.window.addEventListener("focus",function(){
- self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo);
- self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand);
- if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize;
- if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command;
- },false);
- if(window.content.wrappedJSObject == sandbox.unsafeWindow){
- self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo);
- self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand);
- if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize;
- if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command;
- }
- }
- });
- }catch(e){
- liberator.log(e);
- }
- },
- initLDRizeCaptureKeys: function(keys){
- var self = this;
- keys.forEach(function(x){
- var map = liberator.modules.mappings.get(null,x) || liberator.modules.mappings.getDefault(null,x);
- var oldAction = map.action;
- var getter = "getPrev";
- switch(x){
- case "j": getter = "getNext";
- case "k": map.action = function(){
- self.isEnableLDRizeCooperation() ?
- self.isIntelligenceBind && self.isScrollOrBind(getter) ?
- oldAction.apply(this,arguments) // scroll
- : self.sendRawKeyEvent(0,x.charCodeAt(0)) // bind
- : oldAction.apply(this,arguments);
- };
- break;
- case "J":
- case "K": map.action = function(){
- self.isEnableLDRizeCooperation()
- ? self.sendRawKeyEvent(0,x.charCodeAt(0) + 32)
- : oldAction.apply(this,arguments);
- };
- break;
- default: map.action = function(){
- self.isEnableLDRizeCooperation()
- ? self.sendRawKeyEvent(0,x.charCodeAt(0))
- : oldAction.apply(this,arguments);
- };
- break;
- }
- });
- },
- initLDRizeCooperationFuture: function(){
- var self = this;
-
- //Hints
- [
- ["l","LDRize paragraphes",liberator.CURRENT_TAB],
- ["L","LDRize paragraphes (in a new tab",liberator.NEW_TAB]
- ].forEach(function([mode,prompt,target]){
- liberator.modules.hints.addMode(mode,prompt,
- function(elem) liberator.modules.buffer.followLink(elem,target),
- function(){
- var siteinfo = self.LDRize.getSiteinfo();
- return siteinfo.paragraph + "/" + siteinfo.link;
- });
-
- });
-
- //Commands
- liberator.modules.commands.addUserCommand(["pin"],"LDRize Pinned Links",
- function(){
- var links = self.getPinnedItems();
- var showString = links.length + " Items<br/>";
- links.forEach(function(link){
- showString += link + "<br/>";
- });
- liberator.modules.commandline.echo(showString,liberator.modules.commandline.HL_NORMAL,liberator.modules.commandline.FORCE_MULTILINE);
- },{});
- liberator.modules.commands.addUserCommand(["mb","m","minibuffer"],"Execute Minibuffer",
- function(arg){ self.Minibuffer.execute(arg.string.replace(/\\+/g,"")) },
- {
- completer: function(context,arg){
- var filter = context.filter;
- var completionList = [];
- var command = self.Minibuffer.command;
- var alias = self.Minibuffer.alias_getter();
- var tokens = filter.split("|").map(function(str) str.replace(/\s+/g,""));
- var exp = new RegExp("^" + tokens.pop());
- for(let i in command) if(exp.test(i))completionList.push([tokens.concat(i).join(" | "),"MinibufferCommand"]);
- for(let i in alias) if(exp.test(i))completionList.push([i,"MinibufferAlias"]);
- context.title = ["Minibuffer Command","Description"];
- context.completions = completionList;
- }
- });
- liberator.modules.commands.addUserCommand(["pindownload"],"Download pinned links by any software",
- function(arg){ self.downloadLinksByProgram("download",self.getPinnedItems());},{});
- liberator.modules.commands.addUserCommand(["pindo"],"Do external command, with pinned links",
- function(arg){ self.downloadLinksByProgram(arg.string, self.getPinnedItems());},{});
- liberator.modules.commands.addUserCommand(["toggleldrizecooperation","toggleldrc"],"Toggle LDRize Cooperation",
- function(arg){ self.isEnable = !self.isEnable},{});
- //Options
- liberator.modules.options.add(["ldrc","ldrizecooperation"],"LDRize cooperation","boolean",this.isEnable,
- {
- setter: function(value){ return self.isEnable = value; },
- getter: function() self.isEnable
- }
- );
- liberator.modules.options.add(["ldrchints"],"mod hinttags for LDRize","boolean",this.isModHints,
- {
- setter: function(value){ return self.isModHints = value; },
- getter: function() self.isModHints
- }
- );
- },
- convertHandlerInfo: function(handlerInfoArray){
- handlerInfoArray.forEach(function(x){
- x.include = typeof x.include != "undefined"
- ? typeof x.include == "string" ? new RegExp(x.include) : new RegExp(x.include[0],x.include[1])
- : typeof x.pattern != "undefined"
- ? new RegExp("^"+String(x.pattern).replace(/\s+/g,"").replace(/[\\^$.+?|(){}\[\]]/g,"\\$&")
- .replace(/(?=\*)/g,".")+"$","i")
- : /(?:)/;
- delete x.pattern;
- });
- },
-
- get isEnable() _isEnable,
- set isEnable(value){
- this.LDRizeCooperationPanel.setAttribute("src",value ? DISABLE_ICON : ENABLE_ICON);
- _isEnable = value;
- },
- isEnableLDRize: function() this.LDRize.getSiteinfo() != undefined,
- isEnableLDRizeCooperation: function() /^https?:$/.test(content.location.protocol) && this.isEnable && this.isEnableLDRize(),
-
- //Pin
- getPinnedItems: function(){
- var linkXpath = this.LDRize.getSiteinfo()["link"];
- var viewXpath = this.LDRize.getSiteinfo()["view"] || linkXpath + "/text()";
- return this.LDRize.getPinnedItems().map(function(i){
- var linkResult = i.XPath(linkXpath),viewResult = i.XPath(viewXpath);
- return [linkResult,viewResult ? viewResult.textContent : null];
- });
- },
- downloadLinksByProgram: function(command, links){
- var self = this;
- var count = 0;
- links.forEach(function([url,title]){
- for each(let x in self.handlerInfo){
- if(x.include.test(url)){
- setTimeout(function(){
- if(typeof x.handler[command] == "object"){
- let args = x.handler[command][1].map(function(s) s.replace(/%URL%/g,url).replace(/%TITLE%/g,title));
- liberator.modules.io.run(x.handler[command][0],args,false);
- }else if(typeof x.handler[command] == "string"){
- liberator.modules.io.run(x.handler[command],[url],false);
- }else if(typeof x.handler[command] == "function"){
- x.handler[command](url.toString(),title);
- }
- },x.wait != undefined ? x.wait * count++ : 0);
- return;
- }
- }
- liberator.echoerr("LDRize Cooperation: download pattern not found!!");
- });
- },
- isScrollOrBind: function(getter){
- var self = this;
- var paragraphes,paragraph,current,next,innerHeight,scrollY,limit,p,np,cp;
- try{
- paragraphes = this.LDRize.getParagraphes();
- paragraph = paragraphes[getter]();
- current = paragraphes.current;
- next = paragraphes.getNext();
-
- innerHeight = window.content.innerHeight;
- scrollY = window.content.scrollY;
-
- limit = window.content.innerHeight * (self.skipHeight + 0.5);
-
- if(paragraph.paragraph == undefined) return true; // scroll
- if(current.paragraph == undefined) return false; // bind
- if(current.paragraph.y - window.content.scrollY == this.LDRize.getScrollHeight()
- && getter == "getPrev") return false; // bind
-
- p = this.getClientPosition(paragraph.paragraph.node);
- np = next && next.paragraph.node != undefined ?
- this.getClientPosition(next.paragraph.node) :
- {top: window.content.scrollMaxY + window.content.innerHeight,left: 0};
- cp = this.getClientPosition(current.paragraph.node);
-
- /*
- *log(p);
- *log(np);
- *log(cp);
- */
-
- //check current paragraph
- if(!(scrollY < np.top && cp.top < scrollY + innerHeight)) return false; // bind
- //check next/prev paragraph
- if(Math.abs(p.top - (scrollY + innerHeight/2)) < innerHeight * 0.5) return false; // bind
- if(Math.abs(p.top - (scrollY + innerHeight/2)) > limit) return true; // scroll
- return false; // bind
- }catch(e){
- liberator.log(e);
- }
- },
-
- //Utils
- addAfter: function(target,name,after){
- var original = target[name];
- target[name] = function(){
- var tmp = original.apply(target,arguments);
- after.apply(target,arguments);
- return tmp;
- };
- },
- getClientPosition: function(elem){
- var position;
- try{
- position = elem.getBoundingClientRect();
- }catch(e){
- position = elem.parentNode.getBoundingClientRect();
- }
- return {
- left: Math.round(window.content.scrollX+position.left),
- top: Math.round(window.content.scrollY+position.top)
- };
- },
- sendRawKeyEvent: function(keyCode,charCode){
- modes.passAllKeys = true;
- var evt = window.content.wrappedJSObject.document.createEvent("KeyEvents");
- evt.initKeyEvent("keypress",false,false,window.content.wrappedJSObject,false,false,false,false,keyCode,charCode);
- window.content.wrappedJSObject.document.dispatchEvent(evt);
- modes.passAllKeys = false;
- },
- };
-
- liberator.plugins.LDRizeCooperation = new LDRizeCooperation();
-})();
+// Vimperator plugin: 'Cooperation LDRize Mappings'
+// Version: 0.25
+// Last Change: 09-Jun-2011. Jan 2008
+// License: Creative Commons
+// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
+//
+// Cooperation LDRize Mappings for Vimperator
+//
+// Variables:
+// g:ldrc_captureMapping
+// Specifies keys that capture by LDRize
+// usage: let g:ldrc_captureMappings = "['j','k','p','o','?']"
+// g:ldrc_enable
+// LDRize Cooperation be Enable by default or not
+// usage: let g:ldrc_enable = "false"
+// default: true
+// g:ldrc_hints
+// Narrows "hinttags" based on Siteinfo.
+// usage: let g:ldrc_hints = "true"
+// default: false
+// g:ldrc_intelligence_bind
+// More inteligence cooperation bind
+// usage: let g:ldrc_intelligence_bind = "true"
+// default: false
+// g:ldrc_skip
+// length in which paragraph is skipped (use by inteligence bind mode)
+// usage: let g:ldrc_hints = "true"
+// default: 0.5
+// Mappings:
+// Mappings for LDRize
+// default: 'j','k','p','o'
+// Commands:
+// 'm' or 'mb' or 'minibuffer':
+// Execute args as Minibuffer Command
+// usage: :minibuffer pinned-link | open | clear-pin
+// 'pin':
+// View pinned link list
+// usage: :pin
+// 'pindownload':
+// Download View pinned link by handler function or outer promgram. please see 'handlerInfo' also
+// usage: :pindownload
+// 'ldrc' or 'toggleldrizecooperation':
+// Toggle LDRize Cooperation
+// usage: :toggleldrizecooperation
+// Hints:
+// ';l':
+// narrow down the candidates to LDRize paragraphes
+// ';L':
+// narrow down the candidates to LDRize paragraphes (in a new tab)
+// Options:
+// 'ldrc'
+// Enable LDRize Cooperation
+// usage: :set ldrc
+// 'noldrc'
+// Disable LDRize Cooperation
+// usage: :set noldrc
+//
+// 'ldrchints'
+// Enable "Narrows Hinttags based on Siteinfo"
+// usage: :set ldrchints
+// 'noldrchints'
+// Disable "Narrows Hinttags based on Siteinfo"
+// usage: :set noldrchints
+if (liberator.plugins.LDRizeCooperation == undefined) (function(){
+ //pattern: wildcard
+ //include: [regexp,option] or regexp
+ //handler: [programPath,[args]] or programPath or function(url,title)
+ var handlerInfo = [
+ //{
+ // pattern: "http://www.nicovideo.jp/*",
+ // handler: {
+ // download: ["c:\\usr\\SmileDownloader\\SmileDownloader.exe",["%URL%"]]
+ // },
+ // wait: 5000
+ //},
+ //{
+ // handler: ["C:\\usr\\irvine\\irvine.exe",["%URL%"]],
+ //},
+ ];
+ const DISABLE_ICON = "data:image/png;base64,"
+ +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAA7E"
+ +"AAAOxAGVKw4bAAACL0lEQVR4nF2Sy0tUYRjGf9+Z4/HMjJfjBUZEMM2MSDII"
+ +"REjSVtVecBFZi6Bdi4RW/SFBq2oR0R8gSaUJhVJIBkEEMZOWl5kuM+fqnPN9"
+ +"52sxQ4kPv837Pu+zel4xMjkz/3h5p87pbhyDw4o1mzUOkubYbvLo2kVx+4Pe"
+ +"rAKMdTGQ5YgiWK/8z+QT3yyVUTFAzaBXHQ0IONPKOxepAH65dUOGSB/pM9LC"
+ +"whjyy/sg4DB3TjGZbjVuVIihQhKfxGdzmzhhNBvGXhr7NDiRY+fr573ibmtC"
+ +"4pN4GNJDukiXusvbIuMnh9K9YujSYKKPl6vrZu+EI5EuyheG9JEe0qPusfSR"
+ +"4cGBbPA98og8LMlAPlor2ZEvVIT0kD6G9EhcEpfY58c+xbKYHBaRl4Ye432s"
+ +"rqyo7pnQo/qTxEW62gy2CKoAbheu4mGGm5eHgsViOTh+5Sp37+2X4gJQC0gU"
+ +"Otb0j2hhaCG06NfC0K22/radzs6uTM3ojY1SobDcdHNaCC2Mimn2YZmQggEd"
+ +"kPJ0UczfyOzVWHr1xnVmrS5I0R6pgTC1mXdoUwB2Jj5QFvDsBc8fTCkpL82l"
+ +"uW6rWWEPQBoL07JwCgAaywbgd8ynIrultTB3wWk73LtWdS3OXtd/fBwH2+Yg"
+ +"xM4R14kqrzMZzM5pO9dcNlQrl832wTSoGiEok84eOrK0ZGB0+shTJYpyFUv7"
+ +"In/s/LlbTyq+/ufZFlkTK4MhAJKUMCGs6x473rg/9xe9wS0xVA1n/AAAAABJ"
+ +"RU5ErkJggg==";
+ const ENABLE_ICON = "data:image/png;base64,"
+ +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsT"
+ +"AAALEwEAmpwYAAACI0lEQVR4nGWSzU7yQBSGp84UKalDY0MkLsSdYWtCIok3"
+ +"4YKV7tx7MWy9A6/ABZDgHbhghdFqU9M0FpH57cyUcdFA8Pue3fl5T07Oe5zz"
+ +"8/PhcEgpbbfbtVoN7LBer9M01VpX4f7+/t3dnfP4+JimKQDg6OgIYwz+UpZl"
+ +"HMdbjbUWZVkmpQQAEEJc1wX/EYZhHMdlWQIAKKV7cgPG+PLy8uPjg/+l3+/7"
+ +"vl/1KKVQURRCCABAFEVa6yAIOOeO41Tjj4+PoyiK49h1XSkl53xPbOCcz+fz"
+ +"bre7WCzYhpOTk+l0GoYhhFAIIaXck1JuNc/Pz51OpyiKahkAAMb49fVVCKGU"
+ +"qgTw4uKCUqq1RggZY05PT8uyTJJEa312dvby8rJcLq21y+WSUiqlhN1uN89z"
+ +"xpgxJs9zQkiv1xuNRlmWXV9f39/ff39/53meZRmllBCCZrNZkiTWWowxIWQ6"
+ +"nV5dXRFCGGOfn59PT0+MMWut67pa6/V6jZrNpjHGWus4TqPRsNaORqPBYCCE"
+ +"GI/Hvu/7vm+trc4KAEC+71dGQggrdyaTyXA4NMbc3NxsvW82mwCAoihQrVY7"
+ +"PDzctVYIEUXR29tbo9GAEO6WpJTO7e0tIQRjXK/XhRCe5ymlsiyDEAZB4Hle"
+ +"lawEX19fqNVqVS/kOE6r1fI8DyHU6XT++ShjzM/Pz8HBAXx/f+/3+9X2WmvO"
+ +"uVKq3GCMUUoxxlarVb1ef3h4+AWNW50eXTIBjgAAAABJRU5ErkJggg==";
+
+ var Class = function() function(){this.initialize.apply(this,arguments)};
+
+ var _isEnable;
+
+ function replaceMap (mode,key,desc,aroundFunc,extra){
+ var old = liberator.modules.mappings.getDefault(mode,key);
+ var oldAction = old.action;
+ old.description = desc;
+ old.action = function()
+ let (self = this,args = arguments)
+ aroundFunc(function() oldAction.apply(self,args));
+ }
+
+ var LDRizeCooperation = new Class();
+ LDRizeCooperation.prototype = {
+ initialize: function(){
+ var self = this;
+ this.LDRize = {getSiteinfo: function() undefined};
+ this.Minibuffer = null;
+ this.handlerInfo = handlerInfo;
+
+ this.LDRizeCooperationPanel = this.setupStatusbarPanel();
+
+ this.isEnable = liberator.globalVariables.ldrc_enable != undefined ?
+ window.eval(liberator.globalVariables.ldrc_enable) : true ;
+ this.isIntelligenceBind = liberator.globalVariables.ldrc_intelligence_bind != undefined ?
+ window.eval(liberator.globalVariables.ldrc_intelligence_bind) : false ;
+ this.isModHints = liberator.globalVariables.ldrc_hints != undefined ?
+ window.eval(liberator.globalVariables.ldrc_hints) : false ;
+ this.captureMappings = window.eval(liberator.globalVariables.ldrc_captureMappings) || ["j","k","p","o"];
+ this.skipHeight = liberator.globalVariables.ldrc_skip != undefined ?
+ window.eval(liberator.globalVariables.ldrc_skip) : 0.5 ;
+
+ this.convertHandlerInfo(this.handlerInfo);
+ this.hookGreasemonkey();
+ this.initLDRizeCaptureKeys(this.captureMappings);
+ this.initLDRizeCooperationFuture();
+
+
+ if(liberator.plugins.LDRizeCooperationPlugins != undefined){
+ liberator.plugins.LDRizeCooperationPlugins.forEach(function(func){
+ func.apply(self,arguments);
+ });
+ delete liberator.plugins.LDRizeCooperationPlugins;
+ }
+ },
+ setupStatusbarPanel: function(){
+ var self = this;
+ var LDRizeCooperationPanel = document.createElement("statusbarpanel");
+ LDRizeCooperationPanel.setAttribute("id","ldrizecopperation-status");
+ LDRizeCooperationPanel.setAttribute("class","statusbarpanel-iconic");
+ LDRizeCooperationPanel.setAttribute("src",this.isEnable ? ENABLE_ICON : DISABLE_ICON);
+ LDRizeCooperationPanel.addEventListener("click",function(e){
+ self.isEnable = !self.isEnable;
+ },false);
+ var ref = document.getElementById("security-button") ? document.getElementById("security-button").nextSibling
+ : document.getElementById("status-bar").firstChild;
+ document.getElementById("status-bar").insertBefore(LDRizeCooperationPanel,ref);
+
+ return LDRizeCooperationPanel;
+ },
+ hookGreasemonkey: function(){
+ var self = this;
+ var GreasemonkeyService;
+ try{
+ GreasemonkeyService = Cc["@greasemonkey.mozdev.org/greasemonkey-service;1"].getService().wrappedJSObject;
+ this.addAfter(GreasemonkeyService,"evalInSandbox",function(){
+ var gmVersion = liberator.extensions.filter(function(e)e.name=='Greasemonkey')[0].version;
+ var versionChecker = Cc["@mozilla.org/xpcom/version-comparator;1"]
+ .getService(Ci.nsIVersionComparator);
+ if (versionChecker.compare(gmVersion, "0.8.*") > 0) {
+ var [code,sandbox] = arguments;
+ } else {
+ var [code,codebase,sandbox] = arguments;
+ }
+ if(sandbox.window.LDRize != undefined && sandbox.window.Minibuffer != undefined){
+ sandbox.window.addEventListener("focus",function(){
+ self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo);
+ self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand);
+ if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize;
+ if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command;
+ },false);
+ if(window.content.wrappedJSObject == sandbox.unsafeWindow){
+ self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo);
+ self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand);
+ if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize;
+ if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command;
+ }
+ }
+ });
+ }catch(e){
+ liberator.log(e);
+ }
+ },
+ initLDRizeCaptureKeys: function(keys){
+ var self = this;
+ keys.forEach(function(x){
+ var map = liberator.modules.mappings.get(null,x) || liberator.modules.mappings.getDefault(null,x);
+ var oldAction = map.action;
+ var getter = "getPrev";
+ switch(x){
+ case "j": getter = "getNext";
+ case "k": map.action = function(){
+ self.isEnableLDRizeCooperation() ?
+ self.isIntelligenceBind && self.isScrollOrBind(getter) ?
+ oldAction.apply(this,arguments) // scroll
+ : self.sendRawKeyEvent(0,x.charCodeAt(0)) // bind
+ : oldAction.apply(this,arguments);
+ };
+ break;
+ case "J":
+ case "K": map.action = function(){
+ self.isEnableLDRizeCooperation()
+ ? self.sendRawKeyEvent(0,x.charCodeAt(0) + 32)
+ : oldAction.apply(this,arguments);
+ };
+ break;
+ default: map.action = function(){
+ self.isEnableLDRizeCooperation()
+ ? self.sendRawKeyEvent(0,x.charCodeAt(0))
+ : oldAction.apply(this,arguments);
+ };
+ break;
+ }
+ });
+ },
+ initLDRizeCooperationFuture: function(){
+ var self = this;
+
+ //Hints
+ [
+ ["l","LDRize paragraphes",liberator.CURRENT_TAB],
+ ["L","LDRize paragraphes (in a new tab",liberator.NEW_TAB]
+ ].forEach(function([mode,prompt,target]){
+ liberator.modules.hints.addMode(mode,prompt,
+ function(elem) liberator.modules.buffer.followLink(elem,target),
+ function(){
+ var siteinfo = self.LDRize.getSiteinfo();
+ return siteinfo.paragraph + "/" + siteinfo.link;
+ });
+
+ });
+
+ //Commands
+ liberator.modules.commands.addUserCommand(["pin"],"LDRize Pinned Links",
+ function(){
+ var links = self.getPinnedItems();
+ var showString = links.length + " Items<br/>";
+ links.forEach(function(link){
+ showString += link + "<br/>";
+ });
+ liberator.modules.commandline.echo(showString,liberator.modules.commandline.HL_NORMAL,liberator.modules.commandline.FORCE_MULTILINE);
+ },{});
+ liberator.modules.commands.addUserCommand(["mb","m","minibuffer"],"Execute Minibuffer",
+ function(arg){ self.Minibuffer.execute(arg.string.replace(/\\+/g,"")) },
+ {
+ completer: function(context,arg){
+ var filter = context.filter;
+ var completionList = [];
+ var command = self.Minibuffer.command;
+ var alias = self.Minibuffer.alias_getter();
+ var tokens = filter.split("|").map(function(str) str.replace(/\s+/g,""));
+ var exp = new RegExp("^" + tokens.pop());
+ for(let i in command) if(exp.test(i))completionList.push([tokens.concat(i).join(" | "),"MinibufferCommand"]);
+ for(let i in alias) if(exp.test(i))completionList.push([i,"MinibufferAlias"]);
+ context.title = ["Minibuffer Command","Description"];
+ context.completions = completionList;
+ }
+ });
+ liberator.modules.commands.addUserCommand(["pindownload"],"Download pinned links by any software",
+ function(arg){ self.downloadLinksByProgram("download",self.getPinnedItems());},{});
+ liberator.modules.commands.addUserCommand(["pindo"],"Do external command, with pinned links",
+ function(arg){ self.downloadLinksByProgram(arg.string, self.getPinnedItems());},{});
+ liberator.modules.commands.addUserCommand(["toggleldrizecooperation","toggleldrc"],"Toggle LDRize Cooperation",
+ function(arg){ self.isEnable = !self.isEnable},{});
+ //Options
+ liberator.modules.options.add(["ldrc","ldrizecooperation"],"LDRize cooperation","boolean",this.isEnable,
+ {
+ setter: function(value){ return self.isEnable = value; },
+ getter: function() self.isEnable
+ }
+ );
+ liberator.modules.options.add(["ldrchints"],"mod hinttags for LDRize","boolean",this.isModHints,
+ {
+ setter: function(value){ return self.isModHints = value; },
+ getter: function() self.isModHints
+ }
+ );
+ },
+ convertHandlerInfo: function(handlerInfoArray){
+ handlerInfoArray.forEach(function(x){
+ x.include = typeof x.include != "undefined"
+ ? typeof x.include == "string" ? new RegExp(x.include) : new RegExp(x.include[0],x.include[1])
+ : typeof x.pattern != "undefined"
+ ? new RegExp("^"+String(x.pattern).replace(/\s+/g,"").replace(/[\\^$.+?|(){}\[\]]/g,"\\$&")
+ .replace(/(?=\*)/g,".")+"$","i")
+ : /(?:)/;
+ delete x.pattern;
+ });
+ },
+
+ get isEnable() _isEnable,
+ set isEnable(value){
+ this.LDRizeCooperationPanel.setAttribute("src",value ? DISABLE_ICON : ENABLE_ICON);
+ _isEnable = value;
+ },
+ isEnableLDRize: function() this.LDRize.getSiteinfo() != undefined ||
+ window.content.wrappedJSObject.document.getElementById("gm_ldrize") != null,
+ isEnableLDRizeCooperation: function() /^https?:$/.test(content.location.protocol) && this.isEnable && this.isEnableLDRize(),
+
+ //Pin
+ getPinnedItems: function(){
+ var linkXpath = this.LDRize.getSiteinfo()["link"];
+ var viewXpath = this.LDRize.getSiteinfo()["view"] || linkXpath + "/text()";
+ return this.LDRize.getPinnedItems().map(function(i){
+ var linkResult = i.XPath(linkXpath),viewResult = i.XPath(viewXpath);
+ return [linkResult,viewResult ? viewResult.textContent : null];
+ });
+ },
+ downloadLinksByProgram: function(command, links){
+ var self = this;
+ var count = 0;
+ links.forEach(function([url,title]){
+ for each(let x in self.handlerInfo){
+ if(x.include.test(url)){
+ setTimeout(function(){
+ if(typeof x.handler[command] == "object"){
+ let args = x.handler[command][1].map(function(s) s.replace(/%URL%/g,url).replace(/%TITLE%/g,title));
+ liberator.modules.io.run(x.handler[command][0],args,false);
+ }else if(typeof x.handler[command] == "string"){
+ liberator.modules.io.run(x.handler[command],[url],false);
+ }else if(typeof x.handler[command] == "function"){
+ x.handler[command](url.toString(),title);
+ }
+ },x.wait != undefined ? x.wait * count++ : 0);
+ return;
+ }
+ }
+ liberator.echoerr("LDRize Cooperation: download pattern not found!!");
+ });
+ },
+ isScrollOrBind: function(getter){
+ var self = this;
+ var paragraphes,paragraph,current,next,innerHeight,scrollY,limit,p,np,cp;
+ try{
+ paragraphes = this.LDRize.getParagraphes();
+ paragraph = paragraphes[getter]();
+ current = paragraphes.current;
+ next = paragraphes.getNext();
+
+ innerHeight = window.content.innerHeight;
+ scrollY = window.content.scrollY;
+
+ limit = window.content.innerHeight * (self.skipHeight + 0.5);
+
+ if(paragraph.paragraph == undefined) return true; // scroll
+ if(current.paragraph == undefined) return false; // bind
+ if(current.paragraph.y - window.content.scrollY == this.LDRize.getScrollHeight()
+ && getter == "getPrev") return false; // bind
+
+ p = this.getClientPosition(paragraph.paragraph.node);
+ np = next && next.paragraph.node != undefined ?
+ this.getClientPosition(next.paragraph.node) :
+ {top: window.content.scrollMaxY + window.content.innerHeight,left: 0};
+ cp = this.getClientPosition(current.paragraph.node);
+
+ /*
+ *log(p);
+ *log(np);
+ *log(cp);
+ */
+
+ //check current paragraph
+ if(!(scrollY < np.top && cp.top < scrollY + innerHeight)) return false; // bind
+ //check next/prev paragraph
+ if(Math.abs(p.top - (scrollY + innerHeight/2)) < innerHeight * 0.5) return false; // bind
+ if(Math.abs(p.top - (scrollY + innerHeight/2)) > limit) return true; // scroll
+ return false; // bind
+ }catch(e){
+ liberator.log(e);
+ }
+ },
+
+ //Utils
+ addAfter: function(target,name,after){
+ var original = target[name];
+ target[name] = function(){
+ var tmp = original.apply(target,arguments);
+ after.apply(target,arguments);
+ return tmp;
+ };
+ },
+ getClientPosition: function(elem){
+ var position;
+ try{
+ position = elem.getBoundingClientRect();
+ }catch(e){
+ position = elem.parentNode.getBoundingClientRect();
+ }
+ return {
+ left: Math.round(window.content.scrollX+position.left),
+ top: Math.round(window.content.scrollY+position.top)
+ };
+ },
+ sendRawKeyEvent: function(keyCode,charCode){
+ modes.passAllKeys = true;
+ var evt = window.content.wrappedJSObject.document.createEvent("KeyEvents");
+ evt.initKeyEvent("keypress",false,false,window.content.wrappedJSObject,false,false,false,false,keyCode,charCode);
+ window.content.wrappedJSObject.document.dispatchEvent(evt);
+ modes.passAllKeys = false;
+ },
+ };
+
+ liberator.plugins.LDRizeCooperation = new LDRizeCooperation();
+})(); \ No newline at end of file
diff --git a/loginManager.js b/loginManager.js
index 106f690..11a6a82 100644
--- a/loginManager.js
+++ b/loginManager.js
@@ -4,9 +4,9 @@ var PLUGIN_INFO =
<name>{NAME}</name>
<description>login manager</description>
<author mail="konbu.komuro@gmail.com" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author>
- <version>0.0.4</version>
+ <version>0.0.9</version>
<minVersion>2.0pre</minVersion>
- <maxVersion>2.2pre</maxVersion>
+ <maxVersion>3.2</maxVersion>
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/loginManger.js</updateURL>
<license>public domain</license>
<detail><![CDATA[
@@ -109,6 +109,45 @@ var services = {
CSRFPROTECT: tokenGetter(/CSRFPROTECT.+value="(.+?)"/),
},
},
+ delicious: {
+ HOST: ["https://secure.delicious.com"],
+ LOGIN: "/login",
+ LOGOUT: "/logout",
+ usernameField: "username",
+ passwordField: "password",
+ extraField: {
+ rememberme: "1",
+ },
+ },
+ evernote: {
+ HOST: ["https://www.evernote.com"],
+ LOGIN: "/Login.action",
+ LOGOUT: "/Logout.action",
+ usernameField: "username",
+ passwordField: "password",
+ extraField: {
+ rememberMe: "true",
+ _sourcePage: tokenGetterLoginURL(/_sourcePage.+value="(.+?)"/),
+ __fp: tokenGetterLoginURL(/__fp.+value="(.+?)"/),
+ login: "Sign In",
+ },
+ },
+ readitlater: {
+ HOST: ["http://readitlaterlist.com"],
+ LOGIN: "/login_process/",
+ LOGOUT: "/lo",
+ usernameField: "feed_id",
+ passwordField: "password",
+ },
+ nicovideo: {
+ HOST: ["https://secure.nicovideo.jp"],
+ LOGIN: "/secure/login",
+ usernameField: "mail",
+ passwordField: "password",
+ extraField: {
+ site: "niconico"
+ }
+ },
};
for (name in services){
services[name] = new Service(services[name]);
@@ -145,7 +184,7 @@ function Service(service) //{{{
login();
};
- self.logout = function(){
+ self.logout = function(username){
let content = {};
let host = service.HOST[0];
if (service.extraField && !self.setExtraField(content)) return false;
@@ -217,21 +256,44 @@ function tokenGetter(pattern) //{{{
return RegExp.$1;
}
};
+}
+function tokenGetterLoginURL(pattern) //{{{
+{
+ return function(service){
+ let res = util.httpGet(service.HOST[0]+service.LOGIN);
+ if (pattern.test(res.responseText)){
+ return RegExp.$1;
+ }
+ };
+}
+function getServiceAndUsernameFromArgs(args, logout)
+{
+ let [servicename, username] = args;
+ let service = services[servicename];
+ if (!service) return;
+ if (!username) {
+ let names = service.getUsernames();
+ if (names.length === 1)
+ username = names[0];
+ }
+ return [service, username];
} //}}}
// Commands
// {{{
commands.addUserCommand(["login"], "Login",
function(args){
- let [servicename, username] = args;
- let service = services[servicename];
- if (!service) return false;
+ let [service, username] = getServiceAndUsernameFromArgs(args);
+ if (!service)
+ return liberator.echoerr("Argument required. Please supply service name.");
+ if (!username)
+ return liberator.echoerr("Argument required. Please supply user name.");
service.login(username);
}, {
completer: function(context, args){
if (args.completeArg == 0){
context.title = ["service"];
- context.completions = [[s,""] for(s in services)];
+ context.completions = [[n,""] for([n,s] in Iterator(services)) if (s.getUsernames().length)];
} else if (args.completeArg == 1){
let service = services[args[0]];
if (!service) return false;
@@ -240,19 +302,19 @@ commands.addUserCommand(["login"], "Login",
}
},
literal: 1,
- });
+ }, true);
commands.addUserCommand(["logout"], "Logout",
function(args){
- let [servicename, username] = args;
- let service = services[servicename];
- if (!service) return false;
+ let [service, username] = getServiceAndUsernameFromArgs(args);
+ if (!service)
+ return liberator.echoerr("Argument required. Please supply service name.");
service.logout(username);
}, {
completer: function(context, args){
context.title = ["service"];
- context.completions = [[s,""] for(s in services)];
+ context.completions = [[n,""] for([n,s] in Iterator(services)) if (s.getUsernames().length)];
},
- });
+ }, true);
// }}}
})();
diff --git a/migemized_find.js b/migemized_find.js
index 3e9a16b..f6f9f4b 100644
--- a/migemized_find.js
+++ b/migemized_find.js
@@ -39,13 +39,12 @@ let PLUGIN_INFO =
<name lang="ja">Migemized Find</name>
<description>Migemize default page search.</description>
<description lang="ja">デフォルトのドキュメント内検索をミゲマイズする。</description>
- <version>2.10.1</version>
+ <version>2.10.2</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/migemized_find.js</updateURL>
<minVersion>3.0</minVersion>
- <maxVersion>3.0</maxVersion>
<detail><![CDATA[
== Usage ==
検索ワードの一文字目が
@@ -578,25 +577,29 @@ let PLUGIN_INFO =
MF.cancel();
},
- onKeyPress: function (str) {
- liberator.log('onKeyPress');
+ onChange: function (str) {
if (typeof str == 'string') {
- liberator.log('findFirst');
_findFirst(str, _backwards);
} else if (str === false)
MF.findAgain();
},
};
- commandline.registerCallback("change", modes.SEARCH_FORWARD, migemized.onKeyPress);
- commandline.registerCallback("submit", modes.SEARCH_FORWARD, migemized.onSubmit);
- commandline.registerCallback("cancel", modes.SEARCH_FORWARD, migemized.onCancel);
- commandline.registerCallback("change", modes.SEARCH_BACKWARD, migemized.onKeyPress);
- commandline.registerCallback("submit", modes.SEARCH_BACKWARD, migemized.onSubmit);
- commandline.registerCallback("cancel", modes.SEARCH_BACKWARD, migemized.onCancel);
-
finder.findAgain = migemized.findAgain;
+ plugins.libly.$U.around(
+ finder,
+ 'openPrompt',
+ function (next, [mode]) {
+ let res = next();
+ plugins.libly.$U.around(commandline._input, 'change', function (next, [str]) migemized.onChange(str));
+ plugins.libly.$U.around(commandline._input, 'submit', function (next, [str]) migemized.onSubmit(str));
+ plugins.libly.$U.around(commandline._input, 'cancel', function (next, [str]) migemized.onCancel());
+ return res;
+ },
+ true
+ );
+
// highlight コマンド
commands.addUserCommand(
['ml', 'migelight'],
@@ -611,7 +614,8 @@ let PLUGIN_INFO =
options: [
[['-color', '-c'], commands.OPTION_STRING, null, colorsCompltions],
]
- }
+ },
+ true
);
// remove highlight コマンド
@@ -647,7 +651,8 @@ let PLUGIN_INFO =
[['-backward', '-b'], commands.OPTION_NOARG],
[['-color', '-c'], commands.OPTION_STRING, null, colorsCompltions],
]
- }
+ },
+ true
);
// 外から使えるように
diff --git a/multi_requester.js b/multi_requester.js
index 9bfb4c4..305006f 100644
--- a/multi_requester.js
+++ b/multi_requester.js
@@ -123,7 +123,7 @@ var libly = liberator.plugins.libly;
var $U = libly.$U;
var logger = $U.getLogger("multi_requester");
var mergedSiteinfo = {};
-var store = storage.newMap('plugins-multi_requester', true);
+var store = storage.newMap('plugins-multi_requester', {store: true});
//}}}
// Vimperator plugin command register {{{
diff --git a/nextlink.js b/nextlink.js
index 00768dd..9149966 100644
--- a/nextlink.js
+++ b/nextlink.js
@@ -112,7 +112,7 @@ var actpattern = liberator.globalVariables.nextlink_nositeinfo_act || "e";
var nositeinfoAct = nositeinfoActions[actpattern];
-var localSiteinfo = storage.newMap("nextlink-local-siteinfo", false);
+var localSiteinfo = storage.newMap("nextlink-local-siteinfo", {store: false});
if (localSiteinfo)
localSiteinfo = [ info for ([ i, info ] in localSiteinfo) ];
diff --git a/pluginManager.js b/pluginManager.js
index 629a4e7..f191b9a 100644
--- a/pluginManager.js
+++ b/pluginManager.js
@@ -303,7 +303,7 @@ Plugin.prototype = { // {{{
return template.table(this.name, data);
}, // }}}
getResourceInfo: function(){
- var store = storage.newMap('plugins-pluginManager', true);
+ var store = storage.newMap('plugins-pluginManager', {store: true});
var url = this.info.updateURL;
var localResource = store.get(this.name) || {};
var serverResource = {
@@ -325,10 +325,10 @@ Plugin.prototype = { // {{{
}
});
} catch (e){}
- let m = /\bPLUGIN_INFO[ \t\r\n]*=[ \t\r\n]*<VimperatorPlugin(?:[ \t\r\n][^>]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/(source);
+ let m = /\bPLUGIN_INFO[ \t\r\n]*=[ \t\r\n]*<VimperatorPlugin(?:[ \t\r\n][^>]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/.exec(source);
if (m){
m = m[1].replace(/(?:<!(?:\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]|--(?:[^-]|-(?!-))*--)>)+/g, '');
- m = /^[\w\W]*?<version(?:[ \t\r\n][^>]*)?>([^<]+)<\/version[ \t\r\n]*>/(m);
+ m = /^[\w\W]*?<version(?:[ \t\r\n][^>]*)?>([^<]+)<\/version[ \t\r\n]*>/.exec(m);
if (m){
version = m[1];
}
diff --git a/scenario-actor.js b/scenario-actor.js
index 10735ec..727edb0 100644
--- a/scenario-actor.js
+++ b/scenario-actor.js
@@ -93,7 +93,7 @@ var $U = libly.$U;
var logger = $U.getLogger('scenario-actor');
function ScenarioActor () { //{{{
- let variables = storage.newMap('scenarioactor', true);
+ let variables = storage.newMap('scenarioactor', {store: true});
function ScenarioContext(event) { //{{{
let triggeredEvent = event;
diff --git a/session-manager.js b/session-manager.js
index 0e377ba..10a7706 100644
--- a/session-manager.js
+++ b/session-manager.js
@@ -220,7 +220,7 @@ let INFO =
context.completions = [
[file.leafName.replace(/\.session$/, ''), new Date(file.lastModifiedTime)]
for ([,file] in Iterator(io.File(gSessionManager.getSessionDir()).readDirectory()))
- if (!ignoreAuto || args['-auto'] || !/^(backup(-\d+)?|autosave)\.session$/(file.leafName))
+ if (!ignoreAuto || args['-auto'] || !/^(backup(-\d+)?|autosave)\.session$/.test(file.leafName))
].sort(function ([, a], [, b]) (b - a));
}
},
diff --git a/sl.js b/sl.js
index 4bf0976..fe322a5 100644
--- a/sl.js
+++ b/sl.js
@@ -255,22 +255,6 @@ SL.prototype = { // {{{
let luckyStar = (function(){
-function extend(class, obj){
- var flag;
- for (let i in obj){
- flag = false;
- if (obj.__lookupGetter__(i)){
- class.prototype.__defineGetter__(i, obj.__lookupGetter__(i));
- flag = true;
- }
- if (obj.__lookupSetter__(i)){
- class..prototype.__defineSetter__(i, obj.__lookupSetter__(i));
- flag = true;
- }
- if (!flag) class.prototype[i] = obj[i];
- }
-}
-
let colors = [
["rgba(255,215,0,alpha)", "rgba(255,255,0,alpha)"], //gold, yellow
["rgba(255,20,147,alpha)","rgba(255,0,255, alpha)"], // deeppink, magenta
diff --git a/stella.js b/stella.js
index ad82531..6b476cd 100644
--- a/stella.js
+++ b/stella.js
@@ -39,12 +39,11 @@ let PLUGIN_INFO =
<name lang="ja">すてら</name>
<description>For Niconico/YouTube/Vimeo, Add control commands and information display(on status line).</description>
<description lang="ja">ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。</description>
- <version>0.32.7</version>
+ <version>0.32.8</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
<minVersion>2.0</minVersion>
- <maxVersion>3.0</maxVersion>
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/stella.js</updateURL>
<detail><![CDATA[
== Commands ==
@@ -381,11 +380,11 @@ Thanks:
// 上手い具合に秒数に直すよ
fromTimeCode: function (code, max) {
var m;
- if (max && (m = /^(-?\d+(?:\.\d)?)%/(code)))
+ if (max && (m = /^(-?\d+(?:\.\d)?)%/.exec(code)))
return Math.round(max * (parseFloat(m[1]) / 100));
- if (m = /^(([-+]?)\d+):(\d+)$/(code))
+ if (m = /^(([-+]?)\d+):(\d+)$/.exec(code))
return parseInt(m[1], 10) * 60 + (m[2] == '-' ? -1 : 1) * parseInt(m[3], 10);
- if (m = /^([-+]?\d+\.\d+)$/(code))
+ if (m = /^([-+]?\d+\.\d+)$/.exec(code))
return Math.round(parseFloat(m[1]) * 60);
return parseInt(code, 10);
},
@@ -835,7 +834,7 @@ Thanks:
}
YouTubePlayer.getIDfromURL = function (url) let ([_, r] = url.match(/[?;&]v=([-\w]+)/)) r;
- YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/(url);
+ YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/.test(url);
YouTubePlayer.prototype = {
__proto__: Player.prototype,
@@ -923,11 +922,12 @@ Thanks:
let url = item.querySelector('a').href;
if (!YouTubePlayer.isVideoURL(url))
continue;
+ let id = YouTubePlayer.getIDfromURL(url);
result.push(
new RelatedID(
- YouTubePlayer.getIDfromURL(url),
+ id,
item.querySelector('span.title').textContent,
- item.querySelector('img').src
+ 'http://img.youtube.com/vi/' + id + '/1.jpg'
)
);
}
@@ -999,7 +999,7 @@ Thanks:
}
YouTubeUserChannelPlayer.getIDfromURL = function (url) let ([_, r] = url.match(/\/([^\/]+)($|[\?]+)/)) r;
- YouTubeUserChannelPlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/(url);
+ YouTubeUserChannelPlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/.test(url);
YouTubeUserChannelPlayer.prototype = {
__proto__: YouTubePlayer.prototype,
@@ -1798,7 +1798,7 @@ Thanks:
return U.raiseNotSupportedPage();
let arg = args.literalArg;
- let index = (/^\d+:/)(arg) && parseInt(arg, 10);
+ let index = /^\d+:/.test(arg) && parseInt(arg, 10);
if (index > 0)
arg = lastCompletions[index - 1].command;
let url = self.player.has('makeURL', 'x') ? makeRelationURL(self.player, arg) : arg;
diff --git a/twaudio.js b/twaudio.js
deleted file mode 100644
index 218a365..0000000
--- a/twaudio.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// INFO //
-var INFO =
-<plugin name="twaudio.js" version="0.1"
- summary="twaud.io player controller"
- href="http://github.com/vimpr/vimperator-plugins/blob/master/twaudio.js"
- xmlns="http://vimperator.org/namespaces/liberator">
- <author email="mitsugu.oyama@gmail.com">Mitsugu Oyama</author>
- <license href="http://opensource.org/licenses/mit-license.php">MIT</license>
- <project name="Vimperator" minVersion="2.3"/>
- <p>twaud.io player controller.</p>
- <item>
- <tags>'twaudio'</tags>
- <spec>:twp<oa>lay</oa></spec>
-<!--
- 実装するか未定。jQueryが許さないかも。
- <spec>:twv<oa>olume</oa> <oa>level</oa></spec>
--->
- <description>
- <p>twaud.io player controller.</p>
- </description>
- </item>
-</plugin>;
-
-commands.addUserCommand(
- ['twp[lay]'],
- 'toggle to play button',
- function(){
- let contents=gBrowser.selectedBrowser.contentDocument;
- // twaud.ioのjQueryの使い方によりマウス・イベントをエミュレート
- // するしかないっぽい。
- let evt=contents.createEvent("MouseEvents");
- evt.initMouseEvent(
- 'click',
- true, // canBubble
- true, // cancelable
- window, // view
- 0, // detail
- 0, // screenX
- 0, // screenY
- 0, // clientX
- 0, // clientY
- false, // ctrlKey
- false, // altKey
- false, // shiftKey
- false, // metaKey
- 0, // button
- null //relatedTarget
- );
- let btnPlay=contents.getElementById('play0');
- if(null==btnPlay.getAttribute('style')){ // for twaud.io's bug
- contents.location.reload();
- }else if('display: block;'==btnPlay.getAttribute('style')){
- btnPlay.dispatchEvent(evt);
- }else{
- let btnPause=contents.getElementById('pause0');
- btnPause.dispatchEvent(evt);
- }
- },
- {
- literal: false
- },
- true
-);
-
-/*
-実装するか未定。jQueryが許さないかも。
-commands.addUserCommand(
- ['twv[olume]'],
- 'set volume of twaud.io player.',
- function(args){
- if(1!=args.length){
- liberator.echoerr('argument error');
- return false;
- }
- },
- {
- literal: false
- },
- true
-);
-*/
diff --git a/twittperator.js b/twittperator.js
index e09a273..7b6da40 100644
--- a/twittperator.js
+++ b/twittperator.js
@@ -1237,8 +1237,9 @@ let PLUGIN_INFO =
url + '.json',
query,
function (text) {
+ let json;
try {
- return callback(JSON.parse(text));
+ json = JSON.parse(text);
} catch (e) {
(onError
||
@@ -1248,6 +1249,7 @@ let PLUGIN_INFO =
throw e;
})(e);
}
+ return callback(json);
}
);
};
@@ -1273,7 +1275,7 @@ let PLUGIN_INFO =
}
for (let [n, v] in Iterator(options)) {
- if (/^on[A-Z]/(n) && (v instanceof Function))
+ if (/^on[A-Z]/.test(n) && (v instanceof Function))
this.events[n.toLowerCase()] = v;
}
@@ -1409,7 +1411,7 @@ let PLUGIN_INFO =
lines[0] = buf + lines[0];
for (let [, line] in Iterator(lines.slice(0, -1))) {
try {
- if (/^\s*\{/(line))
+ if (/^\s*\{/.test(line))
onMsg(Utils.fixStatusObject(JSON.parse(line)), line);
} catch (e) { liberator.log(e); }
}
@@ -1560,7 +1562,7 @@ let PLUGIN_INFO =
}
for (let [n, v] in Iterator(st)) {
- if (/(^|_)id$/(n))
+ if (/(^|_)id$/.test(n))
fixId(result, n);
}
@@ -1636,7 +1638,7 @@ let PLUGIN_INFO =
function loadPluginFromDir(checkGV) {
return function(dir) {
dir.readDirectory().forEach(function(file) {
- if (/\.tw$/(file.path) && (!checkGV || isEnabled(file)))
+ if (/\.tw$/.test(file.path) && (!checkGV || isEnabled(file)))
Twittperator.sourceScriptFile(file);
});
}
@@ -1853,10 +1855,9 @@ let PLUGIN_INFO =
}
}, // }}}
withProtectedUserConfirmation: function(check, actionName, action) { // {{{
- let protectedUserName = Twittperator.isProtected(check);
- if (protectedUserName) {
+ if (Twittperator.isProtected(check)) {
Twittperator.confirm(
- protectedUserName + " is protected user! Do you really want to " + actionName + '?',
+ check.screenName + " is protected user! Do you really want to " + actionName + '?',
action
);
} else {
@@ -2004,7 +2005,7 @@ let PLUGIN_INFO =
"^" +
this.command.map(function(c)
let (r = util.escapeRegex(c))
- (/^\W$/(c) ? r : r + "( |$)")
+ (/^\W$/.test(c) ? r : r + "( |$)")
).join("|")
);
},
@@ -2069,7 +2070,7 @@ let PLUGIN_INFO =
description: "Open link",
action: function(arg) Twittperator.openLink(arg),
timelineCompleter: true,
- completer: Completers.text(function(s) /https?:\/\//(s.text))
+ completer: Completers.text(function(s) /https?:\/\//.test(s.text))
}),
SubCommand({
command: ["delete"],
diff --git a/twittperator/pong.tw b/twittperator/pong.tw
index dae2e15..9f3f381 100644
--- a/twittperator/pong.tw
+++ b/twittperator/pong.tw
@@ -12,7 +12,7 @@
plugins.twittperator.ChirpUserStream.addListener(
function onMsg (msg, raw) {
function negi (pattern, reply) {
- if (RegExp('^\\s*@' + screenName + '\\s+' + pattern + '\s*$')(msg.text.trim())) {
+ if (RegExp('^\\s*@' + screenName + '\\s+' + pattern + '\s*$').test(msg.text.trim())) {
plugins.twittperator.Twitter.say('@' + msg.user.screen_name + ' ' + reply, msg.id_str);
return true;
}
diff --git a/twittperator/twlist-win.tw b/twittperator/twlist-win.tw
index 674f4f3..939e472 100644
--- a/twittperator/twlist-win.tw
+++ b/twittperator/twlist-win.tw
@@ -193,10 +193,10 @@ let winXML = <>
function getCurrentListBox(){
return tabBox.tabpanels.selectedPanel.firstChild;
}
- function getParent(node, class){
+ function getParent(node, klass){
let elm = node;
while (elm != document.documentElement){
- if (elm instanceof class)
+ if (elm instanceof klass)
return elm;
elm = elm.parentNode;
}
diff --git a/usi.js b/usi.js
index 05567bf..fe8db8f 100644
--- a/usi.js
+++ b/usi.js
@@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
// INFO {{{
let INFO =
<>
- <plugin name="usi.js" version="1.3.0"
+ <plugin name="usi.js" version="1.3.1"
href="http://vimpr.github.com/"
summary="for Remember The Milk."
lang="en-US"
@@ -700,7 +700,7 @@ let INFO =
// FIXME http が補完できない
let left = args.string.slice(0, context.caret);
- let m = /(?:^|\s)([#!@=*^]|http)([^#!@=*^]*)$/(left);
+ let m = /(?:^|\s)([#!@=*^]|http)([^#!@=*^]*)$/.exec(left);
if (m) {
let completer = SmartAddCompleter[m[1]];
if (completer) {
@@ -817,7 +817,7 @@ let INFO =
cache: 'rtm.tasks.getList?filter=status:incomplete',
onComplete: function (result) {
let cs = [];
- let lists = args['-list'];
+ let lists = args['-lists'];
for (let [, list] in Iterator(result.tasks.list)) {
if (lists && lists.every(function (name) table[list.@id] != name))
diff --git a/walk-input.js b/walk-input.js
index f788746..77d4caa 100644
--- a/walk-input.js
+++ b/walk-input.js
@@ -65,7 +65,7 @@ let INFO =
var types = [
"text",
- "passsword",
+ "password",
"search",
"file",
"datetime",
diff --git a/zip-de-download.js b/zip-de-download.js
index a224011..4d60266 100644
--- a/zip-de-download.js
+++ b/zip-de-download.js
@@ -1,5 +1,5 @@
let INFO =
-<plugin name="zip-de-download" version="0.7.0"
+<plugin name="zip-de-download" version="0.7.1"
href=""
summary="ZIPでダウンロードするお"
xmlns="http://vimperator.org/namespaces/liberator">
@@ -176,7 +176,7 @@ let SITE_INFO = [
// 連番かもしれない id は無視する
let id = elem.getAttribute('id');
- if (id && !/\d/(id))
+ if (id && !/\d/.test(id))
return 'id("' + id + '")';
return getXPath(elem.parentNode) + '/' + elem.tagName.toLowerCase();
@@ -186,7 +186,7 @@ let SITE_INFO = [
let links =
Array.slice( content.document.querySelectorAll('a')).filter(
- function (link) (link.href && extPattern(link.href)));
+ function (link) (link.href && extPattern.test(link.href)));
let xs = {};
for each(let link in links){
@@ -205,12 +205,12 @@ let SITE_INFO = [
return result;
}
function extensionValidator(vs)
- vs && vs.every(function (v) /^[\da-zA-Z]+$/(v));
+ vs && vs.every(function (v) /^[\da-zA-Z]+$/.test(v));
let self = {
downloadZip: function(path, urls, comment, isAppend){
let zipW = new zipWriter();
- let urls = [url for each(url in urls)];
+ urls = [url for each(url in urls)];
liberator.assert(urls.length > 0, "None of URLs");
if (!(/\.zip$/i).test(path)){
@@ -232,7 +232,7 @@ let SITE_INFO = [
try {
let stream = ch.open();
let entryName = ("000" + ++i).slice(-3) + "-" + getEntryName(ch.URI, ch.contentType);
- liberator.echomsg("zip: " + url + " to " + entryName, 3);
+ liberator.echomsg("zip: " + url + " to " + entryName, commandline.FORCE_SINGLELINE);
zipW.addEntryStream(entryName, Date.now() * 1000, Ci.nsIZipWriter.COMPRESSION_DEFAULT, stream, false);
} catch (e) {
// XXX エラー分を通知すべき?
diff --git a/跳.js b/跳.js
index 0067e54..ef89be4 100644
--- a/跳.js
+++ b/跳.js
@@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
// INFO {{{
let INFO =
<>
- <plugin name="跳.jp" version="1.0.1"
+ <plugin name="跳.jp" version="1.0.2"
href="http://vimpr.github.com/"
summary="跳ねます"
lang="ja"
@@ -84,7 +84,7 @@ let INFO =
}
);
req.post();
- return toResult(req.transport.responseText);
+ return !callback && toResult(req.transport.responseText);
}
let innantoka = atob('aW5zdWxpbixpbmJhZ3MsaW5wYXJhenpvLGlucHVtb25pbixpbnRlbCxpbmNhdGVpa29rdSxpbmZyYXN0cnVjdHVyZSxpbmZsdWVuemEsaW5kb2NoaW5lLGltcHJlc3MsaW5kcmEsaW52ZXJ0ZXIsaW5kaWFuYXBvbGlzLGltcGhhbCxpbnRlcnByZXRlcixpbmRvc2hpbmFoYW5udG91LHlpbmxpbmdvZmpveXRveSxpbXBlZGFuY2UsaW5nZW5tYW1lLGludGVycGhvbmUsaW5kb2xlLGludGVybixpbXBhbGE=').split(',')