// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2011 by 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.
// hide tabs initially to prevent flickering when 'stal' would hide them
// on startup
- if (config.hasTabbrowser)
+ if (config.has("tabbrowser"))
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);
dactyl.commands["tabs.select"] = function (event) {
- tabs.select(event.originalTarget.getAttribute("identifier"));
+ tabs.switchTo(event.originalTarget.getAttribute("identifier"));
};
- this.tabBinding = styles.system.add("tab-binding", "chrome://browser/content/browser.xul", String.replace(<><![CDATA[
+ this.tabBinding = styles.system.add("tab-binding", "chrome://browser/content/browser.xul", literal(/*
xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab) !important; }
- ]]></>, /tab-./g, function (m) util.OS.isMacOSX ? "tab-mac" : m),
+ */).replace(/tab-./g, m => config.OS.isMacOSX ? "tab-mac" : m),
false, true);
this.timeout(function () {
}
},
- _alternates: Class.memoize(function () [config.tabbrowser.mCurrentTab, null]),
+ _alternates: Class.Memoize(() => [config.tabbrowser.mCurrentTab, null]),
cleanup: function cleanup() {
for (let [i, tab] in Iterator(this.allTabs)) {
for (let elem in values(["dactyl-tab-icon-number", "dactyl-tab-number"].map(node)))
if (elem)
elem.parentNode.parentNode.removeChild(elem.parentNode);
+
+ delete tab.dactylOrdinal;
+ tab.removeAttribute("dactylOrdinal");
}
},
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 nodes = {};
- let dom = util.xmlToDom(<xul xmlns:xul={XUL} xmlns:html={XHTML}
- ><xul:hbox highlight="tab-number"><xul:label key="icon" align="center" highlight="TabIconNumber" class="dactyl-tab-icon-number"/></xul:hbox
- ><xul:hbox highlight="tab-number"><html:div key="label" highlight="TabNumber" class="dactyl-tab-number"/></xul:hbox
- ></xul>.*, document, nodes);
- img.parentNode.appendChild(dom);
- tab.__defineGetter__("dactylOrdinal", function () Number(nodes.icon.value));
- tab.__defineSetter__("dactylOrdinal", function (i) nodes.icon.value = nodes.label.textContent = 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.setAttribute("dactylOrdinal", i + 1);
tab.dactylOrdinal = i + 1;
}
statusline.updateTabCount(true);
/**
* @property {Object} The local options store for the current tab.
*/
- get options() {
- let store = this.localStore;
- if (!("options" in store))
- store.options = {};
- return store.options;
- },
+ get options() this.localStore.options,
- get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
+ get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(tab => !tab.hidden),
/**
* Returns the local state store for the tab at the specified *tabIndex*.
getLocalStore: function getLocalStore(tabIndex) {
let tab = this.getTab(tabIndex);
if (!tab.dactylStore)
- tab.dactylStore = {};
- return tab.dactylStore;
+ tab.dactylStore = Object.create(this.localStorePrototype);
+ return tab.dactylStore.instance = tab.dactylStore;
},
/**
*/
get localStore() this.getLocalStore(),
+ localStorePrototype: memoize({
+ instance: {},
+ get options() ({})
+ }),
+
/**
* @property {[Object]} The array of closed tabs for the current
* session.
*
* @returns {Window}
*/
- getGroups: function getGroups() {
- if ("_groups" in this)
+ getGroups: function getGroups(func) {
+ let iframe = document.getElementById("tab-view");
+ this._groups = iframe ? iframe.contentWindow : null;
+
+ if ("_groups" in this && !func)
return this._groups;
- if (window.TabView && TabView._initFrame)
- TabView._initFrame();
+ if (func)
+ func = bind(function (func) { func(this._groups); }, this, func);
+
+ if (window.TabView && window.TabView._initFrame)
+ window.TabView._initFrame(func);
- let iframe = document.getElementById("tab-view");
this._groups = iframe ? iframe.contentWindow : null;
- if (this._groups)
- util.waitFor(function () this._groups.TabItems, this);
+ if (this._groups && !func)
+ util.waitFor(() => this._groups.TabItems);
return this._groups;
},
completion.listCompleter("buffer", filter);
},
+ /**
+ * Return an iterator of tabs matching the given filter. If no
+ * *filter* or *count* is provided, returns the currently selected
+ * tab. If *filter* is a number or begins with a number followed
+ * by a colon, the tab of that ordinal is returned. Otherwise,
+ * tabs matching the filter as below are returned.
+ *
+ * @param {string} filter The filter. If *regexp*, this is a
+ * regular expression against which the tab's URL or title
+ * must match. Otherwise, it is a site filter.
+ * @optional
+ * @param {number|null} count If non-null, return only the
+ * *count*th matching tab.
+ * @optional
+ * @param {boolean} regexp Whether to interpret *filter* as a
+ * regular expression.
+ * @param {boolean} all If true, match against all tabs. If
+ * false, match only tabs in the current tab group.
+ */
+ match: function match(filter, count, regexp, all) {
+ if (!filter && count == null)
+ yield tabs.getTab();
+ else if (!filter)
+ yield dactyl.assert(tabs.getTab(count - 1));
+ else {
+ let matches = /^(\d+)(?:$|:)/.exec(filter);
+ if (matches)
+ yield dactyl.assert(count == null &&
+ tabs.getTab(parseInt(matches[1], 10) - 1, !all));
+ else {
+ if (regexp)
+ regexp = util.regexp(filter, "i");
+ else
+ var matcher = Styles.matchFilter(filter);
+
+ for (let tab in values(tabs[all ? "allTabs" : "visibleTabs"])) {
+ let browser = tab.linkedBrowser;
+ let uri = browser.currentURI;
+ let title;
+ if (uri.spec == "about:blank")
+ title = "(Untitled)";
+ else
+ title = browser.contentTitle;
+
+ if (matcher && matcher(uri)
+ || regexp && (regexp.test(title) || regexp.test(uri.spec)))
+ if (count == null || --count == 0)
+ yield tab;
+ }
+ }
+ }
+ },
+
/**
* Moves a tab to a new position in the tab list.
*
* @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, focusLeftTab) {
- count = count || 1;
+ 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);
+ tabs.slice(Math.max(0, index + 1 - count),
+ index + 1)
+ .forEach(config.bound.removeTab);
else
- tabs.slice(index, index + count).forEach(config.closure.removeTab);
+ tabs.slice(index,
+ index + count)
+ .forEach(config.bound.removeTab);
return res;
},
if (matches)
return tabs.select(this.allTabs[parseInt(matches[1], 10) - 1], false);
- matches = array.nth(tabs.allTabs, function (t) (t.linkedBrowser.lastURI || {}).spec === buffer, 0);
+ matches = tabs.allTabs.find(t => (t.linkedBrowser.lastURI || {}).spec === buffer);
if (matches)
return tabs.select(matches, false);
- matches = completion.runCompleter("buffer", buffer).map(function (obj) obj.tab);
+ matches = completion.runCompleter("buffer", buffer).map(obj => obj.tab);
if (matches.length == 0)
dactyl.echoerr(_("buffer.noMatching", buffer));
services.sessionStore.setTabState(to, tabState);
}
}, {
- load: function () {
+ load: function initLoad() {
tabs.updateTabCount();
},
- commands: function () {
- commands.add(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"],
- "Delete current buffer",
- function (args) {
- let removed = 0;
- for (let tab in matchTabs(args, args.bang, true)) {
- config.removeTab(tab);
- removed++;
- }
-
- if (args[0])
- if (removed > 0)
- dactyl.echomsg(_("buffer.fewerTab" + (removed == 1 ? "" : "s"), removed), 9);
- else
- dactyl.echoerr(_("buffer.noMatching", arg));
- }, {
- argCount: "?",
- bang: true,
- count: true,
- completer: function (context) completion.buffer(context),
- literal: 0,
- privateData: true
- });
-
- function matchTabs(args, substr, all) {
- let filter = args[0];
-
- if (!filter && args.count == null)
- yield tabs.getTab();
- else if (!filter)
- yield dactyl.assert(tabs.getTab(args.count - 1));
- else {
- let matches = /^(\d+)(?:$|:)/.exec(filter);
- if (matches)
- yield dactyl.assert(args.count == null &&
- tabs.getTab(parseInt(matches[1], 10) - 1, !all));
- else {
- let str = filter.toLowerCase();
- for (let tab in values(tabs[all ? "allTabs" : "visibleTabs"])) {
- let host, title;
- let browser = tab.linkedBrowser;
- let uri = browser.currentURI.spec;
- if (browser.currentURI.schemeIs("about")) {
- host = "";
- title = "(Untitled)";
- }
- else {
- host = browser.currentURI.host;
- title = browser.contentTitle;
- }
-
- [host, title, uri] = [host, title, uri].map(String.toLowerCase);
-
- if (host.indexOf(str) >= 0 || uri == str ||
- (substr && (title.indexOf(str) >= 0 || uri.indexOf(str) >= 0)))
- if (args.count == null || --args.count == 0)
- yield tab;
- }
- }
+ commands: function initCommands() {
+ [
+ {
+ name: ["bd[elete]"],
+ description: "Delete matching buffers",
+ visible: false
+ },
+ {
+ name: ["tabc[lose]"],
+ description: "Delete matching tabs",
+ visible: true
}
- }
+ ].forEach(function (params) {
+ commands.add(params.name, params.description,
+ function (args) {
+ let removed = 0;
+ for (let tab in tabs.match(args[0], args.count, args.bang, !params.visible)) {
+ config.removeTab(tab);
+ removed++;
+ }
+
+ if (args[0])
+ if (removed > 0)
+ dactyl.echomsg(_("buffer.fewerTab" + (removed == 1 ? "" : "s"), removed), 9);
+ else
+ dactyl.echoerr(_("buffer.noMatching", args[0]));
+ }, {
+ argCount: "?",
+ bang: true,
+ count: true,
+ completer: function (context) completion.buffer(context),
+ literal: 0,
+ privateData: true
+ });
+ });
commands.add(["pin[tab]"],
"Pin tab as an application tab",
function (args) {
- for (let tab in matchTabs(args))
+ for (let tab in tabs.match(args[0], args.count))
config.browser[!args.bang || !tab.pinned ? "pinTab" : "unpinTab"](tab);
},
{
count: true,
completer: function (context, args) {
if (!args.bang)
- context.filters.push(function ({ item }) !item.tab.pinned);
+ context.filters.push(({ item }) => !item.tab.pinned);
completion.buffer(context);
}
});
commands.add(["unpin[tab]"],
"Unpin tab as an application tab",
function (args) {
- for (let tab in matchTabs(args))
+ for (let tab in tabs.match(args[0], args.count))
config.browser.unpinTab(tab);
},
{
argCount: "?",
count: true,
completer: function (context, args) {
- context.filters.push(function ({ item }) item.tab.pinned);
+ context.filters.push(({ item }) => item.tab.pinned);
completion.buffer(context);
}
});
commands.add(["tab"],
"Execute a command and tell it to output in a new tab",
function (args) {
- dactyl.withSavedValues(["forceNewTab"], function () {
- this.forceNewTab = true;
+ dactyl.withSavedValues(["forceTarget"], function () {
+ this.forceTarget = dactyl.NEW_TAB;
+ dactyl.execute(args[0], null, true);
+ });
+ }, {
+ argCount: "1",
+ completer: function (context) completion.ex(context),
+ literal: 0,
+ subCommand: 0
+ });
+
+ commands.add(["background", "bg"],
+ "Execute a command opening any new tabs in the background",
+ function (args) {
+ dactyl.withSavedValues(["forceBackground"], function () {
+ this.forceBackground = true;
dactyl.execute(args[0], null, true);
});
}, {
commands.add(["tabl[ast]", "bl[ast]"],
"Switch to the last tab",
- function () tabs.select("$", false),
+ function () { tabs.select("$", false); },
{ argCount: "0" });
// TODO: "Zero count" if 0 specified as arg
function () { tabs.select(0, false); },
{ argCount: "0" });
- if (config.hasTabbrowser) {
+ if (config.has("tabbrowser")) {
commands.add(["b[uffer]"],
"Switch to a buffer",
- function (args) { tabs.switchTo(args[0], args.bang, args.count); }, {
+ function (args) {
+ if (args.length)
+ tabs.switchTo(args[0], args.bang, args.count);
+ else if (args.count)
+ tabs.switchTo(String(args.count));
+ }, {
argCount: "?",
bang: true,
count: true,
let arg = args[0];
if (tabs.indexFromSpec(arg) == -1) {
- let tabs = [tab for (tab in matchTabs(args, true))];
- dactyl.assert(tabs.length, _("error.invalidArgument", arg));
- dactyl.assert(tabs.length == 1, _("buffer.multipleMatching", arg));
- arg = tabs[0];
+ let list = [tab for (tab in tabs.match(args[0], args.count, true))];
+ dactyl.assert(list.length, _("error.invalidArgument", arg));
+ dactyl.assert(list.length == 1, _("buffer.multipleMatching", arg));
+ arg = list[0];
}
tabs.move(tabs.getTab(), arg, args.bang);
}, {
commands.add(["tabopen", "t[open]", "tabnew"],
"Open one or more URLs in a new tab",
function (args) {
- dactyl.open(args[0] || "about:blank", { from: "tabopen", where: dactyl.NEW_TAB, background: args.bang });
+ dactyl.open(args[0] || "about:blank",
+ { from: "tabopen", where: dactyl.NEW_TAB, background: args.bang });
}, {
bang: true,
completer: function (context) completion.url(context),
commands.add(["taba[ttach]"],
"Attach the current tab to another window",
function (args) {
- dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+(?:$|:)/.test(i)),
+ dactyl.assert(args.length <= 2 && !args.some(i => !/^\d+(?:$|:)/.test(i)),
_("error.trailingCharacters"));
- let [winIndex, tabIndex] = args.map(function (arg) parseInt(arg));
+ let [winIndex, tabIndex] = args.map(arg => parseInt(arg));
+ if (args["-group"]) {
+ util.assert(args.length == 1);
+ window.TabView.moveTabTo(tabs.getTab(), winIndex);
+ return;
+ }
+
let win = dactyl.windows[winIndex - 1];
+ let sourceTab = tabs.getTab();
dactyl.assert(win, _("window.noIndex", winIndex));
dactyl.assert(win != window, _("window.cantAttachSame"));
- let browser = win.getBrowser();
-
- if (args[1]) {
- let tabList = browser.visibleTabs || browser.mTabs;
- let target = dactyl.assert(tabList[tabIndex]);
- tabIndex = Array.indexOf(browser.mTabs, target) - 1;
- }
+ let modules = win.dactyl.modules;
+ let { browser } = modules.config;
- let dummy = browser.addTab("about:blank");
+ let newTab = browser.addTab("about:blank");
browser.stop();
// XXX: the implementation of DnD in tabbrowser.xml suggests
// that we may not be guaranteed of having a docshell here
// without this reference?
browser.docShell;
- let last = browser.mTabs.length - 1;
+ if (args[1]) {
+ let { visibleTabs, allTabs } = modules.tabs;
+ tabIndex = Math.constrain(tabIndex, 1, visibleTabs.length);
+ let target = visibleTabs[tabIndex - 1];
+ browser.moveTabTo(newTab, Array.indexOf(allTabs, target));
+ }
- if (args[1])
- browser.moveTabTo(dummy, tabIndex);
- browser.selectedTab = dummy; // required
- browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab);
+ browser.selectedTab = newTab; // required
+ browser.swapBrowsersAndCloseOther(newTab, sourceTab);
}, {
argCount: "+",
literal: 1,
completer: function (context, args) {
switch (args.completeArg) {
case 0:
- context.filters.push(function ({ item }) item != window);
- completion.window(context);
+ if (args["-group"])
+ completion.tabGroup(context);
+ else {
+ context.filters.push(({ item }) => item != window);
+ completion.window(context);
+ }
break;
case 1:
- let win = dactyl.windows[Number(args[0]) - 1];
- if (!win || !win.dactyl)
- context.message = _("Error", _("window.noIndex", winIndex));
- else
- win.dactyl.modules.commands.get("tabmove").completer(context);
+ if (!args["-group"]) {
+ let win = dactyl.windows[Number(args[0]) - 1];
+ if (!win || !win.dactyl)
+ context.message = _("Error", _("window.noIndex", winIndex));
+ else
+ win.dactyl.modules.commands.get("tabmove").completer(context);
+ }
break;
}
- }
+ },
+ options: [
+ {
+ names: ["-group", "-g"],
+ description: "Attach to a group rather than a window",
+ type: CommandOption.NOARG
+ }
+ ]
});
}
context.anchored = false;
context.compare = CompletionContext.Sort.unsorted;
context.filters = [CompletionContext.Filter.textDescription];
- context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url, description: "[1].title", icon: "[1].image" };
+ context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url,
+ description: "[1].title",
+ icon: "[1].image" };
context.completions = Iterator(tabs.closedTabs);
},
count: true,
{ argCount: "0" });
}
},
- events: function () {
+ completion: function initCompletion() {
+
+ completion.buffer = function buffer(context, visible) {
+ let { tabs } = modules;
+
+ let filter = context.filter.toLowerCase();
+
+ let defItem = { parent: { getTitle: function () "" } };
+
+ let tabGroups = {};
+ tabs.getGroups();
+ tabs[visible ? "visibleTabs" : "allTabs"].forEach(function (tab, i) {
+ let group = (tab.tabItem || tab._tabViewTabItem || defItem).parent || defItem.parent;
+ if (!hasOwnProperty(tabGroups, group.id))
+ tabGroups[group.id] = [group.getTitle(), []];
+
+ group = tabGroups[group.id];
+ group[1].push([i, tab.linkedBrowser]);
+ });
+
+ context.pushProcessor(0, function (item, text, next) [
+ ["span", { highlight: "Indicator", style: "display: inline-block;" },
+ item.indicator],
+ next.call(this, item, text)
+ ]);
+ context.process[1] = function (item, text) template.bookmarkDescription(item, template.highlightFilter(text, this.filter));
+
+ context.anchored = false;
+ context.keys = {
+ text: "text",
+ description: "url",
+ indicator: function (item) item.tab === tabs.getTab() ? "%" :
+ item.tab === tabs.alternate ? "#" : " ",
+ icon: "icon",
+ id: "id",
+ command: function () "tabs.select"
+ };
+ context.compare = CompletionContext.Sort.number;
+ context.filters[0] = CompletionContext.Filter.textDescription;
+
+ for (let [id, vals] in Iterator(tabGroups))
+ context.fork(id, 0, this, function (context, [name, browsers]) {
+ context.title = [name || "Buffers"];
+ context.generate = () =>
+ Array.map(browsers, function ([i, browser]) {
+ let indicator = " ";
+ if (i == tabs.index())
+ indicator = "%";
+ else if (i == tabs.index(tabs.alternate))
+ indicator = "#";
+
+ let tab = tabs.getTab(i, visible);
+ let url = browser.contentDocument.location.href;
+ i = i + 1;
+
+ return {
+ text: [i + ": " + (tab.label || /*L*/"(Untitled)"), i + ": " + url],
+ tab: tab,
+ id: i,
+ url: url,
+ icon: tab.image || BookmarkCache.DEFAULT_FAVICON
+ };
+ });
+ }, vals);
+ };
+
+ completion.tabGroup = function tabGroup(context) {
+ context.title = ["Tab Groups"];
+ context.keys = {
+ text: "id",
+ description: function (group) group.getTitle() ||
+ group.getChildren().map(t => t.tab.label).join(", ")
+ };
+ context.generate = function () {
+ context.incomplete = true;
+ tabs.getGroups(function ({ GroupItems }) {
+ context.incomplete = false;
+ context.completions = GroupItems.groupItems;
+ });
+ };
+ };
+ },
+ events: function initEvents() {
let tabContainer = config.tabbrowser.mTabContainer;
function callback() {
tabs.timeout(function () { this.updateTabCount(); });
}
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 () {
+ mappings: function initMappings() {
+
+ mappings.add([modes.COMMAND], ["<C-t>", "<new-tab-next>"],
+ "Execute the next mapping in a new tab",
+ function ({ count }) {
+ dactyl.forceTarget = dactyl.NEW_TAB;
+ mappings.afterCommands((count || 1) + 1, function () {
+ dactyl.forceTarget = null;
+ });
+ },
+ { count: true });
+
mappings.add([modes.NORMAL], ["g0", "g^"],
"Go to the first tab",
function () { tabs.select(0); });
function ({ count }) { tabs.select("-" + (count || 1), true); },
{ count: true });
- if (config.hasTabbrowser) {
+ if (config.has("tabbrowser")) {
mappings.add([modes.NORMAL], ["b"],
"Open a prompt to switch buffers",
function ({ count }) {
mappings.add([modes.NORMAL], ["d"],
"Delete current buffer",
- function ({ count }) { tabs.remove(tabs.getTab(), count, false); },
+ function ({ count }) { tabs.remove(tabs.getTab(), count || 1, false); },
{ count: true });
mappings.add([modes.NORMAL], ["D"],
"Delete current buffer, focus tab to the left",
- function ({ count }) { tabs.remove(tabs.getTab(), count, true); },
+ function ({ count }) { tabs.remove(tabs.getTab(), count || 1, true); },
{ count: true });
mappings.add([modes.NORMAL], ["gb"],
- "Repeat last :buffer[!] command",
+ "Repeat last :buffer command",
function ({ count }) { tabs.switchTo(null, null, count, false); },
{ count: true });
mappings.add([modes.NORMAL], ["gB"],
- "Repeat last :buffer[!] command in reverse direction",
+ "Repeat last :buffer command in reverse direction",
function ({ count }) { tabs.switchTo(null, null, count, true); },
{ count: true });
{ count: true });
}
},
- options: function () {
+ options: function initOptions() {
options.add(["showtabline", "stal"],
"Define when the tab bar is visible",
- "string", config.defaults["showtabline"],
+ "string", true,
{
setter: function (value) {
if (value === "never")
tabs.tabStyle.enabled = true;
else {
prefs.safeSet("browser.tabs.autoHide", value === "multitab",
- _("option.showtabline.safeSet"));
+ _("option.safeSet", "showtabline"));
tabs.tabStyle.enabled = false;
}
- if (value !== "multitab" || !dactyl.has("Gecko2"))
+ if (value !== "multitab")
if (tabs.xulTabs)
tabs.xulTabs.visible = value !== "never";
else
}
});
- if (config.hasTabbrowser) {
+ if (config.has("tabbrowser")) {
let activateGroups = [
["all", "Activate everything"],
["addons", ":addo[ns] command"],
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]]),
- _("option.activate.safeSet"));
+ !(valueSet.has("all") ^ valueSet.has(group[0])),
+ _("option.safeSet", "activate"));
return newValues;
}
});
}
prefs.safeSet("browser.link.open_newwindow", open,
- _("option.popups.safeSet"));
+ _("option.safeSet", "popups"));
prefs.safeSet("browser.link.open_newwindow.restriction", restriction,
- _("option.popups.safeSet"));
+ _("option.safeSet", "popups"));
return values;
},
values: {
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et: