This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
forked from speced/respec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.js
55 lines (53 loc) · 2.59 KB
/
style.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Module w3c/style
// Inserts a link to the appropriate W3C style for the specification's maturity level.
// CONFIGURATION
// - specStatus: the short code for the specification's maturity level or type (required)
define(
["core/utils"],
function (utils) {
return {
run: function (conf, doc, cb, msg) {
msg.pub("start", "w3c/style");
if (!conf.specStatus) msg.pub("error", "Configuration 'specStatus' is not set, required for w3c/style");
var statStyle = conf.specStatus;
if (statStyle === "FPWD" ||
statStyle === "LC" ||
statStyle === "WD-NOTE" ||
statStyle === "LC-NOTE") statStyle = "WD";
if (statStyle === "FPWD-NOTE") statStyle = "WG-NOTE";
if (statStyle === "finding" || statStyle === "draft-finding") statStyle = "base";
var css = "https://";
if (statStyle === "unofficial") {
css += "www.w3.org/StyleSheets/TR/w3c-unofficial";
}
else if (statStyle === "base") {
css += "www.w3.org/StyleSheets/TR/base";
}
else if (statStyle === "CG-DRAFT" || statStyle === "CG-FINAL" ||
statStyle === "BG-DRAFT" || statStyle === "BG-FINAL") {
// note: normally, the ".css" is not used in W3C, but here specifically it clashes
// with a PNG of the same base name. CONNEG must die.
css += "www.w3.org/community/src/css/spec/" + statStyle.toLowerCase() + ".css";
}
else if (statStyle === "webspec") {
css = "https://specs.webplatform.org/assets/css/kraken.css";
$('<link rel="icon" href="https://specs.webplatform.org/assets/img/icon.png">', doc)
.appendTo($("head"));
$(doc.createElement("script"))
.attr({ async: "async", src: "https://specs.webplatform.org/assets/js/kraken.js"})
.appendTo($("head"))
;
}
else if (conf.useExperimentalStyles) {
css = "http://fantasai.inkedblade.net/style/design/w3c-restyle/2016/W3C-" + statStyle;
}
else {
css += "www.w3.org/StyleSheets/TR/W3C-" + statStyle;
}
utils.linkCSS(doc, css);
msg.pub("end", "w3c/style");
cb();
}
};
}
);