-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-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.
elem.removeAttributeNS(ns, name);
else
elem.setAttributeNS(ns, name, val);
-}
+};
var Overlay = Class("Overlay", {
init: function init(window) {
this.window = window;
},
- cleanups: Class.Memoize(function () []),
- objects: Class.Memoize(function () ({})),
+ cleanups: Class.Memoize(() => []),
+ objects: Class.Memoize(() => ({})),
get doc() this.window.document,
}
});
-
var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), {
init: function init() {
util.addObserver(this);
this.onWindowVisible = [];
},
- id: Class.Memoize(function () config.addon.id),
+ id: Class.Memoize(() => config.addon.id),
/**
* Adds an event listener for this session and removes it on
"content-document-global-created": function (window, uri) { this.observe(window, "toplevel-window-ready", null); },
"xul-window-visible": function () {
if (this.onWindowVisible)
- this.onWindowVisible.forEach(function (f) f.call(this), this);
+ this.onWindowVisible.forEach(f => { f.call(this); });
this.onWindowVisible = null;
}
},
return data[key] = val;
},
- overlayWindow: function (url, fn) {
+ overlayWindow: function overlayWindow(url, fn) {
if (url instanceof Ci.nsIDOMWindow)
overlay._loadOverlay(url, fn);
else {
let iterator = Iterator(obj[key]);
if (isArray(obj[key])) {
iterator = ([elem[1].id, elem.slice(2), elem[1]]
- for each (elem in obj[key]))
+ for each (elem in obj[key]));
}
for (let [elem, xml, attrs] in iterator) {
}
}
- insert("before", function (elem, dom) elem.parentNode.insertBefore(dom, elem));
- insert("after", function (elem, dom) elem.parentNode.insertBefore(dom, elem.nextSibling));
- insert("append", function (elem, dom) elem.appendChild(dom));
- insert("prepend", function (elem, dom) elem.insertBefore(dom, elem.firstChild));
+ insert("before", (elem, dom) => elem.parentNode.insertBefore(dom, elem));
+ insert("after", (elem, dom) => elem.parentNode.insertBefore(dom, elem.nextSibling));
+ insert("append", (elem, dom) => elem.appendChild(dom));
+ insert("prepend", (elem, dom) => elem.insertBefore(dom, elem.firstChild));
if (obj.ready)
util.trapErrors("ready", obj, window);
Object.defineProperty(object, k, desc);
if (callable(value)) {
- var sentinel = "(function DactylOverlay() {}())"
+ var sentinel = "(function DactylOverlay() {}())";
value.toString = function toString() toString.toString.call(this).replace(/\}?$/, sentinel + "; $&");
value.toSource = function toSource() toSource.toSource.call(this).replace(/\}?$/, sentinel + "; $&");
}
get activeModules() this.activeWindow && this.activeWindow.dactyl.modules,
- get modules() this.windows.map(function (w) w.dactyl.modules),
+ get modules() this.windows.map(w => w.dactyl.modules),
/**
* The most recently active dactyl window.
*/
get activeWindow() this.windows[0],
- set activeWindow(win) this.windows = [win].concat(this.windows.filter(function (w) w != win)),
+ set activeWindow(win) this.windows = [win].concat(this.windows.filter(w => w != win)),
/**
* A list of extant dactyl windows.
*/
- windows: Class.Memoize(function () [])
+ windows: Class.Memoize(() => [])
});
endModule();
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: