]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/content/marks.js
Import r6976 from upstream hg supporting Firefox up to 25.*
[dactyl.git] / common / content / marks.js
index 8131e2963b51bfa31db0e4d477fdc51f349a532d..cfa27bf30b90ee25346974e3bc79851aa8a40aef 100644 (file)
@@ -1,6 +1,6 @@
 // Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
 // Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 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.
@@ -30,16 +30,14 @@ var Marks = Module("marks", {
      */
     get all() iter(this._localMarks.get(this.localURI) || {},
                    this._urlMarks
-                  ).sort(function (a, b) String.localeCompare(a[0], b[0])),
+                  ).sort((a, b) => String.localeCompare(a[0], b[0])),
 
     get localURI() buffer.focusedFrame.document.documentURI.replace(/#.*/, ""),
 
-    Mark: function Mark(params) {
+    Mark: function Mark(params = {}) {
         let win = buffer.focusedFrame;
         let doc = win.document;
 
-        params = params || {};
-
         params.location = doc.documentURI.replace(/#.*/, ""),
         params.offset = buffer.scrollPosition;
         params.path = DOM(buffer.findScrollable(0, false)).xpath;
@@ -137,7 +135,7 @@ var Marks = Module("marks", {
         let store = buffer.localStore;
         return {
             index: store.jumpsIndex,
-            locations: store.jumps.map(function (j) j.mark)
+            locations: store.jumps.map(j => j.mark)
         };
     },
 
@@ -260,7 +258,7 @@ var Marks = Module("marks", {
 
         if (filter.length > 0) {
             let pattern = util.charListToRegexp(filter, "a-zA-Z");
-            marks = marks.filter(function ([k, ]) pattern.test(k));
+            marks = marks.filter(([k]) => (pattern.test(k)));
             dactyl.assert(marks.length > 0, _("mark.noMatching", filter.quote()));
         }
 
@@ -376,9 +374,9 @@ var Marks = Module("marks", {
             function percent(i) Math.round(i * 100);
 
             context.title = ["Mark", "HPos VPos File"];
-            context.keys.description = function ([, m]) (m.offset ? Math.round(m.offset.x) + " " + Math.round(m.offset.y)
-                                                                  : percent(m.position.x) + "% " + percent(m.position.y) + "%"
-                                                        ) + " " + m.location;
+            context.keys.description = ([, m]) => (m.offset ? Math.round(m.offset.x) + " " + Math.round(m.offset.y)
+                                                            : percent(m.position.x) + "% " + percent(m.position.y) + "%"
+                                                  ) + " " + m.location;
             context.completions = marks.all;
         };
     },