From 2ee89d768c478816d25a2d6757427e562b90db4f Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 11 Feb 2010 11:14:54 +0000 Subject: YouTube の再生品質設定に対応 (:stqu[ality] hoge) git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36711 d0d07461-0603-4401-acd4-de1884942a52 --- stella.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 7 deletions(-) (limited to 'stella.js') diff --git a/stella.js b/stella.js index fb160a5..c032314 100644 --- a/stella.js +++ b/stella.js @@ -39,12 +39,12 @@ let PLUGIN_INFO = すてら For Niconico/YouTube/Vimeo, Add control commands and information display(on status line). ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。 - 0.22.1 + 0.23.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) 2.0 - 2.2pre + 2.3 http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/stella.js fetch maxVolume playOrPause relations seek seekRelative turnUpDownVolume }, @@ -673,7 +681,9 @@ Thanks: repeating: '', title: 'r', totalTime: 'r', - volume: 'rw' + volume: 'rw', + quality: 'rw', + qualities: 'r' }, icon: 'http://www.youtube.com/favicon.ico', @@ -733,6 +743,11 @@ Thanks: get player () U.getElementByIdEx('movie_player'), + get quality () this.player.getPlaybackQuality(), + set quality (value) this.player.setPlaybackQuality(value), + + get qualities () this.player.getAvailableQualityLevels(), + get ready () !!this.player, get relatedIDs () { @@ -844,7 +859,9 @@ Thanks: tags: 'r', title: 'r', totalTime: 'r', - volume: 'rw' + volume: 'rw', + quality: '', + qualities: '' }, icon: 'http://www.nicovideo.jp/favicon.ico', @@ -1384,7 +1401,7 @@ Thanks: ? funcS : function (arg) { if (!self.isValid) - U.raise('Stella: Current page is not supported'); + U.raiseNotSupportedPage(); let p = self.player; let func = arg.bang ? funcB : funcS; if (p.has(func, 'rwt')) @@ -1394,7 +1411,7 @@ Thanks: else if (p.has(func, 'x')) p[func].apply(p, arg); else - U.raise('Stella: The function is not supported in this page.'); + U.raiseNotSupportedFunction(); self.update(); }, {argCount: '*', bang: !!funcB}, @@ -1415,10 +1432,38 @@ Thanks: if (U.s2b(liberator.globalVariables.stella_use_nico_comment, false)) add('sa[y]', 'say'); + commands.addUserCommand( + ['stqu[ality]'], + 'Quality - Stella', + function (args) { + if (!self.isValid) + return U.raiseNotSupportedPage(); + if (self.player.has('quality', 'w')) + return U.raiseNotSupportedFunction(); + + self.player.quality = args.literalArg; + }, + { + literal: 0, + completer: function (context) { + if (!self.player.has('qualities', 'r')) + return; + context.title = ['Quality', 'Description']; + context.completions = [[q, q] for each ([, q] in self.player.qualities)]; + } + }, + true + ); + commands.addUserCommand( ['strel[ations]'], 'relations - Stella', function (args) { + if (!self.isValid) + return U.raiseNotSupportedPage(); + if (self.player.has('quality', 'w')) + return U.raiseNotSupportedFunction(); + let arg = args.string; let url = self.player.has('makeURL', 'x') ? makeRelationURL(self.player, arg) : arg; liberator.open(url, args.bang ? liberator.NEW_TAB : liberator.CURRENT_TAB); @@ -1428,7 +1473,7 @@ Thanks: bang: true, completer: function (context, args) { if (!self.isValid) - U.raise('Stella: Current page is not supported'); + U.raiseNotSupportedPage(); if (!self.player.has('relations', 'r')) return; context.title = ['Tag/ID', 'Description']; -- cgit v1.2.3