aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alert.js13
-rw-r--r--maine_coon.js257
-rw-r--r--readitlater.js12
-rw-r--r--umihara.js2
-rw-r--r--walk-input.js2
-rw-r--r--youtubeamp.js17
-rw-r--r--zip-de-download.js13
7 files changed, 105 insertions, 211 deletions
diff --git a/alert.js b/alert.js
index 957da6a..b2e2085 100644
--- a/alert.js
+++ b/alert.js
@@ -349,6 +349,15 @@ let PLUGIN_INFO = xml`
};
}
+ function torelativetime(h, m) {
+ if (m > 59)
+ return false;
+ h %= 24;
+ var now = new Date();
+ var d = (h * 60 + parseInt(m)) - (now.getHours() * 60 + now.getMinutes() + now.getSeconds() / 60);
+ return d >= 0 ? d : d + 60 * 24;
+ }
+
let alertMethods = {
alert: function (next, msg) {
window.alert(msg);
@@ -436,11 +445,13 @@ let PLUGIN_INFO = xml`
function (args) {
let methods = [], time = null, message = '';
args.forEach(function (v) {
- let m, f;
+ let m, f, t;
if ((m = v.match(/^-(\w+)(?:=(.*))?$/)) && (f = alertMethods[m[1]]))
methods.push([f, m[2]]);
else if (!time && v.match(/^\d+(\.\d+)?$/))
time = parseFloat(v);
+ else if (!time && (m = v.match(/^(\d{1,2}):(\d{1,2})$/)) && (t = torelativetime(m[1], m[2])))
+ time = parseFloat(t);
else
message += ' ' + v;
});
diff --git a/maine_coon.js b/maine_coon.js
index af4ff57..b71b059 100644
--- a/maine_coon.js
+++ b/maine_coon.js
@@ -32,114 +32,65 @@ THE POSSIBILITY OF SUCH DAMAGE.
*/
-let PLUGIN_INFO = xml`
-<VimperatorPlugin>
- <name>Maine Coon</name>
- <name lang="ja">メインクーン</name>
- <description>Make the screen larger</description>
- <description lang="ja">なるべくでかい画面で使えるように</description>
- <version>2.6.5</version>
- <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
- <minVersion>3.0</minVersion>
- <updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/maine_coon.js</updateURL>
- <license>new BSD License (Please read the source code comments of this plugin)</license>
- <license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
- <detail><![CDATA[
- == Requires ==
- _libly.js
- == Options ==
- mainecoon:
- Possible values
- c:
- Hide caption-bar
- a:
- Hide automatically command-line
- f:
- Fullscreeen
- C:
- Hide caption-bar
- If window is maximized, then window maximize after window is hid.
- m:
- Displays the message to command-line.
- (e.g. "Yanked http://..." "-- CARET --")
- u:
- Displays the message of current page URL when page is loaded.
- >||
- :set mainecoon=ac
- ||<
- The default value of this option is "amu".
- === note ===
- The C and c options probably are supported on some OSs only.
- == Global Variables ==
- maine_coon_targets:
- Other elements IDs that you want to hide.
- let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter"
- maine_coon_default:
- The default value of 'mainecoon' option.
- >||
- let g:maine_coon_default = "ac"
- ||<
- maine_coon_style:
- The Style for message output.
- >||
- let g:maine_coon_style = "border: 1px solid pink; padding: 3px; color: pink; background: black; font: 18px/1 sans-serif;"
- ||<
- == Thanks ==
- snaka72 (hidechrome part):
- http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955
- == Maine Coon ==
- http://en.wikipedia.org/wiki/Maine_Coon
- ]]></detail>
- <detail lang="ja"><![CDATA[
- == Requires ==
- _libly.js
- == Options ==
- mainecoon:
- 以下の文字の組み合わせを指定します。
- c:
- キャプションバーを隠す
- a:
- 自動でコマンドラインを隠す
- f:
- フルスクリーン
- C:
- キャプションバーを隠す
- ウィンドウが最大化されているときは、隠したあとに最大化し直します
- m:
- コマンドラインへのメッセージを表示します。
- ("Yanked http://..." "-- CARET --" など)
- u:
- ページが読み込まれたときにURLをポップアップ表示する。
- "c" と "f" の併用は意味がありません。
- >||
- :set mainecoon=ac
- ||<
- デフォルト値は "amu"
- === 備考 ===
- C c オプションはいくつかの OS でのみ有効です。多分。
- == Global Variables ==
- maine_coon_targets:
- フルスクリーン時にの非表示にしたい要素のIDを空白区切りで指定します。
- >||
+var INFO = xml `
+<plugin name="Maine Conn" version="2.6.6"
+ href="https://github.com/vimpr/vimperator-plugins/raw/master/maine_coon.js"
+ summary = "hide the bottom statusbar"
+ xmlns="http://vimperator.org/namespaces/liberator">
+ <author href="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
+ <license>BSD</license>
+ <project name="Vimperator" minVersion="3.6.1"/>
+ <p>
+ <code><![CDATA[
+ == Requires ==
+ _libly.js
+ == Options ==
+ mainecoon:
+ Possible values
+ c:
+ Hide caption-bar
+ a:
+ Hide automatically command-line
+ f:
+ Fullscreeen
+ C:
+ Hide caption-bar
+ If window is maximized, then window maximize after window is hid.
+ m:
+ Displays the message to command-line.
+ (e.g. "Yanked http://..." "-- CARET --")
+ u:
+ Displays the message of current page URL when page is loaded.
+ >||
+ :set mainecoon=ac
+ ||<
+ The default value of this option is "amu".
+ === note ===
+ The C and c options probably are supported on some OSs only.
+ == Global Variables ==
+ maine_coon_targets:
+ Other elements IDs that you want to hide.
let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter"
- ||<
- maine_coon_default:
- オプションのデフォルト値を設定します。
- >||
- let g:maine_coon_default = "ac"
- ||<
- maine_coon_style:
- メッセージ表示のスタイル指定です。
- >||
- let g:maine_coon_style = "border: 1px solid pink; padding: 3px; color: pink; background: black; font: 18px/1 sans-serif;"
- ||<
- == Thanks ==
- snaka72 (hidechrome part):
- http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955
- == メインクーン ==
- http://ja.wikipedia.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%AF%E3%83%BC%E3%83%B3
- ]]></detail>
-</VimperatorPlugin>`;
+ maine_coon_default:
+ The default value of 'mainecoon' option.
+ >||
+ let g:maine_coon_default = "ac"
+ ||<
+ maine_coon_style:
+ The Style for message output.
+ >||
+ let g:maine_coon_style = "border: 1px solid pink; padding: 3px; color: pink; background: black; font: 18px/1 sans-serif;"
+ ||<
+ == Thanks ==
+ * snaka72 (hidechrome part):
+ http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955
+ * seenxu
+ make maine_coon.js works with vimperator 3.6.1)
+ == Maine Coon ==
+ http://en.wikipedia.org/wiki/Maine_Coon
+ ]]></code>
+ </p>
+</plugin>`;
(function () {
@@ -168,7 +119,6 @@ let PLUGIN_INFO = xml`
})
);
-
function s2b (s, d) !!((!/^(\d+|false)$/i.test(s)|parseInt(s)|!!d*2)&1<<!s);
function hideTargets (hide) {
@@ -246,58 +196,6 @@ let PLUGIN_INFO = xml`
function important (style)
style.replace(/(!important)?\s*;/g, ' !important;');
- let echo = (function () {
- let time = 40;
- let remove;
-
- return function (message) {
- if (remove)
- remove();
- let doc = window.content.document;
-
- // XXX 中身なしっぽいときは、あきらめる。代替手段が欲しい
- if (!doc.body)
- return;
-
- let style =
- 'opacity: 1; ' +
- important(
- highlight.get('StatusLine').value +
- U.toStyleText({
- position: 'fixed',
- zIndex: 1000,
- left: 0,
- bottom: 0,
- MozBoxSizing: 'content-box',
- }) +
- elemStyle
- );
- let elem = U.xmlToDom(xml`<div id="liberator_maine_coon" style=${style}>${message}</div>`, doc);
- doc.body.appendChild(elem);
- let count = time;
- let handle = setInterval(function () {
- try {
- if (count <= 0) {
- if (remove)
- remove();
- } else {
- elem.style.MozOpacity = count / time;
- }
- count--;
- } catch (e) { // XXX ほんとは DOM 関連だけキャッチしたい
- remove(true);
- liberator.log(e);
- }
- }, 100);
- remove = function (noDOM) {
- if (!noDOM)
- doc.body.removeChild(elem);
- clearInterval(handle);
- remove = null;
- };
- };
- })();
-
let setAutoHideCommandLine = (function () {
let hiddenNodes = [];
@@ -325,7 +223,8 @@ let PLUGIN_INFO = xml`
}
} else {
bottomBar.collapsed = false;
- hiddenNodes.forEach(function ([c, v, d]) [c.collapsed, c.style.display] = [v, d]);
+ hiddenNodes.forEach(
+ function ([c, v, d]) [c.collapsed, c.style.display] = [v, d]);
}
}
})();
@@ -343,7 +242,6 @@ let PLUGIN_INFO = xml`
function focusToCommandline ()
commandlineBox.inputField.focus();
-
let useEcho = false;
let autoHideCommandLine = false;
let displayURL = true;
@@ -366,27 +264,6 @@ let PLUGIN_INFO = xml`
);
}
-
- {
- let last;
- messageBox.watch('value', function (name, oldValue, newValue) {
- try {
- if (autoHideCommandLine
- && useEcho
- && /\S/.test(newValue)
- && messageBox.collapsed
- && last != newValue
- && newValue != 'Press ENTER or type command to continue') {
- echo(newValue);
- }
- } catch (e) {
- liberator.reportError(e);
- }
- last = newValue;
- return newValue;
- });
- }
-
U.around(commandline, 'input', function (next, args) {
let result = next();
inputting = true;
@@ -410,7 +287,8 @@ let PLUGIN_INFO = xml`
U.around(commandline._callbacks.submit, modes.EX, function (next, args) {
let r = next();
- if (autoHideCommandLine && !inputting && !(modes.extended & modes.OUTPUT_MULTILINE))
+ if (autoHideCommandLine && !inputting && !(
+ modes.extended & modes.OUTPUT_MULTILINE))
commandline.close();
return r;
}, true);
@@ -427,17 +305,6 @@ let PLUGIN_INFO = xml`
U.around(commandline._callbacks.cancel, modes.PROMPT, callback, true);
}
- events.addSessionListener(
- document.getElementById("appcontent"),
- "DOMContentLoaded",
- function (event) {
- let doc = event.originalTarget;
- if (doc instanceof HTMLDocument && !doc.defaultView.frameElement && displayURL)
- echo(doc.location.href);
- },
- true
- );
-
options.add(
['mainecoon'],
'Make big screen like a Maine Coon',
diff --git a/readitlater.js b/readitlater.js
index c51d3a2..5ca7a2e 100644
--- a/readitlater.js
+++ b/readitlater.js
@@ -277,11 +277,16 @@ let PLUGIN_INFO = xml`
}, // }}}
+ getLogins : function() {
+ let manager = Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager);
+ return manager.findLogins({},"https://getpocket.com","",null).concat(
+ manager.findLogins({}, "http://getpocket.com","",null))
+ },
+
get : function(state, callback){ // {{{
// document => http://readitlaterlist.com/api/docs#get
- let manager = Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager);
- let logins = manager.findLogins({},"http://getpocket.com","",null);
+ let logins = this.getLogins();
let req = new libly.Request(
"https://readitlaterlist.com/v2/get" , // url
@@ -316,8 +321,7 @@ let PLUGIN_INFO = xml`
add : function(url,title,callback){ // {{{
- let manager = Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager);
- let logins = manager.findLogins({},"http://readitlaterlist.com","",null);
+ let logins = this.getLogins();
let req = new libly.Request(
"https://readitlaterlist.com/v2/add" , // url
null, // headers
diff --git a/umihara.js b/umihara.js
index c6657ed..be6d557 100644
--- a/umihara.js
+++ b/umihara.js
@@ -149,7 +149,7 @@ let PLUGIN_INFO = xml`
if (to == '-')
to = defaultTarget;
//let url = 'http://quote.yahoo.co.jp/m5?a=' + value + '&s=' + from + '&t=' + to;
- let url = 'http://info.finance.yahoo.co.jp/exchange/convert/?a=' + value + '&s=' + from + '&t=' + to;
+ let url = 'http://info.finance.yahoo.co.jp/fx/convert/?a=' + value + '&s=' + from + '&t=' + to;
var req = new XMLHttpRequest();
req.open('GET', url);
req.onreadystatechange = function (aEvt) {
diff --git a/walk-input.js b/walk-input.js
index f310875..ef3db1c 100644
--- a/walk-input.js
+++ b/walk-input.js
@@ -81,7 +81,7 @@ var types = [
"tel",
"color",
].map(function(type) "@type=" + type.quote()).join(" or ");
-var xpath = '//input[(' + types + ' or not(@type)) and not(@disabled)] | //textarea';
+var xpath = '//input[(' + types + ' or not(@type)) and not(@disabled)] | //textarea | //*[@contenteditable="true"]';
function isVisible (elem) {
while (elem && !(elem instanceof HTMLDocument)) {
diff --git a/youtubeamp.js b/youtubeamp.js
index f2c6125..2f89c16 100644
--- a/youtubeamp.js
+++ b/youtubeamp.js
@@ -192,8 +192,14 @@ YouTubePlayerController.prototype = {
},
seekTo: function(position) {
+ var p = this._player();
+
if(position) {
- if(position.match(/^(\d+):(\d+)$/)) {
+ if(position.match(/^(\d+)%$/)) {
+ var duration = p.getDuration();
+ position = parseInt((duration * RegExp.$1 / 100), this.constants.CARDINAL_NUMBER);
+ }
+ else if(position.match(/^(\d+):(\d+)$/)) {
position = parseInt(RegExp.$1, this.constants.CARDINAL_NUMBER) * 60
+ parseInt(RegExp.$2, this.constants.CARDINAL_NUMBER);
}
@@ -201,17 +207,22 @@ YouTubePlayerController.prototype = {
}
else position = this.constants.SEEKTO_DEFAULT;
- var p = this._player();
p.seekTo(position);
},
seekBy: function(delta) {
+ var p = this._player();
+
if(delta) {
+ if(delta.match(/^([-+]?)(\d+)%$/)) {
+ var duration = p.getDuration();
+ delta = parseInt((duration * RegExp.$2 / 100), this.constants.CARDINAL_NUMBER);
+ if(RegExp.$1 == '-') delta = -delta;
+ }
if(isNaN(delta)) throw new Error('assign signed number : seekBy()');
}
else delta = this.constants.SEEKBY_DEFAULT;
- var p = this._player();
var position = p.getCurrentTime();
position += parseInt(delta, this.constants.CARDINAL_NUMBER);
diff --git a/zip-de-download.js b/zip-de-download.js
index f7a25b4..ea15952 100644
--- a/zip-de-download.js
+++ b/zip-de-download.js
@@ -152,7 +152,7 @@ let SITE_INFO = [
try {
mime = mimeService.getTypeFromURI(uri);
} catch(e) {
- liberator.reportError(e);
+ liberator.log('zip-de-download: error: ' + e);
};
let ext = mimeService.getPrimaryExtension(mime ? mime : mimeType, null)
let name = uri.path.split("/").pop();
@@ -320,15 +320,16 @@ let SITE_INFO = [
}
if ("-list" in arg){
let [file, urls, comment] = self.download(arg[0], true, option);
- let xml = `
- <h1><span>Download :</span><span>{file.path}</span></h1>
- <p>{comment}</p>
+ let listUrlsXml = liberator.modules.template.map(urls, function(url) xml`<li>${url}</li>`);
+ let listXml = xml`
+ <h1><span>Download :</span><span>${file.path}</span></h1>
+ <p>${comment}</p>
<ol>
- {liberator.modules.template.map(urls, function(url) <li>{url}</li>)}
+ ${listUrlsXml}
</ol>
<br/>
`;
- liberator.echo(xml, true);
+ liberator.echo(listXml, true);
return;
}
liberator.echo("Started DownloadZip");