]> git.donarmstrong.com Git - dactyl.git/blobdiff - pentadactyl/content/config.js
Import 1.0rc1 supporting Firefox up to 11.*
[dactyl.git] / pentadactyl / content / config.js
index 6c52b2ca60db7b95f7b387b9f5824ed7553def43..c9ae10b3823e1d16d5f0f60657b148d3593fa893 100644 (file)
@@ -7,19 +7,9 @@
 "use strict";
 
 var Config = Module("config", ConfigBase, {
-    name: "pentadactyl",
-    appName: "Pentadactyl",
-    idName: "PENTADACTYL",
-    host: "Firefox",
-    hostbin: "firefox",
-
-    commandContainer: "browser-bottombox",
-
     Local: function Local(dactyl, modules, window)
         let ({ config } = modules) ({
 
-        completers: Class.memoize(function () update({ sidebar: "sidebar", window: "window" }, this.__proto__.completers)),
-
         dialogs: {
             about: ["About Firefox",
                 function () { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
@@ -42,11 +32,9 @@ var Config = Module("config", ConfigBase, {
                 function () { window.inspectDOMDocument(window.content.document); },
                 function () "inspectDOMDocument" in window],
             downloads: ["Manage Downloads",
-                function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
+                function () { window.BrowserDownloadsUI(); }],
             history: ["List your history",
                 function () { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }],
-            import: ["Import Preferences, Bookmarks, History, etc. from other browsers",
-                function () { window.BrowserImport(); }],
             openfile: ["Open the file selector dialog",
                 function () { window.BrowserOpenFileWindow(); }],
             pageinfo: ["Show information about the current page",
@@ -98,69 +86,10 @@ var Config = Module("config", ConfigBase, {
             }
             catch (e) {}
 
-            return prefix + ".tmp";
+            return prefix + ".txt";
         }
-    }),
-
-    overlayChrome: ["chrome://browser/content/browser.xul"],
-
-    styleableChrome: ["chrome://browser/content/browser.xul"],
-
-    autocommands: {
-        BookmarkAdd: "Triggered after a page is bookmarked",
-        BookmarkChange: "Triggered after a page's bookmark is changed",
-        BookmarkRemove: "Triggered after a page's bookmark is removed",
-        ColorScheme: "Triggered after a color scheme has been loaded",
-        DOMLoad: "Triggered when a page's DOM content has fully loaded",
-        DownloadPost: "Triggered when a download has completed",
-        Fullscreen: "Triggered when the browser's fullscreen state changes",
-        LocationChange: "Triggered when changing tabs or when navigation to a new location",
-        PageLoadPre: "Triggered after a page load is initiated",
-        PageLoad: "Triggered when a page gets (re)loaded/opened",
-        PrivateMode: "Triggered when private browsing mode is activated or deactivated",
-        Sanitize: "Triggered when a sanitizeable item is cleared",
-        ShellCmdPost: "Triggered after executing a shell command with :!cmd",
-        Enter: "Triggered after Firefox starts",
-        LeavePre: "Triggered before exiting Firefox, just before destroying each module",
-        Leave: "Triggered before exiting Firefox"
-    },
-
-    defaults: {
-        complete: "slf",
-        guioptions: "bCrs",
-        showtabline: "always",
-        titlestring: "Pentadactyl"
-    },
-
-    features: Set([
-        "bookmarks", "hints", "history", "marks", "quickmarks", "sanitizer",
-        "session", "tabs", "tabs_undo", "windows"
-    ]),
-
-    guioptions: {
-        m: ["Menubar",      ["toolbar-menubar"]],
-        T: ["Toolbar",      ["nav-bar"]],
-        B: ["Bookmark bar", ["PersonalToolbar"]]
-    },
-
-    hasTabbrowser: true,
-
-    scripts: [
-        "browser",
-        "bookmarkcache",
-        "bookmarks",
-        "history",
-        "quickmarks",
-        "sanitizer",
-        "tabs"
-    ],
+    })
 
-    sidebars: {
-        viewAddons:      ["Add-ons",     "A", "chrome://mozapps/content/extensions/extensions.xul"],
-        viewConsole:     ["Console",     "C", "chrome://global/content/console.xul"],
-        viewDownloads:   ["Downloads",   "D", "chrome://mozapps/content/downloads/downloads.xul"],
-        viewPreferences: ["Preferences", "P", "about:config"]
-    }
 }, {
 }, {
     commands: function (dactyl, modules, window) {
@@ -242,8 +171,8 @@ var Config = Module("config", ConfigBase, {
         commands.add(["wind[ow]"],
             "Execute a command and tell it to output in a new window",
             function (args) {
-                dactyl.withSavedValues(["forceNewWindow"], function () {
-                    this.forceNewWindow = true;
+                dactyl.withSavedValues(["forceTarget"], function () {
+                    this.forceTarget = dactyl.NEW_WINDOW;
                     this.execute(args[0], null, true);
                 });
             },
@@ -278,55 +207,12 @@ var Config = Module("config", ConfigBase, {
         const { CompletionContext, bookmarkcache, completion } = modules;
         const { document } = window;
 
-        var searchRunning = null; // only until Firefox fixes https://bugzilla.mozilla.org/show_bug.cgi?id=510589
         completion.location = function location(context) {
-            if (!services.autoCompleteSearch)
-                return;
-
-            if (searchRunning) {
-                searchRunning.completions = searchRunning.completions;
-                searchRunning.cancel();
-            }
-
-            context.anchored = false;
-            context.compare = CompletionContext.Sort.unsorted;
-            context.filterFunc = null;
-
-            let words = context.filter.toLowerCase().split(/\s+/g);
-            context.hasItems = true;
-            context.completions = context.completions.filter(function ({ url, title })
-                words.every(function (w) (url + " " + title).toLowerCase().indexOf(w) >= 0))
-            context.incomplete = true;
-
-            context.format = modules.bookmarks.format;
-            context.keys.extra = function (item) (bookmarkcache.get(item.url) || {}).extra;
+            completion.autocomplete("history", context);
             context.title = ["Smart Completions"];
-
-            context.cancel = function () {
-                this.incomplete = false;
-                if (searchRunning === this) {
-                    services.autoCompleteSearch.stopSearch();
-                    searchRunning = null;
-                }
-            };
-
-            services.autoCompleteSearch.startSearch(context.filter, "", context.result, {
-                onSearchResult: function onSearchResult(search, result) {
-                    if (result.searchResult <= result.RESULT_SUCCESS)
-                        searchRunning = null;
-
-                    context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING;
-                    context.completions = [
-                        { url: result.getValueAt(i), title: result.getCommentAt(i), icon: result.getImageAt(i) }
-                        for (i in util.range(0, result.matchCount))
-                    ];
-                },
-                get onUpdateSearchResult() this.onSearchResult
-            });
-            searchRunning = context;
         };
 
-        completion.addUrlCompleter("l",
+        completion.addUrlCompleter("location",
             "Firefox location bar entries (bookmarks and history sorted in an intelligent way)",
             completion.location);
 
@@ -345,17 +231,13 @@ var Config = Module("config", ConfigBase, {
     mappings: function initMappings(dactyl, modules, window) {
         const { Events, mappings, modes } = modules;
         mappings.add([modes.NORMAL],
-                     ["<Return>", "<Space>", "<Up>", "<Down>"],
+                     ["<Return>", "<Up>", "<Down>"],
                      "Handled by " + config.host,
                      function () Events.PASS_THROUGH);
     },
-    modes: function (dactyl, modules, window) {
-        const { modes } = modules;
-        config.modes.forEach(function (mode) { modes.addMode.apply(this, mode); });
-    },
     options: function (dactyl, modules, window) {
         modules.options.add(["online"],
-            "Set the 'work offline' option",
+            "Enables or disables offline mode",
             "boolean", true,
             {
                 setter: function (value) {