Changeset 12079

Show
Ignore:
Timestamp:
05/20/08 23:58:17 (14 months ago)
Author:
chiba
Message:

CurrentPageLoadイベントの追加とTabLeaveイベントが下記の条件で意図した動作をしないのでついでに修正しました。

  • セッションからのタブ復活をした直後のタブ変更

(セッションからの復活ではTabSelectはおこらず。)

  • タブの削除(recentTabオブジェクトが破棄されてしまうため)
Files:
1 modified

Legend:

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

    r9439 r12079  
    11// Vimperator plugin: 'Ex Autocmd' 
    2 // Last Change: 14-Apr-2008. Jan 2008 
     2// Last Change: 20-May-2008. Jan 2008 
    33// License: Creative Commons 
    44// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid 
     
    88//      TabSelect 
    99//      TabLeave 
     10//      CurrentPageLoad 
    1011 
    11 var recentTab = null; 
     12var recentTabURI = null; 
    1213function tabSelect(e){ 
    1314    liberator.autocommands.trigger("TabSelect",gBrowser.selectedTab.linkedBrowser.contentWindow.location.href); 
    14     liberator.autocommands.trigger("TabLeave",recentTab && recentTab.linkedBrowser.contentWindow?recentTab.linkedBrowser.contentWindow.location.href:""); 
    15     recentTab = gBrowser.selectedTab; 
     15    liberator.autocommands.trigger("TabLeave",recentTabURI ? recentTabURI : ""); 
     16    recentTabURI = gBrowser.selectedTab.linkedBrowser.contentWindow.location.href; 
    1617} 
    1718gBrowser.tabContainer.addEventListener("TabSelect",tabSelect,false); 
     19 
     20 
     21function currentPageLoad(e){ 
     22    var doc = e.originalTarget; 
     23    if (doc instanceof HTMLDocument &&  doc == gBrowser.contentDocument){ 
     24        liberator.autocommands.trigger("CurrentPageLoad",doc.documentURI); 
     25        recentTabURI = doc.documentURI; 
     26    } 
     27} 
     28gBrowser.addEventListener("load", currentPageLoad, true); 
     29