Changeset 20940
- Timestamp:
- 10/08/08 03:03:17 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/youtubeamp.js
r20937 r20940 2 2 * ==VimperatorPlugin== 3 3 * @name youtubeamp.js 4 * @description this script give you keyboard opration for youtube.com.4 * @description this script gives you keyboard oprations for YouTube.com. 5 5 * @description-ja YouTube のプレーヤーをキーボードで操作できるようにする。 6 6 * @author janus_wel <janus_wel@fb3.so-net.ne.jp> 7 * @version 0.1 07 * @version 0.11 8 8 * @minversion 1.2 9 9 * ==VimperatorPlugin== … … 41 41 * */ 42 42 43 (function() {43 (function() { 44 44 45 45 Function.prototype.bind = function(object) { … … 47 47 return function() { 48 48 return __method.apply(object, arguments); 49 } 49 }; 50 50 }; 51 51 … … 56 56 } 57 57 YouTubePlayerController.prototype = { 58 initialize: function () {58 initialize: function() { 59 59 this.fuller = this._changeToFull.bind(this); 60 60 }, 61 61 62 62 constants: { 63 VERSION: '0.10',64 65 CARDINAL_NUMBER: 10,66 67 YOUTUBE_DOMAIN: '.youtube.jp',68 YOUTUBE_URL: '^http://[^.]+\\.youtube\\.com/',69 WATCH_URL: 'http://[^.]+\\.youtube\\.com/watch',70 WATCH_PAGE: 1,63 VERSION: '0.10', 64 65 CARDINAL_NUMBER: 10, 66 67 YOUTUBE_DOMAIN: '.youtube.jp', 68 YOUTUBE_URL: '^http://[^.]+\\.youtube\\.com/', 69 WATCH_URL: 'http://[^.]+\\.youtube\\.com/watch', 70 WATCH_PAGE: 1, 71 71 72 72 PLAYER_NODE_ID: 'movie_player', 73 73 74 STATE_PLAYING: 1,75 76 SIZE_WIDTH_DEFAULT: 480,77 SIZE_HEIGHT_DEFAULT: 385,74 STATE_PLAYING: 1, 75 76 SIZE_WIDTH_DEFAULT: 480, 77 SIZE_HEIGHT_DEFAULT: 385, 78 78 79 79 NAME_PLAYER_VERSION: 'PLAYER_VERSION', 80 80 81 SEEKTO_DEFAULT: 0,82 SEEKBY_DEFAULT: 0,83 VOLUMETO_DEFAULT: 100,84 VOLUMEBY_DEFAULT: 0,81 SEEKTO_DEFAULT: 0, 82 SEEKBY_DEFAULT: 0, 83 VOLUMETO_DEFAULT: 100, 84 VOLUMEBY_DEFAULT: 0, 85 85 86 86 HIDE_NODES: [ … … 96 96 }, 97 97 98 getControllerVersion: function () { return this.constants.VERSION; },98 getControllerVersion: function() { return this.constants.VERSION; }, 99 99 100 100 pagecheck: function() { … … 134 134 }, 135 135 136 _changeToFull: function () {137 var p = this._player(); 138 setTimeout(function () {136 _changeToFull: function() { 137 var p = this._player(); 138 setTimeout(function() { 139 139 p.width = content.innerWidth; 140 140 p.height = content.innerHeight; … … 142 142 }, 143 143 144 _getElementById: function (id) {144 _getElementById: function(id) { 145 145 var e = window.content.document.getElementById(id); 146 if (!e) return null;146 if(!e) return null; 147 147 148 148 return e.wrappedJSObject … … 151 151 }, 152 152 153 _fullSize: function () {153 _fullSize: function() { 154 154 var b = this._getElementById('baseDiv'); 155 155 this.defMargin = b.style.margin; … … 160 160 b.style.width = '100%'; 161 161 162 for (var i=0, max=this.constants.HIDE_NODES.length ; i<max ; ++i) {162 for(var i=0, max=this.constants.HIDE_NODES.length ; i<max ; ++i) { 163 163 var h = this._getElementById(this.constants.HIDE_NODES[i]); 164 if (h) { h.style.display = 'none'; }164 if(h) { h.style.display = 'none'; } 165 165 } 166 166 … … 174 174 }, 175 175 176 _normalSize: function () {176 _normalSize: function() { 177 177 var b = this._getElementById('baseDiv'); 178 178 b.style.margin = this.defMargin; … … 180 180 b.style.width = this.defWidth; 181 181 182 for (var i=0, max=this.constants.HIDE_NODES.length ; i<max ; ++i) {182 for(var i=0, max=this.constants.HIDE_NODES.length ; i<max ; ++i) { 183 183 var h = this._getElementById(this.constants.HIDE_NODES[i]); 184 if (h) { h.style.display = 'block'; }184 if(h) { h.style.display = 'block'; } 185 185 } 186 186 … … 258 258 var info = [ 259 259 'controller version : ' + controller.getControllerVersion(), 260 ].join( "\n");260 ].join('\n'); 261 261 liberator.echo(info, liberator.commandline.FORCE_MULTILINE); 262 262 } … … 288 288 liberator.commands.addUserCommand( 289 289 ['ytseek'], 290 'control lseek bar',290 'control seek bar', 291 291 function(arg, special) { 292 292 try { special ? controller.seekBy(arg) : controller.seekTo(arg); } … … 294 294 }, 295 295 { 296 bang: true,296 bang: true, 297 297 } 298 298 ); … … 300 300 liberator.commands.addUserCommand( 301 301 ['ytvolume'], 302 'control lvolume',302 'control volume', 303 303 function(arg, special) { 304 304 try { special ? controller.volumeBy(arg) : controller.volumeTo(arg); } … … 306 306 }, 307 307 { 308 bang: true,308 bang: true, 309 309 } 310 310 );
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)