Skip to content

Commit f211f94

Browse files
committed
Prpare for help screens
1 parent 184f862 commit f211f94

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

iwsy/iwsy.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,9 @@ const IWSY = (player, text) => {
568568
if (step.title) {
569569
document.title = step.title;
570570
}
571+
if (step.css) {
572+
setHeadStyle(step.css.split(`%0a`).join(`\n`));
573+
}
571574
const aspect = step[`aspect ratio`];
572575
if (aspect) {
573576
const colon = aspect.indexOf(`:`);
@@ -829,6 +832,7 @@ const IWSY = (player, text) => {
829832
}
830833
}
831834
var style = document.createElement('style');
835+
style.className = `iwsy-css`;
832836
style.innerHTML = `${styleName} ${styleValue}`;
833837
document.head.appendChild(style);
834838
};
@@ -843,6 +847,10 @@ const IWSY = (player, text) => {
843847
script.singleStep = true;
844848
script.labels = {};
845849
script.stop = false;
850+
const styles = document.getElementsByClassName("iwsy-css");
851+
for (const style of styles) {
852+
style.parentNode.removeChild(style);
853+
}
846854
for (const block of script.blocks) {
847855
const element = block.element;
848856
if (typeof element !== `undefined`) {
@@ -935,8 +943,6 @@ const IWSY = (player, text) => {
935943
if (script.runMode === `auto`) {
936944
document.addEventListener(`click`, onClick);
937945
}
938-
setHeadStyle(`p`, `{margin:0 0 0.5em 0}`)
939-
setHeadStyle(`h1, h2, h3, h4, h5, h6`, `{margin:0}`)
940946
setupShowdown();
941947
initScript();
942948
IWSY.plugins = {};

iwsy/resources/icon/help.png

15.5 KB
Loading

0 commit comments

Comments
 (0)