mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-16 05:35:45 +01:00
Refactor the Styles API and implimentation slightly. Move deprecated() to base.jsm.
This commit is contained in:
@@ -55,14 +55,25 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
|
||||
// FIXME: Only works for Pentadactyl
|
||||
get activeWindow() services.windowMediator.getMostRecentWindow("navigator:browser"),
|
||||
dactyl: {
|
||||
__noSuchMethod__: function (meth, args) {
|
||||
let win = util.activeWindow;
|
||||
if (win && win.dactyl)
|
||||
return win.dactyl[meth].apply(win.dactyl, args);
|
||||
return null;
|
||||
dactyl: update(function dactyl(obj) {
|
||||
if (obj)
|
||||
var global = Class.objectGlobal(obj);
|
||||
return {
|
||||
__noSuchMethod__: function (meth, args) {
|
||||
let win = util.activeWindow;
|
||||
var dactyl = global && global.dactyl || win && win.dactyl;
|
||||
if (!win)
|
||||
return null;
|
||||
|
||||
let prop = dactyl[meth];
|
||||
if (callable(prop))
|
||||
return prop.apply(dactyl, args);
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
},
|
||||
}, {
|
||||
__noSuchMethod__: function () this().__noSuchMethod__.apply(null, arguments)
|
||||
}),
|
||||
|
||||
/**
|
||||
* Registers a obj as a new observer with the observer service. obj.observe
|
||||
@@ -1235,6 +1246,16 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
}
|
||||
},
|
||||
|
||||
urlPath: function urlPath(url) {
|
||||
url = (url || "unknown").replace(/.* -> /, "");
|
||||
try {
|
||||
return util.getFile(url).path;
|
||||
}
|
||||
catch (e) {
|
||||
return url;
|
||||
}
|
||||
},
|
||||
|
||||
visibleHosts: function (win) {
|
||||
let res = [], seen = {};
|
||||
(function rec(frame) {
|
||||
|
||||
Reference in New Issue
Block a user