mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
inject config in a better way
This commit is contained in:
parent
23e5fe2c51
commit
184744ec28
1 changed files with 9 additions and 3 deletions
|
@ -125,10 +125,16 @@ function traverseParsedHtml(node, origin?: URL) {
|
||||||
src: self.$scramjet.config["codecs"],
|
src: self.$scramjet.config["codecs"],
|
||||||
"data-scramjet": "true",
|
"data-scramjet": "true",
|
||||||
});
|
});
|
||||||
|
const config = new Element("script", {
|
||||||
|
src:
|
||||||
|
"data:application/javascript;base64," +
|
||||||
|
btoa(
|
||||||
|
`self.$scramjet.config = ${JSON.stringify(self.$scramjet.config)}; self.$scramjet.codec = self.$scramjet.codecs[self.$scramjet.config.codec];`
|
||||||
|
),
|
||||||
|
"data-scramjet": "true",
|
||||||
|
});
|
||||||
const shared = new Element("script", {
|
const shared = new Element("script", {
|
||||||
src: self.$scramjet.config["shared"],
|
src: self.$scramjet.config["shared"],
|
||||||
onload: `self.$scramjet.config = ${JSON.stringify(self.$scramjet.config)};
|
|
||||||
self.$scramjet.codec = self.$scramjet.codecs[self.$scramjet.config.codec];`,
|
|
||||||
"data-scramjet": "true",
|
"data-scramjet": "true",
|
||||||
});
|
});
|
||||||
const client = new Element("script", {
|
const client = new Element("script", {
|
||||||
|
@ -136,7 +142,7 @@ function traverseParsedHtml(node, origin?: URL) {
|
||||||
"data-scramjet": "true",
|
"data-scramjet": "true",
|
||||||
});
|
});
|
||||||
|
|
||||||
scripts.push(codecs, shared, client);
|
scripts.push(codecs, config, shared, client);
|
||||||
|
|
||||||
node.children.unshift(...scripts);
|
node.children.unshift(...scripts);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue