Skip to content

Commit

Permalink
Added tabviewhidden event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
IIUJ-KrzysztofDawidowicz committed Dec 3, 2013
1 parent 9a4d8db commit e15a350
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions TabGroupBar/chrome/content/tabgroupbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ objTabGroupBar.addGlobalEventListeners = function(){
tabContainer.addEventListener("TabSelect", reloadOnEvent);
window.addEventListener("tabviewframeinitialized", reloadOnEvent);
window.addEventListener("SSTabRestored", reloadOnEvent);
// tabContainer.addEventListener("TabSelect")
window.addEventListener("tabviewhidden", reloadOnEvent);
};
objTabGroupBar.reloadGroupTabs = function(){
objTabGroupBar.reloadGroupTabs = function(event){
this.clearGroupTabs();
this.addGroupTabs();
};
Expand Down Expand Up @@ -64,6 +64,7 @@ objTabGroupBar.addGroupTabs = function(){
for (i= 0; i<groupItems.length;i++)
{
this.addGroupTab(groupItems[i]);
groupItems[i].addSubscriber("close", this.reloadGroupTabs);
this.tabsLoaded = true;
if(groupItems[i]==activeGroup)
{
Expand All @@ -73,20 +74,22 @@ objTabGroupBar.addGroupTabs = function(){
};

objTabGroupBar.addGroupTab = function(groupItem) {


var title = groupItem.getTitle();
if(!title) {
title = "(none)";
}
if(this.debug) {title = title + ":" + groupItem.id;}
var tab = document.createElement("tab");
tab.setAttribute("label", title);
tab.value = groupItem.id;
tab.setAttribute("id", "TabGroupBar-GroupTab-" + groupItem.id);
tab.setAttribute("groupid", groupItem.id);
tab.setAttribute("draggable", "true");
tab.setAttribute("droppable", "true");
tab.setAttribute("context", "TabGroupBar-TabContextMenu");
tab.setAttribute("flex", 1);
tab.value = groupItem.id;


tab.setAttribute("oncommand", "objTabGroupBar.switchGroupTo(" + groupItem.id + ");");
Expand Down Expand Up @@ -248,7 +251,7 @@ objTabGroupBar.onKeyPressedRenameGroupTextBox = function(event){
};

objTabGroupBar.getGroupForTab = function(tab){
let groupId = parseInt(tab.getAttribute("groupid"));
let groupId = tab.value;//parseInt(tab.getAttribute("groupid"));
let group = tabView.getContentWindow().GroupItems.groupItem(groupId);
return group;
};
Expand Down Expand Up @@ -283,6 +286,11 @@ objTabGroupBar.onTabListPopupShowing = function(event){
}
};

objTabGroupBar.onDragOver = function(event){
this.addTab("dragover");
event.dataTransfer.types.forEach(function(type) {objTabGroupBar.addTab(type); });
};

window.addEventListener("load",
function(e)
{
Expand Down
3 changes: 2 additions & 1 deletion TabGroupBar/chrome/content/tabgroupbar.xul
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
context="TabGroupBar-BarContextMenu"
hidden="false"
persist="hidden"
droppable="true"
>
<tabbox id="TabGroupBar-TabBox" flex="1" >
<tabbox id="TabGroupBar-TabBox" flex="1">
<arrowscrollbox orient="horizontal">
<tabs id="TabGroupBar-TabBox-Tabs">
<!--<button label="Load tabs" oncommand="objTabGroupBar.addGroupTabs(); "/>-->
Expand Down

0 comments on commit e15a350

Please sign in to comment.