aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alert.js13
-rw-r--r--umihara.js2
-rw-r--r--youtubeamp.js83
-rw-r--r--zip-de-download.js13
4 files changed, 59 insertions, 52 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/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/youtubeamp.js b/youtubeamp.js
index 5043f5e..2f89c16 100644
--- a/youtubeamp.js
+++ b/youtubeamp.js
@@ -64,8 +64,8 @@ YouTubePlayerController.prototype = {
CARDINAL_NUMBER: 10,
YOUTUBE_DOMAIN: '.youtube.jp',
- YOUTUBE_URL: '^http://[^.]+\\.youtube\\.com/',
- WATCH_URL: 'http://[^.]+\\.youtube\\.com/watch',
+ YOUTUBE_URL: '^https?://[^.]+\\.youtube\\.com/',
+ WATCH_URL: 'https?://[^.]+\\.youtube\\.com/watch',
WATCH_PAGE: 1,
PLAYER_NODE_ID: 'movie_player',
@@ -94,6 +94,23 @@ YouTubePlayerController.prototype = {
'chrome-promo',
'watch-video-quality-setting',
],
+
+ PLAYER_WRAPPER_NODE_ID: 'player-api',
+ TOGGLE_PLAYER_WRAPPER_STYLE: {
+ position: 'fixed',
+ visibility: 'visible',
+ top: '0px',
+ left: '0px',
+ margin: '0px',
+ padding: '0px',
+ width: '100%',
+ height: '100%',
+ zIndex: '99999999999',
+ borderWidth: '0px',
+ backgroundImage: 'none',
+ backgroundColor: '#000',
+ overflow: 'hidden',
+ },
},
getControllerVersion: function() { return this.constants.VERSION; },
@@ -128,10 +145,11 @@ YouTubePlayerController.prototype = {
},
toggleSize: function() {
- var p = this._player();
- (p.width == this.constants.SIZE_WIDTH_DEFAULT && p.height == this.constants.SIZE_HEIGHT_DEFAULT)
- ? this._fullSize()
- : this._normalSize();
+ var playerWrapper = this._getElementById(this.constants.PLAYER_WRAPPER_NODE_ID);
+
+ (playerWrapper.style.position == 'fixed')
+ ? this._normalSize()
+ : this._fullSize();
},
_changeToFull: function() {
@@ -152,48 +170,25 @@ YouTubePlayerController.prototype = {
},
_fullSize: function() {
- var b = this._getElementById('baseDiv');
- this.defMargin = b.style.margin;
- this.defPadding = b.style.padding;
- this.defWidth = b.style.width;
- b.style.margin = 0;
- b.style.padding = 0;
- b.style.width = '100%';
-
- for(let i=0, max=this.constants.HIDE_NODES.length ; i<max ; ++i) {
- let h = this._getElementById(this.constants.HIDE_NODES[i]);
- if(h) { h.style.display = 'none'; }
- }
-
- this._changeToFull();
-
- window.addEventListener(
- 'resize',
- this.fuller,
- false
- );
+ var playerWrapper = this._getElementById(this.constants.PLAYER_WRAPPER_NODE_ID);
+ this._setStyle(playerWrapper, this.constants.TOGGLE_PLAYER_WRAPPER_STYLE);
},
_normalSize: function() {
- var b = this._getElementById('baseDiv');
- b.style.margin = this.defMargin;
- b.style.padding = this.defPadding;
- b.style.width = this.defWidth;
-
- for(let i=0, max=this.constants.HIDE_NODES.length ; i<max ; ++i) {
- let h = this._getElementById(this.constants.HIDE_NODES[i]);
- if(h) { h.style.display = 'block'; }
- }
+ var playerWrapper = this._getElementById(this.constants.PLAYER_WRAPPER_NODE_ID);
+ this._clearStyle(playerWrapper, this.constants.TOGGLE_PLAYER_WRAPPER_STYLE);
+ },
- var p = this._player();
- p.width = this.constants.SIZE_WIDTH_DEFAULT;
- p.height = this.constants.SIZE_HEIGHT_DEFAULT;
-
- window.removeEventListener(
- 'resize',
- this.fuller,
- false
- );
+ _setStyle: function(ele, style) {
+ Object.keys(style).forEach(function (key) {
+ ele.style[key] = style[key];
+ });
+ },
+
+ _clearStyle: function(ele, style) {
+ Object.keys(style).forEach(function (key) {
+ ele.style[key] = '';
+ });
},
seekTo: function(position) {
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");