Skip to content

Commit

Permalink
Page-scrolling and tabs-scrolling bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
IIUJ-KrzysztofDawidowicz committed Feb 20, 2014
1 parent c5c0a7f commit 5450092
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
Binary file modified TabGroupBar/[email protected]
Binary file not shown.
40 changes: 35 additions & 5 deletions TabGroupBar/chrome/content/tabgroupbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,44 @@ objTabGroupBar.addTabContextMenuItems = function(){
objTabGroupBar.addGlobalEventListeners = function(){
var tabContainer = this.window.getBrowser().tabContainer;
var reloadOnEvent = function(event) {
// let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
// console.log("Reload group tabs");
if(!objTabGroupBar.ignoreNextEvent)
objTabGroupBar.reloadGroupTabs();
objTabGroupBar.ignoreNextEvent = false;
};
tabContainer.addEventListener("TabSelect", reloadOnEvent);
window.addEventListener("tabviewframeinitialized", reloadOnEvent);
window.addEventListener("SSTabRestored", reloadOnEvent);
window.addEventListener("tabviewhidden", reloadOnEvent);
var changeGroupTab = function(e) {
// let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
// console.log("Change group tab");
if(!objTabGroupBar.ignoreNextEvent)
objTabGroupBar.switchGroupTo(e.target.selectedItem.value);
objTabGroupBar.ignoreNextEvent = false;
};
var loadOnRestore = function(event) {
objTabGroupBar.ignoreNextEvent = true;
objTabGroupBar.reloadGroupTabs();
objTabGroupBar.ignoreNextEvent = false;
};
var switchSelectedGroupTab = function(event) {
if(objTabGroupBar.ignoreNextEvent) return;
var activeGroupId = event.target._tabViewTabItem.parent.id;
var tabs = objTabGroupBar.tabsContainer.childNodes;
for(let i=0;i<tabs.length;i++)
{
if(tabs[i].value==activeGroupId)
{
objTabGroupBar.ignoreNextEvent = true; //Ignore the select event from this
objTabGroupBar.tabsContainer.selectedIndex = i;
objTabGroupBar.ignoreNextEvent = false;
return;
}
}
};
tabContainer.addEventListener("TabSelect", switchSelectedGroupTab);
this.tabsContainer.addEventListener("select", changeGroupTab, false);
window.addEventListener("tabviewframeinitialized", loadOnRestore);
window.addEventListener("SSTabRestored", loadOnRestore);
document.addEventListener("tabviewhidden", reloadOnEvent);
};

objTabGroupBar.hideToolbar = function TabGroupBar__hideToolbar (event) { document.getElementById("TabGroupBar-Toolbar").setAttribute("collapsed", "true"); };
Expand Down Expand Up @@ -205,7 +235,7 @@ objTabGroupBar.addGroupTab = function(groupItem) {


//tab.setAttribute("oncommand", "objTabGroupBar.switchGroupTo(event.target.value);");
tab.addEventListener("command", function(event) {objTabGroupBar.switchGroupTo(event.target.value);});
//tab.addEventListener("command", function(event) {objTabGroupBar.switchGroupTo(event.target.value);});
//tab.setAttribute("ondblclick", "objTabGroupBar.createRenameGroupTextBox(event.target);");
tab.addEventListener("dblclick", function(event) {objTabGroupBar.createRenameGroupTextBox(event.target);});

Expand Down
9 changes: 2 additions & 7 deletions TabGroupBar/chrome/content/tabgroupbar.xul
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,9 @@
hidden="false"
persist="hidden"
>
<tabbox id="TabGroupBar-TabBox">
<tabbox id="TabGroupBar-TabBox" flex="1">
<arrowscrollbox orient="horizontal">
<tabs id="TabGroupBar-TabBox-Tabs">
<!--<button label="Load tabs" oncommand="objTabGroupBar.addGroupTabs(); "/>-->
<!--<tab label="First tab" oncommand="objTabGroupBar.addGroupTabs(); "/>-->
<!--<tab label="Second tab" oncommand=""/>-->
<!--<tab label="Last tab"/>-->
</tabs>
<tabs id="TabGroupBar-TabBox-Tabs" flex="1"/>
</arrowscrollbox>

</tabbox>
Expand Down
2 changes: 1 addition & 1 deletion TabGroupBar/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<em:id>[email protected]</em:id>
<em:name>Tab Group Bar</em:name>
<em:type>2</em:type>
<em:version>1.4</em:version>
<em:version>1.4.3</em:version>

<em:targetApplication>
<Description>
Expand Down

0 comments on commit 5450092

Please sign in to comment.