// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2014 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
config.tabStrip.collapsed = true;
this.tabStyle = styles.system.add("tab-strip-hiding", config.styleableChrome,
- (config.tabStrip.id ? "#" + config.tabStrip.id : ".tabbrowser-strip") +
+ (config.tabStrip.id ? "#" + config.tabStrip.id
+ : ".tabbrowser-strip") +
"{ visibility: collapse; }",
false, true);
updateTabCount: function updateTabCount() {
for (let [i, tab] in Iterator(this.visibleTabs)) {
- if (dactyl.has("Gecko2")) {
- let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_);
- if (!node("dactyl-tab-number")) {
- let img = node("tab-icon-image");
- if (img) {
- let dom = DOM([
- ["xul:hbox", { highlight: "tab-number" },
- ["xul:label", { key: "icon", align: "center", highlight: "TabIconNumber",
- class: "dactyl-tab-icon-number" }]],
- ["xul:hbox", { highlight: "tab-number" },
- ["html:div", { key: "label", highlight: "TabNumber",
- class: "dactyl-tab-number" }]]],
- document).appendTo(img.parentNode);
-
- update(tab, {
- get dactylOrdinal() Number(dom.nodes.icon.value),
- set dactylOrdinal(i) {
- dom.nodes.icon.value = dom.nodes.label.textContent = i;
- this.setAttribute("dactylOrdinal", i);
- }
- });
- }
+ let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_);
+ if (!node("dactyl-tab-number")) {
+ let img = node("tab-icon-image");
+ if (img) {
+ let dom = DOM([
+ ["xul:hbox", { highlight: "tab-number" },
+ ["xul:label", { key: "icon", align: "center", highlight: "TabIconNumber",
+ class: "dactyl-tab-icon-number" }]],
+ ["xul:hbox", { highlight: "tab-number" },
+ ["html:div", { key: "label", highlight: "TabNumber",
+ class: "dactyl-tab-number" }]]],
+ document).appendTo(img.parentNode);
+
+ update(tab, {
+ get dactylOrdinal() Number(dom.nodes.icon.value),
+ set dactylOrdinal(i) {
+ dom.nodes.icon.value = dom.nodes.label.textContent = i;
+ this.setAttribute("dactylOrdinal", i);
+ }
+ });
}
}
tab.dactylOrdinal = i + 1;
* @param {number} count How many tabs to remove.
* @param {boolean} focusLeftTab Focus the tab to the left of the removed tab.
*/
- remove: function remove(tab, count = 1, focusLeftTab = false) {
+ remove: function remove(tab, count=1, focusLeftTab=false) {
let res = this.count > count;
let tabs = this.visibleTabs;
if (focusLeftTab)
tabs.slice(Math.max(0, index + 1 - count),
index + 1)
- .forEach(config.closure.removeTab);
+ .forEach(config.bound.removeTab);
else
tabs.slice(index,
index + count)
- .forEach(config.closure.removeTab);
+ .forEach(config.bound.removeTab);
return res;
},
if (matches)
return tabs.select(this.allTabs[parseInt(matches[1], 10) - 1], false);
- matches = array.nth(tabs.allTabs, t => (t.linkedBrowser.lastURI || {}).spec === buffer, 0);
+ matches = tabs.allTabs.find(t => (t.linkedBrowser.lastURI || {}).spec === buffer);
if (matches)
return tabs.select(matches, false);
tabs.getGroups();
tabs[visible ? "visibleTabs" : "allTabs"].forEach(function (tab, i) {
let group = (tab.tabItem || tab._tabViewTabItem || defItem).parent || defItem.parent;
- if (!Set.has(tabGroups, group.id))
+ if (!hasOwnProperty(tabGroups, group.id))
tabGroups[group.id] = [group.getTitle(), []];
group = tabGroups[group.id];
}
for (let event in values(["TabMove", "TabOpen", "TabClose"]))
events.listen(tabContainer, event, callback, false);
- events.listen(tabContainer, "TabSelect", tabs.closure._onTabSelect, false);
+ events.listen(tabContainer, "TabSelect", tabs.bound._onTabSelect, false);
},
mappings: function initMappings() {
tabs.tabStyle.enabled = false;
}
- if (value !== "multitab" || !dactyl.has("Gecko2"))
+ if (value !== "multitab")
if (tabs.xulTabs)
tabs.xulTabs.visible = value !== "never";
else
values: activateGroups,
has: Option.has.toggleAll,
setter: function (newValues) {
- let valueSet = Set(newValues);
+ let valueSet = RealSet(newValues);
for (let group in values(activateGroups))
if (group[2])
prefs.safeSet("browser.tabs." + group[2],
- !(valueSet["all"] ^ valueSet[group[0]]),
+ !(valueSet.has("all") ^ valueSet.has(group[0])),
_("option.safeSet", "activate"));
return newValues;
}