From 28d5572adfe5e75c7d42a457f4fd6cd48a77607c Mon Sep 17 00:00:00 2001 From: anekos Date: Sat, 7 Feb 2009 03:32:36 +0000 Subject: 時間のところでホイールでシークできるようにした。 R のクリックが聴いていなかったのを修正 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@29668 d0d07461-0603-4401-acd4-de1884942a52 --- stella.js | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'stella.js') diff --git a/stella.js b/stella.js index 442727a..c72aaac 100644 --- a/stella.js +++ b/stella.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = すてら Show video informations on the status line. ステータスラインに動画の再生時間などを表示する。 - 0.19.4 + 0.20.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -656,7 +656,7 @@ Thanks: playEx: 'x', playOrPause: 'x', relatedIDs: 'r', - repeating: 'rw', + repeating: '', title: 'r', totalTime: 'r', volume: 'rw' @@ -1510,7 +1510,11 @@ Thanks: update: function () { if (!(this.isValid && this.player.ready)) return; - this.labels.main.text = this.player.statusText; + this.labels.main.text = + let (v = this.player.statusText) + (this.__currentTimeTo == undefined) ? v + : v.replace(/^\d*\:\d*/, + U.toTimeCode(this.__currentTimeTo)); this.labels.volume.text = this.player.volume; for (let name in this.toggles) { this.toggles[name].text = (this.player[name] ? String.toUpperCase : U.id)(name[0]); @@ -1575,12 +1579,35 @@ Thanks: this.player.currentTime = parseInt(this.player.totalTime * per); }, - onMouseScroll: function (event) { - if (this.isValid && this.player.ready && event.detail) { - this.player.volume += (event.detail > 0) ? -5 : 5; - this.update(); + onMouseScroll: (function () { + let timerHandle; + return function (event) { + if (!(this.isValid && this.player.ready && event.detail)) + return; + if (event.target == this.labels.main) { + if (this.__currentTimeTo == undefined) + this.__currentTimeTo = this.player.currentTime; + this.__currentTimeTo += (event.detail > 0) ? -5 : 5; + this.__currentTimeTo = Math.min(Math.max(this.__currentTimeTo, 0), this.player.totalTime); + clearTimeout(timerHandle); + timerHandle = setTimeout( + U.bindr(this, function () { + this.player.currentTime = this.__currentTimeTo; + liberator.log({ + pl: this.player.currentTime, + to: this.__currentTimeTo + }) + delete this.__currentTimeTo; + }), + 1000 + ); + this.update(); + } else { + this.player.volume += (event.detail > 0) ? -5 : 5; + this.update(); + } } - }, + })(), onMutedClick: function (event) this.player.toggle('muted'), @@ -1605,7 +1632,7 @@ Thanks: this.storage.alreadyAutoFullscreen = true; }, - onRepeatClick: function () this.player.toggle('repeating'), + onRepeatingClick: function () this.player.toggle('repeating'), onRelationsRootPopupshowing: function () { let self = this; -- cgit v1.2.3