]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/modules/template.jsm
Import r6948 from upstream hg supporting Firefox up to 24.*
[dactyl.git] / common / modules / template.jsm
index 47fd94db2214804890fd76f9f85f26bdd788570b..b9f5fda9b7ba6a7f7010be5e09a402038467b306 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 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.
@@ -168,7 +168,6 @@ var Template = Module("Template", {
         return res;
     },
 
-
     bookmarkDescription: function (item, text) [
         !(item.extra && item.extra.length) ? [] :
         ["span", { highlight: "URLExtra" },
@@ -264,7 +263,6 @@ var Template = Module("Template", {
         })(), this[help ? "HelpLink" : "helpLink"]);
     },
 
-
     // Fixes some strange stack rewinds on NS_ERROR_OUT_OF_MEMORY
     // exceptions that we can't catch.
     stringify: function stringify(arg) {
@@ -417,7 +415,6 @@ var Template = Module("Template", {
                                 util.losslessDecodeURI(val.URI.spec)]]])];
     },
 
-
     options: function options(title, opts, verbose) {
         return ["table", {},
                 ["tr", { highlight: "Title", align: "left" },
@@ -459,26 +456,24 @@ var Template = Module("Template", {
     },
 
     tabular: function tabular(headings, style, iter) {
-        let self = this;
         // TODO: This might be mind-bogglingly slow. We'll see.
         return ["table", {},
             ["tr", { highlight: "Title", align: "left" },
                 this.map(headings, function (h)
                     ["th", {}, h])],
-            this.map(iter, function (row)
+            this.map(iter, (row) =>
                 ["tr", {},
-                    self.map(Iterator(row), function ([i, d])
+                    this.map(Iterator(row), function ([i, d])
                         ["td", { style: style[i] || "" }, d])])];
     },
 
     usage: function usage(iter, format) {
-        let self = this;
 
         format = format || {};
-        let desc = format.description || function (item) self.linkifyHelp(item.description);
-        let help = format.help || function (item) item.name;
-        function sourceLink(frame) {
-            let source = self.sourceLink(frame);
+        let desc = format.description || (item => this.linkifyHelp(item.description));
+        let help = format.help || (item => item.name);
+        let sourceLink = (frame) => {
+            let source = this.sourceLink(frame);
             source[1]["dactyl:hint"] = source[2];
             return source;
         }
@@ -486,29 +481,29 @@ var Template = Module("Template", {
             format.headings ?
                 ["thead", { highlight: "UsageHead" },
                     ["tr", { highlight: "Title", align: "left" },
-                        this.map(format.headings, function (h) ["th", {}, h])]] :
+                        this.map(format.headings, (h) => ["th", {}, h])]] :
                 [],
             format.columns ?
                 ["colgroup", {},
-                    this.map(format.columns, function (c) ["col", { style: c }])] :
+                    this.map(format.columns, (c) => ["col", { style: c }])] :
                 [],
             ["tbody", { highlight: "UsageBody" },
-                this.map(iter, function (item)
+                this.map(iter, (item) =>
                     // Urgh.
                     let (name = item.name || item.names[0], frame = item.definedAt)
                         ["tr", { highlight: "UsageItem" },
                             ["td", { style: "padding-right: 2em;" },
                                 ["span", { highlight: "Usage Link" },
                                     !frame ? name :
-                                        [self.helpLink(help(item), name, "Title"),
+                                        [this.helpLink(help(item), name, "Title"),
                                          ["span", { highlight: "LinkInfo" },
                                             _("io.definedAt"), " ",
                                             sourceLink(frame)]]]],
-                            item.columns ? self.map(item.columns, function (c) ["td", {}, c]) : [],
-                            ["td", {}, desc(item)]])]]
+                            item.columns ? this.map(item.columns, (c) => ["td", {}, c]) : [],
+                            ["td", {}, desc(item)]])]];
     }
 });
 
 endModule();
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: