Bug 592586 Remove code for "group tab by sites" [r+a=dietrich]

This commit is contained in:
Michael Yoshitaka Erlewine 2010-09-03 15:00:09 -04:00
Родитель f1d6e18491
Коммит f878c701a8
2 изменённых файлов: 0 добавлений и 70 удалений

Просмотреть файл

@ -1407,21 +1407,6 @@ window.GroupItems = {
return sane;
},
// ----------
// Function: getGroupItemWithTitle
// Returns the <GroupItem> that has the given title, or null if none found.
// TODO: what if there are multiple groupItems with the same title??
// Right now, looks like it'll return the last one. Bug 586557
getGroupItemWithTitle: function(title) {
var result = null;
this.groupItems.forEach(function(groupItem) {
if (groupItem.getTitle() == title)
result = groupItem;
});
return result;
},
// ----------
// Function: register
// Adds the given <GroupItem> to the list of groupItems we're tracking.

Просмотреть файл

@ -929,11 +929,6 @@ var UIManager = {
code: function() {
self._saveAll();
}
}, {
name: "group sites",
code: function() {
self._arrangeBySite();
}
}];
var count = commands.length;
@ -997,56 +992,6 @@ var UIManager = {
GroupItems.saveAll();
TabItems.saveAll();
},
// ----------
// Function: _arrangeBySite
// Blows away all existing groupItems and organizes the tabs into new groupItems based
// on domain.
_arrangeBySite: function() {
function putInGroupItem(set, key) {
var groupItem = GroupItems.getGroupItemWithTitle(key);
if (groupItem) {
set.forEach(function(el) {
groupItem.add(el);
});
} else
new GroupItem(set, { dontPush: true, dontArrange: true, title: key });
}
GroupItems.removeAll();
var groupItems = [];
var leftovers = [];
var items = TabItems.getItems();
items.forEach(function(item) {
var url = item.tab.linkedBrowser.currentURI.spec;
var domain = url.split('/')[2];
if (!domain)
leftovers.push(item.container);
else {
var domainParts = domain.split(".");
var mainDomain = domainParts[domainParts.length - 2];
if (groupItems[mainDomain])
groupItems[mainDomain].push(item.container);
else
groupItems[mainDomain] = [item.container];
}
});
for (key in groupItems) {
var set = groupItems[key];
if (set.length > 1) {
putInGroupItem(set, key);
} else
leftovers.push(set[0]);
}
if (leftovers.length)
putInGroupItem(leftovers, "mixed");
GroupItems.arrange();
},
};
// ----------