]> git.donarmstrong.com Git - dactyl.git/blobdiff - pentadactyl/content/config.js
Import r6976 from upstream hg supporting Firefox up to 25.*
[dactyl.git] / pentadactyl / content / config.js
index c9ae10b3823e1d16d5f0f60657b148d3593fa893..3294cb1aee43803c04df64d778582c5c6f5a5a28 100644 (file)
@@ -21,16 +21,16 @@ var Config = Module("config", ConfigBase, {
                 function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
             checkupdates: ["Check for updates",
                 function () { window.checkForUpdates(); },
-                function () "checkForUpdates" in window],
+                () => "checkForUpdates" in window],
             cookies: ["List your cookies",
                 function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
-            console: ["JavaScript console",
-                function () { window.toJavaScriptConsole(); }],
+            console: ["Browser console",
+                function () { window.HUDService.toggleBrowserConsole(); }],
             customizetoolbar: ["Customize the Toolbar",
                 function () { window.BrowserCustomizeToolbar(); }],
             dominspector: ["DOM Inspector",
                 function () { window.inspectDOMDocument(window.content.document); },
-                function () "inspectDOMDocument" in window],
+                () => "inspectDOMDocument" in window],
             downloads: ["Manage Downloads",
                 function () { window.BrowserDownloadsUI(); }],
             history: ["List your history",
@@ -63,11 +63,13 @@ var Config = Module("config", ConfigBase, {
                 function () { modules.buffer.viewSelectionSource(); }],
             venkman: ["The JavaScript debugger",
                 function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); window.start_venkman() },
-                function () "start_venkman" in window]
+                () => "start_venkman" in window]
         },
 
         removeTab: function removeTab(tab) {
-            if (this.tabbrowser.mTabs.length > 1)
+            if (window.gInPrintPreviewMode)
+                window.PrintUtils.exitPrintPreview();
+            else if (this.tabbrowser.mTabs.length > 1)
                 this.tabbrowser.removeTab(tab);
             else {
                 if (modules.buffer.uri.spec !== "about:blank" || window.getWebNavigation().sessionHistory.count > 0) {
@@ -77,22 +79,12 @@ var Config = Module("config", ConfigBase, {
                 else
                     dactyl.beep();
             }
-        },
-
-        get tempFile() {
-            let prefix = this.name;
-            try {
-                prefix += "-" + window.content.document.location.hostname;
-            }
-            catch (e) {}
-
-            return prefix + ".txt";
         }
     })
 
 }, {
 }, {
-    commands: function (dactyl, modules, window) {
+    commands: function initCommands(dactyl, modules, window) {
         const { commands, completion, config } = modules;
         const { document } = window;
 
@@ -203,7 +195,7 @@ var Config = Module("config", ConfigBase, {
                 privateData: true
             });
     },
-    completion: function (dactyl, modules, window) {
+    completion: function initCompletion(dactyl, modules, window) {
         const { CompletionContext, bookmarkcache, completion } = modules;
         const { document } = window;
 
@@ -219,10 +211,11 @@ var Config = Module("config", ConfigBase, {
         completion.sidebar = function sidebar(context) {
             let menu = document.getElementById("viewSidebarMenu");
             context.title = ["Sidebar Panel"];
-            context.completions = Array.map(menu.childNodes, function (n) [n.getAttribute("label"), ""]);
+            context.completions = Array.filter(menu.childNodes, n => n.hasAttribute("label"))
+                                       .map(n => [n.getAttribute("label"), ""]);
         };
     },
-    events: function (dactyl, modules, window) {
+    events: function initEvents(dactyl, modules, window) {
         modules.events.listen(window, "SidebarFocused", function (event) {
             modules.config.lastSidebar = window.document.getElementById("sidebar-box")
                                                .getAttribute("sidebarcommand");
@@ -233,9 +226,9 @@ var Config = Module("config", ConfigBase, {
         mappings.add([modes.NORMAL],
                      ["<Return>", "<Up>", "<Down>"],
                      "Handled by " + config.host,
-                     function () Events.PASS_THROUGH);
+                     () => Events.PASS_THROUGH);
     },
-    options: function (dactyl, modules, window) {
+    options: function initOptions(dactyl, modules, window) {
         modules.options.add(["online"],
             "Enables or disables offline mode",
             "boolean", true,
@@ -250,4 +243,4 @@ var Config = Module("config", ConfigBase, {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et: