mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-14 19:15:45 +01:00
Refactor the Styles API and implimentation slightly. Move deprecated() to base.jsm.
This commit is contained in:
@@ -1741,8 +1741,8 @@ const CommandLine = Module("commandline", {
|
||||
styles: function () {
|
||||
let fontSize = util.computedStyle(document.getElementById(config.mainWindowId)).fontSize;
|
||||
styles.registerSheet("chrome://dactyl/skin/dactyl.css");
|
||||
styles.addSheet(true, "font-size", "chrome://dactyl/content/buffer.xhtml",
|
||||
"body { font-size: " + fontSize + "; }");
|
||||
styles.system.add("font-size", "chrome://dactyl/content/buffer.xhtml",
|
||||
"body { font-size: " + fontSize + "; }");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,25 +19,6 @@ const EVAL_ERROR = "__dactyl_eval_error";
|
||||
const EVAL_RESULT = "__dactyl_eval_result";
|
||||
const EVAL_STRING = "__dactyl_eval_string";
|
||||
|
||||
function deprecated(reason, fn) {
|
||||
let name, func = callable(fn) ? fn : function () this[fn].apply(this, arguments);
|
||||
function deprecatedMethod() {
|
||||
let frame = Components.stack.caller;
|
||||
let obj = this.className || this.constructor.className;
|
||||
if (!set.add(deprecatedMethod.seen, frame.filename))
|
||||
dactyl.echoerr(
|
||||
(frame.filename || "unknown").replace(/^.*? -> /, "") +
|
||||
":" + frame.lineNumber + ": " +
|
||||
(obj ? obj + "." : "") + (fn.name || name) + " is deprecated: " + reason);
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
deprecatedMethod.seen = { "chrome://dactyl/content/javascript.js": true };
|
||||
return callable(fn) ? deprecatedMethod : Class.Property({
|
||||
get: function () deprecatedMethod,
|
||||
init: function (prop) { name = prop; }
|
||||
});
|
||||
}
|
||||
|
||||
const Dactyl = Module("dactyl", {
|
||||
init: function () {
|
||||
window.dactyl = this;
|
||||
@@ -1266,9 +1247,9 @@ const Dactyl = Module("dactyl", {
|
||||
this);
|
||||
let class_ = dir.map(function (dir) "html|html > xul|scrollbar[orient=" + dir + "]");
|
||||
|
||||
styles.addSheet(true, "scrollbar", "*",
|
||||
class_.length ? class_.join(", ") + " { visibility: collapse !important; }" : "",
|
||||
true);
|
||||
styles.system.add("scrollbar", "*",
|
||||
class_.length ? class_.join(", ") + " { visibility: collapse !important; }" : "",
|
||||
true);
|
||||
|
||||
prefs.safeSet("layout.scrollbar.side", opts.indexOf("l") >= 0 ? 3 : 2,
|
||||
"See 'guioptions' scrollbar flags.");
|
||||
@@ -1285,8 +1266,8 @@ const Dactyl = Module("dactyl", {
|
||||
setter: function (opts) {
|
||||
let classes = [v[1] for ([k, v] in Iterator(this.opts)) if (opts.indexOf(k) < 0)];
|
||||
|
||||
styles.addSheet(true, "taboptions", "chrome://*",
|
||||
classes.length ? classes.join(",") + "{ display: none; }" : "");
|
||||
styles.system.add("taboptions", "chrome://*",
|
||||
classes.length ? classes.join(",") + "{ display: none; }" : "");
|
||||
},
|
||||
validator: function (opts) dactyl.has("Gecko2") ||
|
||||
Option.validIf(!/[nN]/.test(opts), "Tab numbering not available in this " + config.host + " version")
|
||||
|
||||
@@ -463,7 +463,7 @@ const Hints = Module("hints", {
|
||||
if (hint.imgSpan)
|
||||
css.push(selector + imgSpan + " { " + hint.span.style.cssText + " }");
|
||||
}
|
||||
styles.addSheet(true, "hint-positions", "*", css.join("\n"));
|
||||
styles.system.add("hint-positions", "*", css.join("\n"));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -484,7 +484,7 @@ const Hints = Module("hints", {
|
||||
for (let i in util.range(start, end + 1))
|
||||
this._setClass(this._pageHints[i].elem, null);
|
||||
}
|
||||
styles.removeSheet(true, "hint-positions");
|
||||
styles.system.remove("hint-positions");
|
||||
|
||||
this._reset(slight);
|
||||
},
|
||||
|
||||
@@ -21,7 +21,7 @@ const StatusLine = Module("statusline", {
|
||||
this.widgets.status = this.widgets.container;
|
||||
|
||||
if (this.statusBar.localName == "toolbar") {
|
||||
styles.addSheet(true, "addon-bar", config.styleableChrome, <css><![CDATA[
|
||||
styles.system.add("addon-bar", config.styleableChrome, <css><![CDATA[
|
||||
#status-bar { margin-top: 0 !important; }
|
||||
#addon-bar { padding: 0 !important; min-height: 18px !important; }
|
||||
#addon-bar > statusbar { -moz-box-flex: 1 }
|
||||
|
||||
@@ -26,7 +26,7 @@ const Tabs = Module("tabs", {
|
||||
if (config.hasTabbrowser)
|
||||
config.tabStrip.collapsed = true;
|
||||
|
||||
this.tabStyle = styles.addSheet(true, "tab-strip-hiding", config.styleableChrome,
|
||||
this.tabStyle = styles.system.add("tab-strip-hiding", config.styleableChrome,
|
||||
(config.tabStrip.id ? "#" + config.tabStrip.id : ".tabbrowser-strip") +
|
||||
"{ visibility: collapse; }",
|
||||
false, true);
|
||||
|
||||
Reference in New Issue
Block a user