mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-04 04:45:46 +01:00
Fix inherited CSS output in dactyl.exportHelp.
This commit is contained in:
@@ -745,7 +745,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
let data = [h for (h in highlight) if (set.has(styles, h.class) || /^Help/.test(h.class))]
|
let data = [h for (h in highlight) if (set.has(styles, h.class) || /^Help/.test(h.class))]
|
||||||
.map(function (h) h.selector
|
.map(function (h) h.selector
|
||||||
.replace(/^\[.*?=(.*?)\]/, ".hl-$1")
|
.replace(/^\[.*?=(.*?)\]/, ".hl-$1")
|
||||||
.replace(/html\|/, "") + "\t" + "{" + h.value + "}")
|
.replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}")
|
||||||
.join("\n");
|
.join("\n");
|
||||||
addDataEntry("help.css", data.replace(/chrome:[^ ")]+\//g, ""));
|
addDataEntry("help.css", data.replace(/chrome:[^ ")]+\//g, ""));
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,9 @@ defineModule("highlight", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var Highlight = Struct("class", "selector", "sites",
|
var Highlight = Struct("class", "selector", "sites",
|
||||||
"defaultExtends", "default",
|
"defaultExtends", "defaultValue",
|
||||||
"value", "extends",
|
"value", "extends", "agent",
|
||||||
"agent", "base", "baseClass",
|
"base", "baseClass", "style");
|
||||||
"style");
|
|
||||||
Highlight.liveProperty = function (name, prop) {
|
Highlight.liveProperty = function (name, prop) {
|
||||||
this.prototype.__defineGetter__(name, function () this.get(name));
|
this.prototype.__defineGetter__(name, function () this.get(name));
|
||||||
this.prototype.__defineSetter__(name, function (val) {
|
this.prototype.__defineSetter__(name, function (val) {
|
||||||
@@ -51,9 +50,9 @@ Highlight.defaultValue("style", function ()
|
|||||||
styles.system.add("highlight:" + this.class, this.sites, this.css, this.agent, true));
|
styles.system.add("highlight:" + this.class, this.sites, this.css, this.agent, true));
|
||||||
|
|
||||||
Highlight.defaultValue("defaultExtends", function () []);
|
Highlight.defaultValue("defaultExtends", function () []);
|
||||||
Highlight.defaultValue("default", function () "");
|
Highlight.defaultValue("defaultValue", function () "");
|
||||||
Highlight.defaultValue("extends", function () this.defaultExtends);
|
Highlight.defaultValue("extends", function () this.defaultExtends);
|
||||||
Highlight.defaultValue("value", function () this.default);
|
Highlight.defaultValue("value", function () this.defaultValue);
|
||||||
|
|
||||||
update(Highlight.prototype, {
|
update(Highlight.prototype, {
|
||||||
get base() this.baseClass != this.class && highlight.highlight[this.baseClass] || null,
|
get base() this.baseClass != this.class && highlight.highlight[this.baseClass] || null,
|
||||||
@@ -65,14 +64,16 @@ update(Highlight.prototype, {
|
|||||||
return "";
|
return "";
|
||||||
try {
|
try {
|
||||||
this.gettingCSS = true;
|
this.gettingCSS = true;
|
||||||
return this.bases.map(function (b) (b.inheritedCSS + b.value).replace(/;?\s*$/, "; ")).join("");
|
return this.bases.map(function (b) b.cssText.replace(/;?\s*$/, "; ")).join("");
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this.gettingCSS = false;
|
this.gettingCSS = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
get css() this.selector + "{" + this.inheritedCSS + this.value + "}",
|
get css() this.selector + "{" + this.cssText + "}",
|
||||||
|
|
||||||
|
get cssText() this.inheritedCSS + this.value,
|
||||||
|
|
||||||
toString: function () "Highlight(" + this.class + ")\n\t" +
|
toString: function () "Highlight(" + this.class + ")\n\t" +
|
||||||
[k + ": " + String.quote(v) for ([k, v] in this)] .join("\n\t")
|
[k + ": " + String.quote(v) for ([k, v] in this)] .join("\n\t")
|
||||||
@@ -112,7 +113,7 @@ var Highlights = Module("Highlight", {
|
|||||||
|
|
||||||
if (/^[[>+: ]/.test(args[1]))
|
if (/^[[>+: ]/.test(args[1]))
|
||||||
obj.selector = this.selector(obj.class) + args[1];
|
obj.selector = this.selector(obj.class) + args[1];
|
||||||
if (old && old.value != old.default)
|
if (old && old.value != old.defaultValue)
|
||||||
obj.value = old.value;
|
obj.value = old.value;
|
||||||
|
|
||||||
if (!old && obj.base && obj.base.style.enabled)
|
if (!old && obj.base && obj.base.style.enabled)
|
||||||
@@ -147,13 +148,13 @@ var Highlights = Module("Highlight", {
|
|||||||
if (/^\s*$/.test(newStyle))
|
if (/^\s*$/.test(newStyle))
|
||||||
newStyle = null;
|
newStyle = null;
|
||||||
if (newStyle == null && extend == null) {
|
if (newStyle == null && extend == null) {
|
||||||
if (highlight.default == null && highight.defaultExtends.length == 0) {
|
if (highlight.defaultValue == null && highight.defaultExtends.length == 0) {
|
||||||
highlight.style.enabled = false;
|
highlight.style.enabled = false;
|
||||||
delete this.loaded[highlight.class];
|
delete this.loaded[highlight.class];
|
||||||
delete this.highlight[highlight.class];
|
delete this.highlight[highlight.class];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
newStyle = highlight.default;
|
newStyle = highlight.defaultValue;
|
||||||
extends = highlight.defaultExtends;
|
extends = highlight.defaultExtends;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +343,7 @@ var Highlights = Module("Highlight", {
|
|||||||
else if (args.completeArg == 1) {
|
else if (args.completeArg == 1) {
|
||||||
let hl = highlight.get(args[0]);
|
let hl = highlight.get(args[0]);
|
||||||
if (hl)
|
if (hl)
|
||||||
context.completions = [[hl.value, "Current Value"], [hl.default || "", "Default Value"]];
|
context.completions = [[hl.value, "Current Value"], [hl.defaultValue || "", "Default Value"]];
|
||||||
context.fork("css", 0, completion, "css");
|
context.fork("css", 0, completion, "css");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -372,7 +373,7 @@ var Highlights = Module("Highlight", {
|
|||||||
literalArg: v.value
|
literalArg: v.value
|
||||||
}
|
}
|
||||||
for (v in Iterator(highlight))
|
for (v in Iterator(highlight))
|
||||||
if (v.value != v.default)
|
if (v.value != v.defaultValue)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user