]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/content/tabs.js
Import r6923 from upstream hg supporting Firefox up to 22.0a1
[dactyl.git] / common / content / tabs.js
index 9b906607ecd12af76702e686cbd9c99fb37b6ac8..fb155db8d36539cf5a309521d74ba06cfdb49c6e 100644 (file)
@@ -1,10 +1,10 @@
 // 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-2012 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.
-/* use strict */
+"use strict";
 
 /** @scope modules */
 
@@ -35,9 +35,9 @@ var Tabs = Module("tabs", {
             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) config.OS.isMacOSX ? "tab-mac" : m),
+            */).replace(/tab-./g, function (m) config.OS.isMacOSX ? "tab-mac" : m),
             false, true);
 
         this.timeout(function () {
@@ -78,10 +78,14 @@ var Tabs = Module("tabs", {
                 if (!node("dactyl-tab-number")) {
                     let img = node("tab-icon-image");
                     if (img) {
-                        let dom = DOM(<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>.elements(), document).appendTo(img.parentNode);
+                        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),
@@ -235,8 +239,8 @@ var Tabs = Module("tabs", {
         if (func)
             func = bind(function (func) { func(this._groups) }, this, func);
 
-        if (window.TabView && TabView._initFrame)
-            TabView._initFrame(func);
+        if (window.TabView && window.TabView._initFrame)
+            window.TabView._initFrame(func);
 
         this._groups = iframe ? iframe.contentWindow : null;
         if (this._groups && !func)
@@ -596,10 +600,10 @@ var Tabs = Module("tabs", {
         services.sessionStore.setTabState(to, tabState);
     }
 }, {
-    load: function init_load() {
+    load: function initLoad() {
         tabs.updateTabCount();
     },
-    commands: function init_commands() {
+    commands: function initCommands() {
         [
             {
                 name: ["bd[elete]"],
@@ -1015,7 +1019,7 @@ var Tabs = Module("tabs", {
                 { argCount: "0" });
         }
     },
-    completion: function init_completion() {
+    completion: function initCompletion() {
 
         completion.buffer = function buffer(context, visible) {
             let { tabs } = modules;
@@ -1035,10 +1039,11 @@ var Tabs = Module("tabs", {
                 group[1].push([i, tab.linkedBrowser]);
             });
 
-            context.pushProcessor(0, function (item, text, next) <>
-                <span highlight="Indicator" style="display: inline-block;">{item.indicator}</span>
-                { next.call(this, item, text) }
-            </>);
+            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;
@@ -1096,7 +1101,7 @@ var Tabs = Module("tabs", {
             };
         };
     },
-    events: function init_events() {
+    events: function initEvents() {
         let tabContainer = config.tabbrowser.mTabContainer;
         function callback() {
             tabs.timeout(function () { this.updateTabCount(); });
@@ -1105,7 +1110,7 @@ var Tabs = Module("tabs", {
             events.listen(tabContainer, event, callback, false);
         events.listen(tabContainer, "TabSelect", tabs.closure._onTabSelect, false);
     },
-    mappings: function init_mappings() {
+    mappings: function initMappings() {
 
         mappings.add([modes.COMMAND], ["<C-t>", "<new-tab-next>"],
             "Execute the next mapping in a new tab",
@@ -1199,7 +1204,7 @@ var Tabs = Module("tabs", {
                 { count: true });
         }
     },
-    options: function init_options() {
+    options: function initOptions() {
         options.add(["showtabline", "stal"],
             "Define when the tab bar is visible",
             "string", true,