]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/content/modes.js
New upstream version 1.0+hg6948
[dactyl.git] / common / content / modes.js
index 127fa95a9f89b716c4e735c556e1bc9215408813..fc33fd7f24e95d88795de024fa9d690d8a166a6a 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@gmail.com>
+// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
 //
 // 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 */
 
@@ -119,7 +119,11 @@ var Modes = Module("modes", {
             onKeyPress: function (events) { if (modes.main == modes.QUOTE) modes.pop(); }
         });
         this.addMode("IGNORE", { hidden: true }, {
-            onKeyPress: function (events) false,
+            onKeyPress: function (events_) {
+                if (events.isCancelKey(DOM.Event.stringify(events_[0])))
+                    return true;
+                return false;
+            },
             bases: [],
             passthrough: true
         });
@@ -487,7 +491,9 @@ var Modes = Module("modes", {
         update(StackElement.prototype, {
             get toStringParams() !loaded.modes ? this.main.name : [
                 this.main.name,
-                <>({ modes.all.filter(function (m) this.extended & m, this).map(function (m) m.name).join("|") })</>
+                ["(", modes.all.filter(function (m) this.extended & m, this)
+                           .map(function (m) m.name).join("|"),
+                 ")"].join("")
             ]
         });
         return StackElement;
@@ -530,23 +536,23 @@ var Modes = Module("modes", {
                 for (let base in values(mode.bases))
                     tree[base.name][mode.name] = tree[mode.name];
 
-            let roots = iter([m.name, tree[m.name]] for (m in values(list)) if (!m.bases.length)).toObject();
+            let roots = iter([m.name, tree[m.name]]
+                             for (m in values(list))
+                             if (!m.bases.length)).toObject();
 
-            default xml namespace = NS;
             function rec(obj) {
-                XML.ignoreWhitespace = XML.prettyPrinting = false;
-
-                let res = <ul dactyl:highlight="Dense" xmlns:dactyl={NS}/>;
+                let res = ["ul", { "dactyl:highlight": "Dense" }];
                 Object.keys(obj).sort().forEach(function (name) {
                     let mode = modes.getMode(name);
-                    res.* += <li><em>{mode.displayName}</em>: {mode.description}{
-                        rec(obj[name])
-                    }</li>;
+                    res.push(["li", {},
+                                ["em", {}, mode.displayName],
+                                ": ", mode.description,
+                                rec(obj[name])]);
                 });
 
-                if (res.*.length())
+                if (res.length > 2)
                     return res;
-                return <></>;
+                return [];
             }
 
             return rec(roots);
@@ -600,7 +606,7 @@ var Modes = Module("modes", {
             },
 
             setter: function (vals) {
-                modes.all.forEach(function (m) { delete m.passUnknown });
+                modes.all.forEach(function (m) { delete m.passUnknown; });
 
                 vals = vals.map(function (v) update(new String(v.toLowerCase()), {
                     mode: v.replace(/^!/, "").toUpperCase(),
@@ -628,8 +634,8 @@ var Modes = Module("modes", {
     },
     prefs: function initPrefs() {
         prefs.watch("accessibility.browsewithcaret",
-                    function () { modes.onCaretChange.apply(modes, arguments) });
+                    function () { modes.onCaretChange.apply(modes, arguments); });
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et: