@@ -568,6 +568,9 @@ const IWSY = (player, text) => {
568
568
if ( step . title ) {
569
569
document . title = step . title ;
570
570
}
571
+ if ( step . css ) {
572
+ setHeadStyle ( step . css . split ( `%0a` ) . join ( `\n` ) ) ;
573
+ }
571
574
const aspect = step [ `aspect ratio` ] ;
572
575
if ( aspect ) {
573
576
const colon = aspect . indexOf ( `:` ) ;
@@ -829,6 +832,7 @@ const IWSY = (player, text) => {
829
832
}
830
833
}
831
834
var style = document . createElement ( 'style' ) ;
835
+ style . className = `iwsy-css` ;
832
836
style . innerHTML = `${ styleName } ${ styleValue } ` ;
833
837
document . head . appendChild ( style ) ;
834
838
} ;
@@ -843,6 +847,10 @@ const IWSY = (player, text) => {
843
847
script . singleStep = true ;
844
848
script . labels = { } ;
845
849
script . stop = false ;
850
+ const styles = document . getElementsByClassName ( "iwsy-css" ) ;
851
+ for ( const style of styles ) {
852
+ style . parentNode . removeChild ( style ) ;
853
+ }
846
854
for ( const block of script . blocks ) {
847
855
const element = block . element ;
848
856
if ( typeof element !== `undefined` ) {
@@ -935,8 +943,6 @@ const IWSY = (player, text) => {
935
943
if ( script . runMode === `auto` ) {
936
944
document . addEventListener ( `click` , onClick ) ;
937
945
}
938
- setHeadStyle ( `p` , `{margin:0 0 0.5em 0}` )
939
- setHeadStyle ( `h1, h2, h3, h4, h5, h6` , `{margin:0}` )
940
946
setupShowdown ( ) ;
941
947
initScript ( ) ;
942
948
IWSY . plugins = { } ;
0 commit comments