Changeset 29531

Show
Ignore:
Timestamp:
02/04/09 20:49:59 (4 years ago)
Author:
anekos
Message:

自動フルスクリーン

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/trunk/stella.js

    r29525 r29531  
    114114TODO 
    115115   ・Icons 
    116    ・Other video hosting websites 
    117116   ・auto fullscreen 
    118117   ・動的な command の追加削除 (nice rabbit!) 
     
    121120   ・argCount の指定が適当なのを修正 (動的な userCommand と平行でうまくできそう?) 
    122121   ・実際のプレイヤーが表示されるまで待機できようにしたい(未表示に時にフルスクリーン化すると…) 
    123    ・コメント欄でリンクされている動画も関連動画として扱いたい 
    124       -> "その3=>sm666" みたいなやつ 
    125       -> リンクはともかくタイトルの取得がムツカシー 
    126122   ・isValid とは別にプレイヤーの準備が出来ているか?などをチェックできる関数があるほうがいいかも 
    127123      -> isValid ってなまえはどうなの? 
    128124      -> isReady とか 
    129125   ・パネルなどの要素にクラス名をつける 
     126 
     127FIXME 
     128    ・this.last.fullscreen = value; 
    130129 
    131130MEMO 
     
    352351 
    353352    this.initialize.apply(this, arguments); 
     353 
     354    this.last = { 
     355      fullscreen: false 
     356    }; 
    354357 
    355358    function setf (name, value) 
     
    443446    get fileURL () undefined, 
    444447 
     448    get large () this.fullscreen, 
     449    set large (value) (this.fullscreen = value), 
     450 
    445451    get maxVolume () 100, 
    446452 
    447453    get muted () undefined, 
    448454    set muted (value) value, 
     455 
     456    get ready () undefined, 
    449457 
    450458    get relatedIDs () undefined, 
     
    463471    get repeating () undefined, 
    464472    set repeating (value) value, 
    465  
    466     get large () this.fullscreen, 
    467     set large (value) (this.fullscreen = value), 
    468473 
    469474    get state () undefined, 
     
    656661          function (id) { 
    657662            let (node = U.getElementById(id)) { 
    658               liberator.log(node) 
    659663              node && f(node); 
    660664            } 
     
    663667      } 
    664668 
     669      this.last.fullscreen = value; 
    665670      this.storage.fullscreen = value; 
    666671 
     
    690695    get player () 
    691696      U.getElementByIdEx('movie_player'), 
     697 
     698    get ready () !!this.player, 
    692699 
    693700    get relatedIDs () { 
     
    821828    set comment (value) (this.player.ext_setCommentVisible(value), value), 
    822829 
    823     get currentTime () parseInt(this.player.ext_getPlayheadTime()), 
     830    get currentTime () { 
     831      try { 
     832      return parseInt(this.player.ext_getPlayheadTime()) 
     833      } catch (e) { 
     834        liberator.log(e) 
     835        liberator.log(e.stack) 
     836      } 
     837    }, 
    824838    set currentTime (value) (this.player.ext_setPlayheadTime(U.fromTimeCode(value)), this.currentTime), 
    825839 
     
    896910        ((InVimperator && liberator.mode === modes.COMMAND_LINE) || setTimeout(turnOnMain, 500)); 
    897911 
     912      this.last.fullscreen = value; 
     913 
    898914      // メイン 
    899915      value = !!value; 
     
    923939 
    924940    get playerContainer () U.getElementByIdEx('flvplayer_container'), 
     941 
     942    get ready () !!(this.player && this.player.ext_getVideoSize), 
    925943 
    926944    get relatedIDs () { 
     
    957975                     .filter(function (it) /watch\//.test(it.href)) 
    958976                     .map(function(v) v.textContent); 
    959         liberator.log(comment) 
    960977        links.forEach(function (link) { 
    961978          let r = RegExp('(?:^|[\u3000\\s\\>])([^\u3000\\s\\>]+)\\s*<a href="http:\\/\\/www\\.nicovideo\\.\\w+\\/watch\\/' + link + '" class="video">').exec(comment); 
     
    14241441    disable: function () { 
    14251442      this.hidden = true; 
    1426       if (this.timerHandle) { 
    1427         clearInterval(this.timerHandle); 
    1428         this.timerHandle = null; 
     1443      if (this.__updateTimer) { 
     1444        clearInterval(this.__updateTimer); 
     1445        delete this.__updateTimer; 
     1446      } 
     1447      if (this.__autoFullscreenTimer) { 
     1448        clearInterval(this.__autoFullscreenTimer); 
    14291449      } 
    14301450    }, 
     
    14361456        this.toggles[name].hidden = !this.player.has(name, 't'); 
    14371457      } 
    1438       if (!this.timerHandle) { 
    1439         this.timerHandle = setInterval(U.bindr(this, this.update), 500); 
     1458      if (!this.__updateTimer) { 
     1459        this.__updateTimer = setInterval(U.bindr(this, this.update), 500); 
    14401460      } 
    14411461    }, 
     
    14481468 
    14491469    update: function () { 
     1470      if (!(this.isValid && this.player.ready)) 
     1471        return; 
    14501472      this.labels.main.text = this.player.statusText; 
    14511473      this.labels.volume.text = this.player.volume; 
     
    14801502        (this.__valid = this.isValid) ? this.enable() : this.disable(); 
    14811503      } 
     1504      if (this.isValid) { 
     1505        clearInterval(this.__onReadyTimer); 
     1506        this.__onReadyTimer = setInterval( 
     1507          U.bindr(this, function () { 
     1508            if (this.player && this.player.ready) { 
     1509              clearInterval(this.__onReadyTimer); 
     1510              delete this.__onReadyTimer; 
     1511              this.onReady(); 
     1512            } 
     1513          }), 
     1514          200 
     1515        ); 
     1516      } 
    14821517    }, 
    14831518 
     
    14991534 
    15001535    onPlayClick: function () this.player.play(), 
     1536 
     1537    onReady: function () { 
     1538      if (this.player.last.fullscreen && !this.__autoFullscreenTimer) { 
     1539        this.__autoFullscreenTimer = setInterval( 
     1540          U.bindr(this, function () { 
     1541            if (!this.player.ready) 
     1542              return; 
     1543            clearInterval(this.__autoFullscreenTimer) 
     1544            setTimeout(U.bindr(this, function () (this.player.fullscreen = true), 1000)); 
     1545            delete this.__autoFullscreenTimer; 
     1546          }), 
     1547          200 
     1548        ); 
     1549      } 
     1550    }, 
    15011551 
    15021552    onRepeatClick: function () this.player.toggle('repeating'),