diff options
author | anekos | 2010-02-14 14:38:04 +0000 |
---|---|---|
committer | anekos | 2010-02-14 14:38:04 +0000 |
commit | b4ead8c29b38ba28392e2ad17849c842d35f23d8 (patch) | |
tree | 10551260ac7b3c735634b0d69e825da52b7a729d | |
parent | e7043db25e8b9823a9490a90ceab9f67e4a92c45 (diff) | |
download | vimperator-plugins-b4ead8c29b38ba28392e2ad17849c842d35f23d8.tar.bz2 |
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
-rw-r--r-- | stella.js | 38 |
1 files changed, 36 insertions, 2 deletions
@@ -39,7 +39,7 @@ let PLUGIN_INFO = <name lang="ja">すてら</name> <description>For Niconico/YouTube/Vimeo, Add control commands and information display(on status line).</description> <description lang="ja">ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。</description> - <version>0.23.0</version> + <version>0.24.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> @@ -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.'); }; |