aboutsummaryrefslogtreecommitdiffstats
path: root/video-controller.js
diff options
context:
space:
mode:
authoranekos2010-03-27 14:25:29 +0000
committeranekos2010-03-27 14:25:29 +0000
commitad7c94d476ec71fa2317f748ce9d666a4891d216 (patch)
treefd9389db1e6890a7e58ca0a8f2ac1e7d21a9e07c /video-controller.js
parentd21b9bcbe692ee47e7e6b630473d81ef410b5d3e (diff)
downloadvimperator-plugins-ad7c94d476ec71fa2317f748ce9d666a4891d216.tar.bz2
コマンド追加(seek)
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37100 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'video-controller.js')
-rwxr-xr-xvideo-controller.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/video-controller.js b/video-controller.js
index 631d84f..4092a3f 100755
--- a/video-controller.js
+++ b/video-controller.js
@@ -39,7 +39,7 @@ let PLUGIN_INFO =
<name lang="ja">VideoController</name>
<description>Add :videocontrol command for HTML5 video.</description>
<description lang="ja">HTML5 Video のために :videocontrol コマンドを追加する。</description>
- <version>1.0.0</version>
+ <version>1.1.0</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>
@@ -99,6 +99,11 @@ let INFO =
const HintName = 'anekos-video-controller-hint';
+ function timeCodeToSec (t) {
+ let [a, h, m, s] = (t.match(/(?:(\d+):)?(\d+):(\d+)/) || []).map(function (v) parseInt(v, 10) || 0);
+ return a ? (h * 60 * 60 + m * 60 + s) : parseInt(t, 10);
+ }
+
let lastArgs = null;
let controlls = {
__proto__: null,
@@ -111,6 +116,9 @@ let INFO =
volume: function (elem, value) {
value = parseFloat(value);
elem.volume = Math.min(value > 1 ? value / 100 : value, 100);
+ },
+ seek: function (elem, value) {
+ elem.currentTime = timeCodeToSec(value);
}
};