From 31e1826c3203e57b19d7838603ea374e70b51b2c Mon Sep 17 00:00:00 2001 From: anekos Date: Fri, 22 Jan 2010 08:07:36 +0000 Subject: ニコニコ動画でフルスクリーンから復帰したときに、スクロール位置も復帰するようにした git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36511 d0d07461-0603-4401-acd4-de1884942a52 --- stella.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'stella.js') diff --git a/stella.js b/stella.js index c326ff7..c08eb29 100644 --- a/stella.js +++ b/stella.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = すてら For Niconico/YouTube, Add control commands and information display(on status line). ニコニコ動画/YouTube 用。操作コマンドと情報表示(ステータスライン上に)追加します。 - 0.20.11 + 0.21.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -958,7 +958,13 @@ Thanks: get large () this.player.ext_getVideoSize() === NicoPlayer.SIZE_LARGE, set large (value) { + if (value && !this.large) { + let win = Buffer.findScrollableWindow(); + this.storage.scrollPositionBeforeLarge = {x: win.scrollX, y: win.scrollY}; + } this.player.ext_setVideoSize(value ? NicoPlayer.SIZE_LARGE : NicoPlayer.SIZE_NORMAL); + let (pos = this.storage.scrollPositionBeforeLarge) + (value || typeof pos == "undefined" || buffer.scrollTo(pos.x, pos.y)); return this.large; }, @@ -1474,9 +1480,11 @@ Thanks: onIconDblClick: function () this.player.toggle('fullscreen'), onLargeClick: function () { + // XXX fullscreen と large の実装が同じ場合に問題になるので、toggle は使わない + let old = this.player.large; if (this.player.fullscreen) this.player.fullscreen = false; - this.player.toggle('large'); + this.player.large = !old; }, onLocationChange: function () { -- cgit v1.2.3