Skip to content

Dev #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2020
Merged

Dev #116

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Prpare for help screens
  • Loading branch information
graham-trott committed Jun 10, 2020
commit f211f94ab3adc5e240f00232768b3921c7421693
10 changes: 8 additions & 2 deletions iwsy/iwsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ const IWSY = (player, text) => {
if (step.title) {
document.title = step.title;
}
if (step.css) {
setHeadStyle(step.css.split(`%0a`).join(`\n`));
}
const aspect = step[`aspect ratio`];
if (aspect) {
const colon = aspect.indexOf(`:`);
Expand Down Expand Up @@ -829,6 +832,7 @@ const IWSY = (player, text) => {
}
}
var style = document.createElement('style');
style.className = `iwsy-css`;
style.innerHTML = `${styleName} ${styleValue}`;
document.head.appendChild(style);
};
Expand All @@ -843,6 +847,10 @@ const IWSY = (player, text) => {
script.singleStep = true;
script.labels = {};
script.stop = false;
const styles = document.getElementsByClassName("iwsy-css");
for (const style of styles) {
style.parentNode.removeChild(style);
}
for (const block of script.blocks) {
const element = block.element;
if (typeof element !== `undefined`) {
Expand Down Expand Up @@ -935,8 +943,6 @@ const IWSY = (player, text) => {
if (script.runMode === `auto`) {
document.addEventListener(`click`, onClick);
}
setHeadStyle(`p`, `{margin:0 0 0.5em 0}`)
setHeadStyle(`h1, h2, h3, h4, h5, h6`, `{margin:0}`)
setupShowdown();
initScript();
IWSY.plugins = {};
Expand Down
Binary file added iwsy/resources/icon/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.