Oh, I'm in a magic place!

Back to where it all started...

<% if (s.PEOPLE_WATCHING === undefined && true) { s.PEOPLE_WATCHING = 0; } $(function() { $("#go-square").on('click', function() { alert('Going to the square...'); story.showSnippet('Square'); }); }); %>

Hello niece and nephew!

I will try to go to a magic place but also to the Castle. Ok?

But I was also thinking of going to the Square.

There are <%= s.PEOPLE_WATCHING %> people watching you right now...


Also, the story code set INIT_VAR to <%= s.INIT_VAR %>!

Oh, I'm in the square!

Nothing at all here...

Back to where it all started...

Oh, I'm in the castle!

I've found another person to watch me! Yay!

Back to the beginning!

<% s.PEOPLE_WATCHING++ %>
if (s.INIT_VAR === undefined && true) s.INIT_VAR = 42; alert("This should run only once: " + s.INIT_VAR.toString()); s.INIT_VAR++; $(function () { // append a new paragraph to the snippet output $("#iff-snippet").append("<p>Story script loaded</p>"); });
if (s.GLU === undefined) s.GLU = 1; else s.GLU++; f.say = function (msg) { $("#iff-snippet").append(`<strong>${msg}</strong>`); }; $(function () { // append a new paragraph to the snippet output $("#iff-snippet").append( `<p id="glu">Global script loaded ${s.GLU} times!</p>` ); $("#glu").css("border", "1px solid yellow"); });
if (s.WILD_VISITS === undefined && true) s.WILD_VISITS = 1; else s.WILD_VISITS++; $(function () { alert( "The wild is a dangerous place! Watch out for bears! Times visited the wild: " + s.WILD_VISITS + "." ); });
s.LALA = "MP1"; $(function () { $("#iff-snippet").append( `<p style="border: 2px dashed yellow">It's a hi from ` + s.LALA + "!.</p>" ); });
s.LOLO = "MP2"; $(function () { $("#iff-snippet").append( `<p style="border: 2px dashed yellow">It's a hi from ` + s.LOLO + "!.</p>" ); });
if (s.CASTLE_VISITS === undefined) s.CASTLE_VISITS = 1; else s.CASTLE_VISITS++; $(function () { $("#iff-snippet").append( `<p style="border: 2px dashed red">It's a castle! You have visited the castle ` + s.CASTLE_VISITS + " times.</p>" ); });
s.BOTH_TAGS = "both tags"; $(function () { $("#iff-snippet").append( `<p style="border: 2px dashed magenta"> ${s.BOTH_TAGS} work!.</p>` ); f.say("GLOBAL FUNCTIONS WORK!"); });
body { background-color: green; }
body { background-color: pink; } #iff-snippet { background-color: violet; }