From b4ead8c29b38ba28392e2ad17849c842d35f23d8 Mon Sep 17 00:00:00 2001 From: anekos Date: Sun, 14 Feb 2010 14:38:04 +0000 Subject: pageinfo を追加するようにした (S) :pageinfo S で直接表示するか set pageinfo=S で設定しておけばOK git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36751 d0d07461-0603-4401-acd4-de1884942a52 --- stella.js | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/stella.js b/stella.js index 7a69dc4..a540897 100644 --- a/stella.js +++ b/stella.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = すてら For Niconico/YouTube/Vimeo, Add control commands and information display(on status line). ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。 - 0.23.0 + 0.24.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -449,6 +449,7 @@ Thanks: large: '', makeURL: '', muted: '', + pageinfo: '', pause: '', play: '', playEx: '', @@ -467,6 +468,8 @@ Thanks: icon: null, + xpath: {}, + initialize: function () void null, finalize: function () { @@ -683,6 +686,7 @@ Thanks: fullscreen: 'rwt', makeURL: 'x', muted: 'rwt', + pageinfo: 'r', pause: 'x', play: 'x', playEx: 'x', @@ -698,6 +702,10 @@ Thanks: icon: 'http://www.youtube.com/favicon.ico', + xpath: { + comment: '//span[@class="description"]' + }, + get currentTime () parseInt(this.player.getCurrentTime()), set currentTime (value) (this.player.seekTo(U.fromTimeCode(value)), this.currentTime), @@ -750,6 +758,10 @@ Thanks: get muted () this.player.isMuted(), set muted (value) ((value ? this.player.mute() : this.player.unMute()), value), + get pageinfo () [ + ['comment', U.xpathGet(this.xpath.comment).innerHTML] + ], + get player () U.getElementByIdEx('movie_player'), @@ -858,6 +870,7 @@ Thanks: large: 'rwt', makeURL: 'x', muted: 'rwt', + pageinfo: 'r', pause: 'x', play: 'x', playEx: 'x', @@ -876,6 +889,10 @@ Thanks: icon: 'http://www.nicovideo.jp/favicon.ico', + xpath: { + comment: 'id("des_2")/table[2]/tbody/tr/td[2]' + }, + initialize: function () { this.__info_cache = {}; }, @@ -914,6 +931,10 @@ Thanks: get muted () this.player.ext_isMute(), set muted (value) (this.player.ext_setMute(value), value), + get pageinfo () [ + ['comment', U.xpathGet(this.xpath.comment).innerHTML] + ], + get player () U.getElementByIdEx('flvplayer'), get playerContainer () U.getElementByIdEx('flvplayer_container'), @@ -957,7 +978,7 @@ Thanks: // コメント欄のリンクの前のテキストをタイトルと見なす // textContent を使うと改行が理解できなくなるので、innerHTML で頑張ったけれど頑張りたくない try { - let xpath = 'id("des_2")/table[2]/tbody/tr/td[2]'; + let xpath = this.xpath.comment; let comment = U.xpathGet(xpath).innerHTML; let links = U.xpathGets(xpath + '/p/a') .filter(function (it) /watch\//.test(it.href)) @@ -1507,6 +1528,18 @@ Thanks: ); }, + addPageInfo: function () { + let self = this; + buffer.addPageInfoSection( + 'S', + 'Stella Info', + function (verbose) + (self.isValid && self.player.has('pageinfo', 'r') + ? self.player.pageinfo + : []) + ); + }, + createStatusPanel: function () { let self = this; @@ -1804,6 +1837,7 @@ Thanks: let install = function () { let stella = liberator.globalVariables.stella = new Stella(new Setting()); stella.addUserCommands(); + stella.addPageInfo(); liberator.log('Stella: installed.'); }; -- cgit v1.2.3