sidebarStartClosed: true
showControls: false
volumeDisplay: false
persistPrefs: true
preload: true
eragon: ./sons/Eragon.mp3
kneddles: ./sons/kneddles.mp3
vivantes-mortes: ./sons/lesvivantesapreslesmortes.mp3
lumiere-roumanie: ./sons/lumiereenroumanie.mp3
n1: ./sons/n1.mp3
n2: ./sons/n2.mp3
n3: ./sons/n3.mp3
note4: ./Note4.wav
note5: ./sons/Note5.mp3
silhouette: ./sons/silhouette.mp3
[[Contact]]
discussion Rares et Nathalie sur la place que l'on occupe dans la famille.
{<audio src="./sons/lesvivantesapreslesmortes.mp3" autoplay>}
[[passerSigne->SigneObservé]]
[[passerChat->Chat]]
(after:170s)[(go-to: (either: "SigneObservé", "Chat"))]
[[Mélodie]]
Quelques (hover:)[notes]<c1| de musique (hover:)[éparses]<c2| dessinent progressivement une (hover:)[mélodie maladroite]<c3|, (hover:)[touchante]<c4|.
{
(click:?c1)[(either:"(show:?n2)", "(show:?n3)", "(show:?n4)")]
(click:?c2)[(either:"(show:?n2)", "(show:?n3)", "(show:?n4)")]
(click:?c3)[(either:"(show:?n2)", "(show:?n3)", "(show:?n4)")]
(click-append:?c4)[{<audio src="./sons/Eragon.mp3" autoplay>}(live:60s)[(go-to:"Générique")]]
[{<audio src="./sons/n1.mp3"./sons/ autoplay>}(live:1.5s)[{<audio src="n1.mp3" autoplay>}]](n2|
[{<audio src="./sons/n2.mp3"./sons/ autoplay>}(live:1.9s)[{<audio src="n2.mp3" autoplay>}]](n3|
[{<audio src="./sons/n3.mp3"./sons/ autoplay>}(live:2.1s)[{<audio src="n1.mp3" autoplay>}]](n4|
}
[[Foyer]]
Vous êtes au milieu de là où vous vivez. Sentez-vous une présence qui vous habite ? Vous avez peut-être de la peine. Pouvez-vous tourner la clé, ouvrir le cadenas. Pouvez-vous laisser sortir celle ou celui qui vous hante ? L’imaginer en dehors de vous ?
D’où vous êtes, vous voyez, ou entrevoyez, un robinet, un lit, une ouverture vers l’extérieur, la [[table->Manger]]…
[[Générique]]
(t8n:"slide-up")+(t8n-time:3s)[Un projet d'écriture ludique documentaire
écrit par
avec la participation de
produit par
soutenu par?!
son
code]
[[Recommencer->Introduction]]
(end:)[FIN]
Le récit qui s'amorce est une (hover:)[histoire]<c1| qui ne (hover:)[finira pas]<c2|.
[]<c5|
<!-- {(click: ?c1)[(replace:?c1)[trace]] -->
{(click: ?c1)[(replace:?c1)[trace]]
(click: ?c2)[(replace:?c5)[Nous avons pris le temps d'instaurer des (hover:)[présences]<c3| durant un [(end:)[workshop]] de trois jours.]]
(click: ?c3)[Ces présences nous accompagnent aujourd'hui encore.]}
[[Table]]
[Quelqu'un·e vous a préparé (hover:)[ce plat]<c1| qu’iel vous préparait.
{
[Vous sortez une fourchette, une (hover:)[assiette.]<c22|](c2|
(click-replace:?c1)[les kneddles(show:?c2)(show:?c23)]
(click-append:?c22)[ Vous piquez dans un (hover:)[kneddle.]<c3|]
(click-append:?c3)[[ Vous le manger sans y penser.]<c4|]
(click-replace:?c4)[[ <br>Puis un souvenir sous forme de texture émerge, et votre [bouche]<c55| s'arrête. ]<c5|]
(click:?c55)[(replace:?c5)[<br>Chaque [bouchée]<c6| devient un nouveau souvenir, en mémoire d’el·lui.]]
(click:?c6)[(replace:?c0)[Un instant, vous vous souvenez de son goût de vivant·e pour ce plat. (after:20s)[<br>Vous habitez ce goût au [[présent->Message]]. ]]]
}]<c0|
[{<audio src="./sons/kneddles.mp3" autoplay>}](c23|
[[Contact]]
(t8n:"fade-down")+(t8n-time:3s)[Il est 15h.]<c1|
(t8n:"fade-down")+(t8n-time:5s)[Vous regardez votre téléphone.]<c2|
(t8n:"fade-down")+(t8n-time:8s)[Il pourrait vous servir à répondre ou appeler un membre de votre famille.]<c3|
(t8n:"fade-down")+(t8n-time:14s)[Vous réfléchissez à ce qu’une disparition fait à la constellation familiale.]<c4|
(t8n:"fade-down")+(t8n-time:16s)[Quelle est votre place ?]<c5|
(t8n:"fade-down")+(t8n-time:19s)[Quelle sera votre place ?]<c6|
(t8n:"fade-down")+(t8n-time:25s)[Vous émettez un souhait. Vous le prononcez à haute voix.
Vous décidez qu’il peut être [[entendu->Alea]] par les membres de votre famille.]<c7|
<!-- definition macro custom -->
(set: $fadeout to (macro: str-type _hookName, num-type _duration, [
(set: _output to "<script>$('tw-hook[name=\"" + _hookName + "\"]').css({opacity: 0, transition: \"opacity " + (str: _duration) + "s ease\"})</script>")
(output: )[_output]
]))
{
(after:12s)[($fadeout:"c1", 7)]
(after:16s)[($fadeout:"c2", 9)]
(after:20s)[($fadeout:"c3", 10)]
(after:28s)[($fadeout:"c4", 12)]
(after:33s)[($fadeout:"c5", 17)]
(after:46s)[($fadeout:"c6", 24)]
(after:62s)[($fadeout:"c7", 32)]
}
{
<!--
(after:20s)[(hide:?c1)]
(after:24s)[(hide:?c2)]
(after:30s)[(hide:?c3)]
(after:40s)[(hide:?c4)]
(after:50s)[(hide:?c5)]
(after:70s)[(hide:?c6)]
-->
(after:95s)[(hide:?c7)(go-to:"Alea")]
}
<main id="grille">
<article id="case-1" style="--local: 1">[[Feu-follet]]
La lumière s'allume.</article>
<article id="case-2" style="--local: 2">Dans le couloir, sans bruit apparent, de la lumière filtre sous la porte.</article>
<article id="case-3" style="--local: 3">Toute activité cessante, vous attendez quelques secondes.</article>
<article id="case-4" style="--local: 4">La lumière s'[[éteint->Chat]].</article>
<article id="case-5" style="--local: 5">La lumière vacille.</article>
<article id="case-6" style="--local: 6">Vous vous demandez qui est à la source de cette irruption.</article>
<article id="case-7" style="--local: 7">Il ne semble y avoir personne, et pourtant.</article>
<article id="case-8" style="--local: 8">Vous écoutez le calme qui s'est installé .</article>
<article id="case-9" style="--local: 9">En abandonnant la peur de l'intrusion, sans y prendre gard, vous acceptez cette présence de l'autre côté de la porte.</article>
<article id="case-10" style="--local: 10">bruits de conversation qui s'élèvent (extrait audio à insérer)</article>
<article id="case-11" style="--local: 11">Votre esprit ressent une chaleur qui l'envahit. Quelque chose s'est ouvert, en vous, au plus profond.</article>
<article id="case-12" style="--local: 12">Vous laissez la lumière inondé la pièce par les interstices.</article>
<article id="case-13" style="--local: 13">De retour dans votre esprit, à ce moment, la question qui vous tourmentez l'esprit semble moins lourde.</article>
<article id="case-14" style="--local: 14">Sur votre téléphone, une application affiche un message que vous décidez de lire. *La pluie cessera dans les heures qui viennent."</article>
<article id="case-15" style="--local: 15">La lumière s'[[éteint->Chat]].</article>
<article id="case-16" style="--local: 16">Quelqu'un·e est prêt·e à vous aider, si vous êtes prêt·es à formuler une requête.</article>
</main>
Passage eau
(display:'silhouette')
[[Instauration]]
En suivant leurs silhouettes, au loin dans la rue, dans un jardin, dans un parc, nous allons essayer de vous amener dans un espace où parfois les mort⸱es et les vivant⸱es [[communiquent->hub]].
[[Rencontre]]
(enchant: ?retranscription's chars, via (t8n-delay:pos * 80) + (t8n:'fade'))
|retranscription>[
"Voir" "cheveux blancs" et "une silhouette"
J'ai pas compris ?
Ma maman a des cheveux blancs magnifiques, vraiment magnifiques.
J'ai cru que c'était elle. Et ça m'est arrivée aussi… j'ai la chair de poule
Et c'est très étrange parce que ça pourrait être elle quoi ! C'est juste là !
Ça nous a toutes bouleversées, moi et toutes mes ami·es qui ont vécu ça
C'est à chaque fois un choc comme ça
Alex raconte qu'il a perdu un ami qui était aussi son chef op, et…
]
{(track: 'silhouette', 'playwhenpossible')(live:60s)[(go-to:"silhouette2")]}
{
(link-repeat: 'passer')[
(track: 'silhouette', 'pause')
[(go-to:"silhouette2")]
]
}
[[Rencontre]]
[Vous marchez dans la [rue]<c2|.]<c1|
{(click: ?c2)[(replace:?c1)[ Là, [devant vous]<c3|, quelqu’un·e qui lui ressemble.]]
(click: ?c3)[(replace:?c1)[Vous n’approchez pas trop.(after:2s)[Vous vous [[souvenez->rencontre]].]]]}
[[Rencontre]]
En prenant soin de l'illusion, vous [[prenez soin->ChezMoi]] de la rencontre.
[[Instauration]]
En présence de Nathalie, X., Rares, AnaLou, Chantal, Inès et Leslie, nous avons rencontré
(live:0.7s)[(print: $list's $count)(set:$count=$count+1)]
{(set:$list to (a: "Antonio","Ginette","Doru","Marie","Eragon","Berthe","Marie-Berthe", "Jean-Charles","Poupette","[[et d'autres que vous rencontrerez au cours de ces lignes.->intro2]](stop:)"))
(set:$count to 1)}
/* GARAMOND/T */
@font-face {
font-family: "Garamond/t";
src:
url("./fonts/Garamondt-Regular.woff") format("woff"),
url("./fonts/Garamondt-Regular.woff2") format("woff2");
font-style: normal;
}
@font-face {
font-family: "Garamond/t";
src:
url("./fonts/Garamondt-Italic.woff") format("woff"),
url("./fonts/Garamondt-Italic.woff2") format("woff2");
font-style: italic;
}
/* AMIAMIE ROUND */
@font-face {
font-family: "AmiamieRound";
src:
url("./fonts/Amiamie-RegularRound.woff") format("woff"),
url("./fonts/Amiamie-RegularRound.woff2") format("woff2");
font-style: regular;
font-weight: normal;
}
@font-face {
font-family: "AmiamieRound";
src:
url("./fonts/Amiamie-BlackRound.woff") format("woff"),
url("./fonts/Amiamie-BlackRound.woff2") format("woff2");
font-style: regular;
font-weight: bold;
}
@font-face {
font-family: "AmiamieRound";
src:
url("./fonts/Amiamie-ItalicRound.woff") format("woff"),
url("./fonts/Amiamie-ItalicRound.woff2") format("woff2");
font-style: italic;
font-weight: normal;
}
@font-face {
font-family: "AmiamieRound";
src:
url("./fonts/Amiamie-BlackItalicRound.woff") format("woff"),
url("./fonts/Amiamie-BlackItalicRound.woff2") format("woff2");
font-style: italic;
font-weight: bold;
}
/* AMIAMIE CLASSIC */
@font-face {
font-family: "Amiamie";
src:
url("./fonts/Amiamie-Regular.woff") format("woff"),
url("./fonts/Amiamie-Regular.woff2") format("woff2");
font-style: regular;
font-weight: normal;
}
@font-face {
font-family: "Amiamie";
src:
url("./fonts/Amiamie-Black.woff") format("woff"),
url("./fonts/Amiamie-Black.woff2") format("woff2");
font-style: regular;
font-weight: bold;
}
@font-face {
font-family: "Amiamie";
src:
url("./fonts/Amiamie-Italic.woff") format("woff"),
url("./fonts/Amiamie-Italic.woff2") format("woff2");
font-style: italic;
font-weight: normal;
}
@font-face {
font-family: "Amiamie";
src:
url("./fonts/Amiamie-BlackItalic.woff") format("woff"),
url("./fonts/Amiamie-BlackItalic.woff2") format("woff2");
font-style: italic;
font-weight: bold;
}
:root {
--color: black;
--background: white;
--local: 1;
--coef: 1.2;
--s0: 1rem;
--s-1: calc(var(--s0) / var(--coef));
--s1: calc(var(--coef) * var(--s0));
--s2: calc(var(--coef) * var(--s1));
--s3: calc(var(--coef) * var(--s2));
--s4: calc(var(--coef) * var(--s3));
--s5: calc(var(--coef) * var(--s4));
--margin: 3rem;
--delay: 0.3s;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
scroll-behavior: smooth;
}
html,
body {
background: var(--background);
transition: background var(--deloy);
}
html,
body,
tw-story {
font-family: "Amiamie";
font-size: clamp(0.8rem, 0.8rem + 0.75vw, 1.3rem);
line-height: 1.35;
color: var(--color);
}
tw-story {
padding: var(--margin);
padding-bottom: calc(8 * var(--margin));
background: transparent;
}
p,
a,
span {
transition: color var(--delay);
}
@keyframes grain {
0% {
opacity: 0.1;
}
100% {
opacity: 1;
}
}
@keyframes background {
0% {
background: white;
}
100% {
background: #f4f4f4;
}
}
body {
animation: background ease-in-out 300s both;
}
body::after {
content: "";
position: fixed;
inset: 0;
filter: contrast(82%) brightness(110%);
background: url("../ressources/noise-v3.png");
mix-blend-mode: color-burn;
pointer-events: none;
animation: grain ease-in-out 300s both;
}
tw-passage {
max-width: 800px;
max-height: 100%;
width: 100%;
margin: 4rem auto;
font-size: var(--s0);
}
tw-sidebar {
/* display: none; */
height: 3vh;
padding: 0;
margin: 0;
}
#audio-controls {
display: none;
}
tw-broken-link {
font-family: "Garamond/t";
font-weight: bold;
font-size: var(--s2);
position: fixed;
top: var(--margin);
right: var(--margin);
border-bottom: none;
color: var(--color);
}
/* GRILLE */
tw-story[tags="soignée"] {
padding: 0;
}
tw-story[tags="soignée"] tw-passage {
max-width: 100%;
margin: 0;
}
main#grille {
display: grid;
grid-template-rows: repeat(4, 1fr);
grid-template-columns: repeat(1, 1fr);
height: 100vh;
width: 100vw;
scroll-snap-type: both mandatory;
overflow: scroll;
}
article {
height: 100vh;
width: 100vw;
display: flex;
align-items: center;
justify-content: center;
background: hsl(0, 0%, calc(38% + calc(var(--local) * 1.5%)));
scroll-snap-align: start;
scroll-snap-stop: always;
}
a,
tw-link,
tw-link.visited,
/* tw-expression > tw-hook, */
tw-hook > tw-expression,
/* tw-hook > tw-hook:not(.clicked), */
/* tw-hook:not(.clicked) > tw-hook */
tw-hook > tw-enchantment > tw-hook {
cursor: pointer;
font-size: var(--s0);
font-weight: bold;
color: var(--color);
width: fit-content;
transition:
text-decoration ease-in-out 1s,
color ease-in-out 1s;
}
.passage-link.clicked,
tw-hook.clicked > tw-hook,
tw-hook > tw-hook.clicked,
tw-hook.clicked {
cursor: initial;
font-weight: normal;
}
a:hover,
a:active,
a:focus,
tw-link:hover,
tw-link:active,
tw-link:focus,
tw-link:hover.visited,
tw-link:active.visited,
tw-link:focus.visited,
tw-enchantment.link:hover,
tw-enchantment.link:active,
tw-enchantment.link:focus {
text-decoration: none;
}
/* ----- blur-effect */
tw-hook {
position: relative;
}
.effect {
pointer-events: none;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
mix-blend-mode: multiply;
filter: blur(0);
transform: translate(0, 0);
transition:
color ease-in-out var(--delay),
transform ease-in-out var(--delay),
filter ease-in-out var(--delay);
}
/* CONTROVERSÉ */
/* .main { */
/* -webkit-user-select: none; */
/* -moz-user-select: none; */
/* -o-user-select: none; */
/* user-select: none; */
/* } */
.passage-link > .main,
tw-hook > .main {
color: var(--color) !important;
/* Possibilité de faire en sorte que le texte ne "saute" pas quand on passe de la version bold à la version regular */
/* font-weight: normal !important; */
visibility: hidden;
}
tw-hook > .effect {
position: absolute;
top: 0;
left: 0;
line-height: 1;
pointer-events: none;
}
:root {
--color1: cyan;
--color2: magenta;
--color3: yellow;
}
.passage-link > .effect:nth-of-type(1),
tw-hook > .effect:nth-of-type(1) {
color: var(--color1);
}
.passage-link:not(.clicked):hover > .effect:nth-of-type(1),
.passage-link:not(.clicked):active > .effect:nth-of-type(1),
.passage-link:not(.clicked):focus > .effect:nth-of-type(1),
tw-hook:not(.clicked):hover > .effect:nth-of-type(1),
tw-hook:not(.clicked):active > .effect:nth-of-type(1),
tw-hook:not(.clicked):focus > .effect:nth-of-type(1) {
transform: translate(0.1em, -0.05em);
color: var(--color1);
}
.passage-link > .effect:nth-of-type(2),
tw-hook > .effect:nth-of-type(2) {
color: var(--color2);
}
.passage-link:not(.clicked):hover > .effect:nth-of-type(2),
.passage-link:not(.clicked):active > .effect:nth-of-type(2),
.passage-link:not(.clicked):focus > .effect:nth-of-type(2),
tw-hook:not(.clicked):hover > .effect:nth-of-type(2),
tw-hook:not(.clicked):active > .effect:nth-of-type(2),
tw-hook:not(.clicked):focus > .effect:nth-of-type(2) {
transform: translate(-0.05em, 0.1em);
color: var(--color2);
}
.passage-link > .effect:nth-of-type(3),
tw-hook > .effect:nth-of-type(3) {
color: var(--color3);
}
.passage-link:not(.clicked):hover > .effect:nth-of-type(3),
.passage-link:not(.clicked):active > .effect:nth-of-type(3),
.passage-link:not(.clicked):focus > .effect:nth-of-type(3),
tw-hook:not(.clicked):hover > .effect:nth-of-type(3),
tw-hook:not(.clicked):active > .effect:nth-of-type(3),
tw-hook:not(.clicked):focus > .effect:nth-of-type(3) {
transform: translate(0.1em, 0.1em);
color: var(--color3);
}
.passage-link:not(.clicked):hover > .effect,
.passage-link:not(.clicked):active > .effect,
.passage-link:not(.clicked):focus > .effect,
tw-hook:not(.clicked):hover > .effect,
tw-hook:not(.clicked):active > .effect,
tw-hook:not(.clicked):focus > .effect {
filter: blur(1px);
opacity: 0.8;
}
/* test retranscription */
tw-hook[name="retranscription"] {
font-family: "Garamond/t";
font-size: var(--s0);
text-transform: lowercase;
color: gray;
}
/* Passage links */
tw-expression[name="link-goto"] tw-link,
tw-enchantment.link.enchantment-link > tw-hook,
tw-hook > tw-enchantment.link {
text-shadow:
0px 0px 0 magenta,
0px 0px 0 cyan,
0px 0px 0 yellow;
user-select: none;
color: var(--color);
filter: blur(0px);
opacity: 1;
transition:
text-shadow ease-in-out var(--delay),
filter ease-in-out var(--delay),
opacity ease-in-out var(--delay),
color ease-in-out var(--delay);
}
tw-expression tw-link:hover,
tw-expression[name="link-goto"] tw-link:active,
tw-expression[name="link-goto"] tw-link:focus,
tw-enchantment.link.enchantment-link > tw-hook:hover,
tw-enchantment.link.enchantment-link > tw-hook:focus,
tw-enchantment.link.enchantment-link > tw-hook:active {
/* color: var(--color); */
filter: blur(0.1em) !important;
opacity: 1 !important;
color: #888 !important;
text-shadow:
0.1em -0.05em 0.1em cyan,
-0.05em 0.1em 0.1em magenta,
0.1em 0.1em 0.1em yellow !important;
}
@media screen and (max-width: 968px) {
tw-hook,
tw-enchantment {
display: inline-block;
}
}
@media screen and (max-width: 768px) {
:root {
--margin: 1.5rem;
}
}
/* Détection des appareils mobiles */
@media (hover: none) {
tw-expression[name="link-goto"] tw-link,
tw-enchantment.link.enchantment-link > tw-hook,
tw-hook > tw-enchantment.link {
text-shadow: initial;
}
}
// Harlowe Macro Framework, by Chapel; version 1.0.2
!(function () {
"use strict";
var r = { major: 1, minor: 0, patch: 2 },
e = [r.major, r.minor, r.patch].join(".");
(r.semantic = e), (r = Object.freeze(r));
var t = $("tw-storydata"),
a = Object.freeze({ name: t.attr("name"), ifid: t.attr("ifid") }),
n = t.attr("format-version"),
o = n.split("."),
i = Object.freeze({ major: o[0], minor: o[1], patch: o[2], semantic: n });
(window.Harlowe = window.Harlowe || {}),
(window.Harlowe = Object.assign(window.Harlowe, {
framework: r,
API_ACCESS: Object.freeze({
MACROS: require("macros"),
STATE: require("state"),
CHANGER: require("datatypes/changercommand"),
ENGINE: require("engine"),
}),
engine: i,
story: a,
}));
})(),
(function () {
"use strict";
function e(r) {
return (
"number" == typeof r ||
"boolean" == typeof r ||
"string" == typeof r ||
null === r ||
(Array.isArray(r) && r.every(e)) ||
(r instanceof Set && Array.from(r).every(e)) ||
(r instanceof Map && Array.from(r.values()).every(e)) ||
_changer.isPrototypeOf(r)
);
}
window.Harlowe = Object.assign(window.Harlowe, {
helpers: {
isSerialisable: e,
isSerializable: e,
arrayify: function (r, e) {
if (r) {
var t = [].slice.call(r);
return void 0 !== e && (t = t.slice(e)), t;
}
},
getPassageData: function (r) {
var e = $('tw-passagedata[name="' + r + '"]');
if (e[0]) return e;
},
},
});
})(),
(function () {
"use strict";
var n = window.localStorage || !1,
o = Harlowe.story.ifid + "-tw-storage";
function r() {
try {
if (!n) throw new Error("storage is inaccessible");
n.setItem(o, JSON.stringify({ ifid: Harlowe.story.ifid }));
} catch (r) {
console.warn(r);
}
}
function i(r) {
try {
var e;
if (n)
return (
(e = JSON.parse(n.getItem(o))),
r && r && "string" == typeof r ? e[r] : e
);
throw new Error("storage is inaccessible");
} catch (r) {
console.warn(r);
}
}
null == i() && r(),
(Harlowe.storage = {
clear: r,
save: function (r, e) {
try {
if (!r || "string" != typeof r)
throw new TypeError(
"cannot store values without a valid storage key",
);
if (void 0 === e)
throw new TypeError("cannot store undefined values");
var t = {};
if (((t[r] = e), !n)) throw new Error("storage is inaccessible");
var a = i();
Object.assign(a, t), n.setItem(o, JSON.stringify(a));
} catch (r) {
console.warn(r);
}
},
load: i,
remove: function (r) {
try {
if (!r || "string" != typeof r)
throw new TypeError(
"cannot store values without a valid storage key",
);
if (!n) throw new Error("storage is inaccessible");
var e = i();
e.hasOwnProperty(r) &&
(delete e[r], n.setItem(o, JSON.stringify(e)));
} catch (r) {
console.warn(r);
}
},
});
})(),
(function () {
"use strict";
function a(r, e, t) {
if (!(this instanceof a)) return new a(r, e, t);
(this.name = r || "unknown"),
(this.args = e || []),
(this.data = t || {}),
(this.type = (t && t.type) || "basic"),
(this.fn = (t && t.fn) || "handler"),
"changer" === this.type &&
("handler" === this.fn
? (this.instance = (t && t.instance) || null)
: (this.descriptor = (t && t.descriptor) || null));
}
(a.create = function (r, e, t) {
if (!r || "string" != typeof r || !r.trim())
throw new TypeError("Invalid macro name.");
return (
(e && e instanceof Array) || (e = []),
(t && "object" == typeof t) || (t = { type: "basic", fn: "handler" }),
new a(r, e, t)
);
}),
Object.assign(a.prototype, {
clone: function () {
return a.create(this.name, this.args, this.data);
},
syntax: function () {
return "(" + this.name + ":)";
},
error: function (r, e) {
var t = "Error in the " + this.syntax() + " macro: " + r;
return (
e && alert(t),
console.warn("HARLOWE CUSTOM MACRO ERROR -> ", t),
new Error(r)
);
},
typeCheck: function (r) {
(r && r instanceof Array) ||
(r = Harlowe.helpers.arrayify(arguments));
var n = this,
o = [];
if (
(r.forEach(function (r, e) {
var t = e + 1,
a = [];
"string" == typeof r &&
("any" ===
(a = r.includes("|")
? r.split("|").map(function (r) {
return r.trim().toLowerCase();
})
: [r.trim().toLowerCase()])[0] ||
a.some(function (r) {
return typeof n.args[e] === r;
}) ||
o.push(
"argument " + t + " should be a(n) " + a.join(" or "),
));
}),
o.length)
)
return n.error(o.join("; "));
},
}),
(window.Harlowe = Object.assign(window.Harlowe, { MacroContext: a }));
})(),
(function () {
"use strict";
var c = Harlowe.API_ACCESS.MACROS,
l = Harlowe.API_ACCESS.CHANGER;
window.Harlowe = Object.assign(window.Harlowe || {}, {
macro: function (r, e, t) {
if (!r || "string" != typeof r || !r.trim())
throw new TypeError("Invalid macro name.");
if (!e || "function" != typeof e)
throw new TypeError("Invalid macro handler.");
var a, n, o, i, s;
t && "function" == typeof t
? ((o = r),
(i = e),
(s = t),
c.addChanger(
o,
function () {
var r = Harlowe.helpers.arrayify(arguments, 1),
e = l.create(o, r),
t = Harlowe.MacroContext.create(o, r, {
type: "changer",
fn: "handler",
instance: e,
});
return i.apply(t, r), e;
},
function () {
var r = Harlowe.helpers.arrayify(arguments),
e = r.shift(),
t = Harlowe.MacroContext.create(o, r, {
type: "changer",
fn: "changer",
descriptor: e,
});
s.apply(t, r);
},
c.TypeSignature.zeroOrMore(c.TypeSignature.Any),
))
: ((a = r),
(n = e),
c.add(
a,
function () {
var r = Harlowe.helpers.arrayify(arguments, 1),
e = Harlowe.MacroContext.create(a, r, {
type: "basic",
fn: "handler",
}),
t = n.apply(e, r);
return null == t ? "" : t;
},
c.TypeSignature.zeroOrMore(c.TypeSignature.Any),
));
},
});
})(),
(function () {
"use strict";
var t = Harlowe.API_ACCESS.STATE,
e = Harlowe.API_ACCESS.ENGINE;
function a() {
return t.passage;
}
window.Harlowe = Object.assign(window.Harlowe || {}, {
passage: a,
tags: function (r) {
r = r || a();
try {
var e = Harlowe.helpers.getPassageData(r).attr("tags");
return e ? e.split(" ") : [];
} catch (r) {
return console.warn(r.message), [];
}
},
goto: function (r) {
return e.goToPassage(r);
},
variable: function (r, e) {
if ("{{STORY_DATA}}quot; !== r[0]) throw new Error('cannot access variable "' + r + '"');
if (((r = r.substr(1)), void 0 !== e)) {
if (!Harlowe.helpers.isSerialisable(e))
throw new Error(
'The value passed to variable "' + r + '" cannot be serialized.',
);
t.variables[r] = e;
}
return t.variables[r];
},
visited: function (r) {
return t.passageNameVisited(r || a());
},
hasVisited: function (r) {
return 0 < t.passageNameVisited(r || a());
},
turns: function () {
return t.pastLength;
},
});
})();
// end Harlowe Macro Framework
/**
* Harlowe Audio Library (HAL), by Chapel, v2.3.0
* for Harlowe 2.1.0 and higher
* Released under the Unlicense, and dedicated to the public domain.
**/
;!function(e){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}(navigator.userAgent||navigator.vendor||window.opera),function(){"use strict";window.Fast={filter:function(e,t){for(var o=e.length,n=[],a=0;a<o;a++)t(e[a],a,e)&&n.push(e[a]);return n},forEach:function(e,t){for(var o=e.length,n=0;n<o;n++)t(e[n],n,e)},map:function(e,t){for(var o=e.length,n=new Array(o),a=0;a<o;a++)n[a]=t(e[a],a,e);return n},find:function(e,t){for(var o=e.length,n=0;n<o;n++)if(t(e[n],n,e))return e[n]},findIndex:function(e,t){for(var o=e.length,n=0;n<o;n++)if(t(e[n],n,e))return n;return-1},some:function(e,t){for(var o=e.length,n=0;n<o;n++)if(t(e[n],n,e))return!0;return!1}}}(),window.Chapel=window.Chapel||{},window.Chapel.options={preload:!0,loadDelay:0,muteOnBlur:!0,startingVol:.5,persistPrefs:!0,globalA:!0,showControls:!0,sidebarStartClosed:!0,volumeDisplay:!1,trackLoadLimit:500,totalLoadLimit:8e3,debug:!1},window.Chapel.debug=function(){Chapel.options.debug&&console.log.apply(null,arguments)},function(){"use strict";var n=$("tw-storydata"),o=/(.+?):(.+)/,t=/[\r\n]+/,a=/^["']/,r=/["']$/;function e(e){return Fast.map(Fast.filter(e.split(t),function(e){return e&&e.trim()&&e.includes(":")}),function(e){return e.trim()})}function i(e){return e.trim().replace(a,"").replace(r,"").trim()}function s(e){var t=e.match(o);return t instanceof Array?{key:i(t[1]),value:i(t[2])}:e}var u,l,c,p=n.find('tw-passagedata[name="hal.tracks"]'),d=null,p=(p.length&&(p=e(p.text()),u=[],l=[],Fast.forEach(p,function(e){var e=s(e);"string"==typeof e&&l.push(e),u.push([e.key,(e=e.value,Fast.map(e.split(","),i))])}),l.length&&console.error("Some track definitions could not be parsed:\n"+l.join("\n")+"\nPlease check these definitions and try again."),d=new Map(u)),n.find('tw-passagedata[name="hal.config"]')),m=null;function f(e){var t=n.attr("format-version");if(e)return t;var e=t.split("."),t=e[0],o=e[1],e=e[2],t=Number(t),o=Number(o);return[t=(t=Number.isNaN(t)?3:t)<1?3:t,o=Number.isNaN(o)?3:o,e=Number.isNaN(e)?0:e]}function h(){var e=f();return!(3<=e[0]&&3<=e[1])}function g(t){return function(){var e=[].slice.call(arguments).slice(1),e=t.apply(null,e);return"string"==typeof e||"boolean"==typeof e||"number"==typeof e?e:""}}p.length&&(p=e(p.text()),c={},Fast.forEach(Fast.map(p,function(e){return s(e)}),function(e){c[e.key]=e.value}),m=c),m&&Fast.forEach(Object.keys(m),function(e){var t=e,o=c[e],e=typeof Chapel.options[e];"boolean"==e?"true"===o?Chapel.options[t]=!0:"false"===o&&(Chapel.options[t]=!1):"number"==e?(o=Number(o),Number.isNaN(o)||(Chapel.options[t]=o)):"string"==e&&o&&(Chapel.options[t]=o)});var y=require("macros");if(window.Chapel=window.Chapel||{},window.Chapel.Macros={add:function(o){o&&"object"==typeof o&&Fast.forEach(Object.keys(o),function(e){var t;t=o[e=e],h()?y.add(e,g(t),y.TypeSignature.zeroOrMore(y.TypeSignature.Any)):y.add(e,"Any",g(t),y.TypeSignature.zeroOrMore(y.TypeSignature.Any))})}},window.Chapel.Get=Object.freeze({version:f(),isHarlowe3OrLater:3<=f()[0],storyTitle:n.attr("name"),IFID:n.attr("ifid"),useOldMacroAPI:h(),fromPassage:d}),Chapel.debug("Harlowe Version -> ",Chapel.Get.version.join(".")),Chapel.debug("Harlowe Major Version -> ",Chapel.Get.version[0]),Chapel.debug("Story Title -> ",Chapel.Get.storyTitle),Chapel.debug("Story IFID -> ",Chapel.Get.IFID),Chapel.Get.version[0]<2)throw new Error("The Harlowe Audio Library is only designed to work with Harlowe 2 and 3; you appear to be using Harlowe 1 or an otherwise invalid story format.","get.js -> initialization",176);Chapel.options.storagekey="%%hal-"+Chapel.Get.IFID+"-{"+Chapel.Get.storyTitle+"}",Chapel.debug("Storage Key -> ",Chapel.options.storagekey)}(),function(){"use strict";var t=Chapel.options,e=function(e,t){if(window.localStorage)try{e=""+e,"string"!=typeof t&&(t=JSON.stringify(t)),window.localStorage.setItem(e,t)}catch(e){console.error(e)}},o=function(e){if(window.localStorage)try{return e=""+e,window.localStorage.getItem(e)}catch(e){console.error(e)}},n=function(e){if(window.localStorage)try{e=""+e,window.localStorage.removeItem(e)}catch(e){console.error(e)}},a={loaded:[],classes:{},master:{volume:t.startingVol,mute:!1},groups:{playing:[],looping:[],custom:{}},mute:function(e){a.master.mute=!!e,$(document).trigger({type:":master-mute",mute:!!e})},isMuted:function(){return!!a.master.mute},volume:function(e){e=Number(e),Number.isNaN(e)||(1<e?e=1:e<0&&(e=0),a.master.volume=e),$(document).trigger({type:":master-volume",volume:e})},getVolume:function(){return a.master.volume},stopAll:function(){a.classes.Track&&Fast.forEach(a.classes.Track.list,function(e){e.stop()})},audioPlaying:function(){return!!a.groups.playing.length},savePrefs:function(){e(t.storagekey,a.master)},loadPrefs:function(){var e=o(t.storagekey);e&&"object"==typeof e&&e.hasOwnProperty("volume")&&"number"==typeof e.volume&&e.hasOwnProperty("mute")&&"boolean"==typeof e.volume&&(delete a.master,a.master=e)},clearPrefs:function(){n(t.storagekey)}},r={track:[":available",":loaded",":play",":stop",":mute",":volume"],master:[":master-mute",":master-volume"]};var i=r.track.concat(r.master);function s(e,t){if(!e||"string"!=typeof e||!e.trim())return null;e=Fast.filter(Fast.map(e.split(" "),function(e){return(e=":"!==(e=e.split(".")[0])[0]?":"+e:e)+".userland"}),function(e){return(t?i:r.track).includes(e)}).join(" ");return e&&e.trim()?e:null}a.data={parseEvent:s,bail:function(e){throw new Error(e,"audio.js -> bail()",140)}},a.on=function(e,t){t&&"function"==typeof t?(e=s(e,!0))&&$(document).on(e,t):console.error("Chapel.Audio.on() -> invalid callback")},a.one=function(e,t){t&&"function"==typeof t?(e=s(e,!0))&&$(document).one(e,t):console.error("Chapel.Audio.one() -> invalid callback")},a.off=function(e){(e=s(e,!0))&&$(document).off(e)},t.persistPrefs&&($(document).on(":master-mute",a.savePrefs),$(document).on(":master-volume",a.savePrefs)),$(document).on(":play",function(e){e.track.addToGroup("playing")}),$(document).on(":stop",function(e){e.track.removeFromGroup("playing")}),t.muteOnBlur&&$(window).on("blur",function(){a.isMuted()||(a.mute(!0),$(window).one("focus",function(){a.mute(!1)}))}),a.parseEvent=s,window.Chapel=window.Chapel||{},window.Chapel.Audio=a}(),function(){"use strict";var a=Chapel.Audio,o=a.data.pareEvent,r=a.data.bail,i=Chapel.options,t=$(document.createElement("div")).attr("id","audio-container").css("display","none").appendTo(document.body),s={aac:"audio/aac",caf:"audio/x-caf","x-caf":"audio/x-caf",mp3:'audio/mpeg; codecs="mp3"',mpeg:'audio/mpeg; codecs="mp3"',m4a:"audio/mp4",mp4:"audio/mp4","x-m4a":"audio/mp4","x-mp4":"audio/mp4",oga:"audio/ogg",ogg:"audio/ogg",opus:'audio/ogg; codecs="opus"',wav:"audio/wav",wave:"audio/wav",weba:"audio/webm",webm:"audio/webm"};function u(e,t,o){this instanceof u||r("Track: called without `new` operator"),e||r("Track: no id specified"),"string"!=typeof e&&r("Track: track id is not a string"),t&&(!Array.isArray(t)||t.length)||r("Track: no sources specified"),o?t=[].slice.call(arguments).slice(1):"string"==typeof t&&(t=[t]);var n=$(document.createElement("audio"));Fast.forEach(t,function(e){$(document.createElement("source")).attr({src:e,type:(e=(e=(e=(e=(e=e).split("."))[e.length-1]).includes("?")?e.split("?")[0]:e).toLowerCase().trim(),Object.keys(s).includes(e)||r('Track: unsupported file type "'+e+'"'),s[e])}).appendTo(n)}),n.attr({"data-track":"id","data-volume":1,"data-mute":!1}).one("canplaythrough.hal",function(){a.loaded.push(e)}),i.preload&&n.attr("preload","auto"),n[0].volume=+a.master.volume,this.id=e,this.$el=n,this.unwrap=n[0],this.sources=t}Object.assign(u,{list:[],is:function(e){return e instanceof u},has:function(t){return Fast.some(u.list,function(e){return e.id===t})},emit:function(e,t){$(document).trigger({type:e,track:t}),t.emit(e)},add:function(e,t,o){var n=new u(e,t=o?[].slice.call(arguments).slice(1):t);return u.list.push(n),n.$el.on("canplay",function(){u.emit(":available",n)}),n.$el.on("canplaythrough",function(){u.emit(":loaded",n)}),n.attach(),n},renew:function(){Fast.forEach(u.list,function(e){e.mute(e.isMuted()),e.volume(e.getVolume())})},getIdx:function(t){return Fast.findIndex(u.list,function(e){return e.id===t})},get:function(t){var e=Fast.find(u.list,function(e){return e.id===t});if(e)return e;throw new ReferenceError('There is no track with the id "'+t+'". Please check your spelling and capitalization.',"track.js -> Track.get()",155)},removeFromDOM:function(e){(e="string"==typeof e?u.get(e):e)&&u.is(e)?e.unattach():t.remove()},_runOnMultiple:function(e,t,o){e instanceof Array&&u.prototype.hasOwnProperty(t)&&Fast.forEach(e,function(e){(e=u.is(e)?e:u.get(e)||null)&&e[t].apply(e,o&&o instanceof Array?o:[])})}}),Object.assign(u.prototype,{constructor:u,emit:function(e){this.$el.trigger({type:e,track:this})},clone:function(){return new u(this.id,this.sources)},isAttached:function(){return $.contains(t[0],this.unwrap)},attach:function(){return this.isAttached()||this.$el.appendTo(t),this},unattach:function(){return this.isAttached()&&this.$el.remove(),this},isPlaying:function(){return!this.unwrap.paused},play:function(){var e=this;return this.unwrap.play(),u.emit(":play",this),this.$el.on("ended",function(){e.unwrap.loop||(e.unwrap.currentTime=0,u.emit(":stop",e))}),this},playWhenPossible:function(){var t=this;return this.unwrap.play().then(function(){u.emit(":play",t),t.$el.on("ended",function(){t.unwrap.loop||(t.unwrap.currentTime=0,u.emit(":stop",t))})},function(e){$(document).one("click mousedown keydown touchstart",function(){t.play()})}).catch(function(e){console.error(e)}),this},forcePlay:function(){var e=this,t=$(document.createElement("a")).css("display","none").appendTo(document.body).on("click",function(){e.play()});setTimeout(function(){t.trigger("click")},safeAudioStart)},pause:function(){return this.unwrap.pause(),u.emit(":pause",this),this},stop:function(){return this.unwrap.pause(),this.unwrap.currentTime=0,u.emit(":stop",this),this},mute:function(e){return this.$el.attr("data-mute",e=!!e),a.master.mute?this.unwrap.muted=!0:this.unwrap.muted=e,u.emit(":mute",this),this},isMuted:function(){var e=this.$el.attr("data-mute");return"boolean"==typeof e?e:"false"!==e},toggleMute:function(){return this.mute(!this.isMuted()),this},volume:function(e){return e=Number(e),Number.isNaN(e)||(1<e?e=1:e<0&&(e=0),this.$el.attr("data-volume",e),this.unwrap.volume=e*a.master.volume),u.emit(":volume",this),this},getVolume:function(){return Number(this.$el.attr("data-volume"))},addToGroup:function(e,t){var o=this,t=(t?a.groups.custom:a.groups)[e];return Fast.some(t,function(e){return o.id===e.id})||t.push(this),this},removeFromGroup:function(e,t){var o=this,t=(t?a.groups.custom:a.groups)[e],e=Fast.findIndex(t,function(e){return e.id&&e.id===o.id});return t.splice(e,1),this},loop:function(e){return this.unwrap.loop=!!e,this.unwrap.loop?this.addToGroup("looping"):this.removeFromGroup("looping"),this},isLooping:function(){return!!this.unwrap.loop},toggleLoop:function(){return this.loop(!this.isLooping()),this},seek:function(e){return e<0?e=this.unwrap.duration-e:e>this.unwrap.duration&&(e=this.unwrap.duration),this.unwrap.currentTime=e,this},fadeIn:function(e){var t=this,o=(e=e||1,this.getVolume());return this.volume(0),this.play(),this.$el.animate({volume:o*a.master.volume},1e3*e,function(){t.volume(o),u.emit(":volume",t),u.emit(":fade",t)}),this},fadeOut:function(e){e=e||1;var t=this,o=this.getVolume();return this.$el.animate({volume:0},1e3*e,function(){t.stop(),t.volume(o),u.emit(":volume",t),u.emit(":fade",t)}),this},fadeTo:function(e,t){var o=this;if(e=e||1,t=Number(t),!Number.isNaN(t))return 1<t?t=1:t<0&&(t=0),this.$el.animate({volume:t*a.master.volume},1e3*e,function(){o.volume(t),u.emit(":volume",o),u.emit(":fade",o)}),this;alert("ivalid volume level")},delay:function(e,t){var o=this;"function"==typeof t&&(e=Number(e),(Number.isNaN(e)||e<0)&&(e=0),setTimeout(function(){t.call(o,o,e)},e))},on:function(e,t){if(!t||"function"!=typeof t)return console.error("<track>.on() -> invalid callback"),this;(e=o(e))&&this.$el.on(e,t)},one:function(e,t){if(!t||"function"!=typeof t)return console.error("<track>.one() -> invalid callback"),this;(e=o(e))&&this.$el.one(e,t)},off:function(e){(e=o(e))&&this.$el.off(e)}}),a.classes.Track=u,a.newTrack=function(){try{return u.add.apply(null,arguments)}catch(e){console.error(e.message),alert("Error in A.newTrack() -> see the console for more information.")}},a.track=function(e){try{return u.get(e)}catch(e){console.error(e.message),alert("Error in A.track() -> see the console for more information.")}},$(document).on(":master-mute",u.renew),$(document).on(":master-volume",u.renew)}(),function(){"use strict";var n=Chapel.Audio,a=n.classes.Track,o=(n.data._extend,/(play)?list:(.+)/i);n.createGroup=function(e,t,o){o=o?[].slice.call(arguments).slice(1):t;t=e,(e=o)&&Array.isArray(e)||(e=[]),n.groups.custom[t]=Fast.map(e,function(e){return a.get(e)})},n.group=function(e){if(!(this instanceof n.group))return new n.group(e);if(Object.keys(n.groups.custom).includes(e))this.members=n.groups.custom[e];else{if(!(n.groups[e]&&n.groups[e]instanceof Array))throw new ReferenceError('There is no group with the id "'+id+'". Please check your spelling and capitalization.',"group.js -> A.group()",29);this.members=n.groups[e]}var t;o.test(e)&&(t=e.match(o)[2])&&t.trim()&&(this.members=n.playlist(t).tracks),Array.isArray(this.members)||(this.members=[],console.error('Could not find members for track group "'+e+'"!'))},Object.assign(n.group,{is:function(e){return this instanceof n.group},_runOnAll:function(e,t,o,n){null!=n?o=[].slice.call(arguments).slice(2):o instanceof Array||(o=[o]);n=[e.members,t,o];a._runOnMultiple.apply(null,n)}}),Object.assign(n.group.prototype,{constructor:n.group,_run:function(){n.group._runOnAll.apply(null,[this].concat([].slice.call(arguments)))},play:function(){return this._run("play"),this},pause:function(){return this._run("pause"),this},stop:function(){return this._run("stop"),this},mute:function(e){return this._run("mute",e),this},volume:function(e){return this._run("volume",e),this},loop:function(e){return this._run("loop",e),this}})}(),function(){"use strict";var e=Chapel.Audio,a=e.classes.Track;e.data._extend;function n(e,t){if(!(this instanceof n))return new n(e,t);this.id=e,this.tracks=t.map(function(e){return a.get(e)}),this.looping=!1,this.current="",this.playing=!1}Object.assign(n,{list:{},is:function(e){return e instanceof n},add:function(e,t,o){return o&&(t=[].slice.call(arguments).slice(1)),n.list[e]=new n(e,t),n.list[e]},_runOnAll:function(e,t,o,n){null!=n?o=[].slice.call(arguments).slice(2):o instanceof Array||(o=[o]);n=[e.tracks,t,o];a._runOnMultiple.apply(null,n)}}),Object.assign(n.prototype,{constructor:n,clone:function(){return new n(this.id,this.tracks.map(function(e){return e.id}))},_run:function(){n._runOnAll.apply(null,[this].concat([].slice.call(arguments)))},volume:function(e){return this._run("volume",e),this},mute:function(e){return this._run("mute",e),this},shuffle:function(){for(var e,t,o=this.tracks,n=o.length-1;0<n;n--)e=Math.floor(Math.random()*(n+1)),t=o[n],o[n]=o[e],o[e]=t;return this.tracks=o,this},random:function(){return this.tracks[Math.floor(Math.random()*this.tracks.length)]},isPlaying:function(){return this.playing},nowPlaying:function(){return a.get(this.current)},play:function(e){var t=this;if((e=e||(t.current?Fast.findIndex(t.tracks,function(e){return e.id===t.current}):0))>=t.tracks.length&&t.looping)e=0;else if(e>=t.tracks.length)return t.current="",void(t.playing=!1);var o=t.tracks[e],n=o.isLooping();return o.loop(!1),o.play(),t.playing=!0,setTimeout(function(){o.isPlaying()||(t.playing=!1)},20),t.current=o.id,o.$el.one("ended.playlist",function(){e++,o.loop(n),t.play(e)}),t},loop:function(e){return this.looping=!!e,this},isLooping:function(){return this.looping},stop:function(){var e;return this.current&&this.isPlaying()?(e=this.nowPlaying())&&(e.stop(),e.$el.off(".playlist")):this._run("stop"),this.current="",this.playing=!1,this},pause:function(){var e;return this.current&&this.isPlaying()&&((e=this.nowPlaying())&&e.pause()),this.playing=!1,this}}),e.classes.Playlist=n,e.createPlaylist=function(){try{n.add.apply(null,arguments)}catch(e){console.error(e.message),alert("Error in A.createPlaylist() -> see the console for more information.")}},e.playlist=function(e){try{var t=n.list[e]||null;if(t)return t;throw new ReferenceError('There is no playlist with the id "'+e+'". Please check your spelling and capitalization.',"list.js -> A.playlist()",171)}catch(e){console.error(e.message),alert("Error in A.createPlaylist() -> see the console for more information.")}}}(),function(){"use strict";var t=Chapel.Audio,o=t.classes.Track,n=t.classes.Playlist;function a(t,o){if("object"!=typeof o)throw new TypeError("Invalid extension.","extensions.js -> _extend()",8);Fast.forEach(Object.keys(o),function(e){if(void 0!==t[e])throw new Error('Invalid extension: cannot clobber existing property "'+e+'".',"extensions.js -> _extend()",8);t[e]=o[e]})}t.extend=function(e){a(Audio,e)},o.extend=function(e){a(o,e)},o.extendPrototype=function(e){a(o.prototype,e)},t.extendTrack=o.extend,t.extendTrackProto=o.extendPrototype,t.group.extend=function(e){a(t.group,e)},t.group.extendPrototype=function(e){a(t.group.prototype,e)},t.extendGroup=t.group.extend,t.extendGroupProto=t.group.extendPrototype,n.extend=function(e){a(n,e)},n.extendPrototype=function(e){a(n.prototype,e)},t.extendPlaylist=n.extend,t.extendPlaylistProto=n.extendPrototype}(),function(){"use strict";var e,t,o,n,a,r,i,s=Chapel.options;s.showControls&&(e=$(document.createElement("div")).attr("id","story-menu").css("display","none"),t=$(document.createElement("span")).attr("id","vol-title").append("Volume"),s.volumeDisplay||t.css("display","none"),o=$(document.createElement("input")).attr({id:"audio-volume",type:"range",min:1,max:99,step:1,title:"Volume"}).addClass("hal"),(a=Math.trunc(100*window.Chapel.Audio.master.volume))<0?a=0:100<a&&(a=100),o.attr("value",a),n=function(e){void 0===e&&(e=o.val()),t.empty().append("Volume "+e)},o.on("input",function(){window.Chapel.Audio.volume($(this).val()/100),n($(this).val())}),a=$(document.createElement("tw-link")).attr({id:"audio-mute",title:"Mute"}).append("Mute <span></span>").on("click",function(e){e.preventDefault(),$(this).toggleClass("muted"),Chapel.Audio.mute(!Chapel.Audio.isMuted())}),Chapel.Audio.isMuted()&&a.addClass("muted"),r=$(document.createElement("tw-link")).attr("id","audio-panel-toggle").on("click",function(e){e.preventDefault(),i.toggleClass("closed")}),i=$(document.createElement("div")).attr("id","audio-controls").append(e,t,o,a,r).appendTo(document.body),s.sidebarStartClosed&&i.addClass("closed"),window.Chapel=window.Chapel||{},window.Chapel.Audio=window.Chapel.Audio||{},window.Chapel.Audio.controls={$panel:i,$volume:o,$mute:a,$user:e,close:function(){i.addClass("closed")},open:function(){i.removeClass("closed")},toggle:function(){i.toggleClass("closed")},hide:function(){i.css("display","none")},show:function(){i.css("display","block")},updateVolume:n})}(),function(){"use strict";var s=Chapel.options,t=State,e=$(document.createElement("div")).attr("id","audio-overlay").css("display","none").appendTo(document.body);function o(){e.css("display","block").append('<div class="lds-ring"><div></div><div></div><div></div><div></div></div>')}function u(){e.fadeOut(function(){e.empty()})}window.Chapel=window.Chapel||{},window.Chapel.Audio=window.Chapel.Audio||{},window.Chapel.Audio.loadScreen={show:o,dismiss:u,kill:function(){$("#audio-overlay").remove()}},window.Chapel.Audio.$overlay=e,window.Chapel.Audio.preload=function(){var a,e,r,i;Chapel.debug("This is a mobile browser -> ",$.browser.mobile),t.pastLength||t.futureLength||$.browser.mobile||($(document).ready(function(){o()}),a=100+s.loadDelay,e=Chapel.Audio.classes.Track.list,r=Chapel.Audio.loaded,e.length?(i=Fast.map(e,function(e){return e.id}),0<s.totalLoadLimit&&setTimeout(function(){u()},s.totalLoadLimit),function e(){var t,o,n;i.length?(t=i.shift(),r.includes(t)?e():(o=Chapel.Audio.classes.Track.get(t)).unwrap.readyState<2?(n=!1,o.$el.one("canplaythrough.hal",function(){e(),n=!0}),setTimeout(function(){n||(o.$el.off("canplaythrough.hal"),e())},s.trackLoadLimit)):(r.includes(t)||r.push(t),e())):setTimeout(u,a)}()):setTimeout(u,a))}}(),function(){"use strict";var e,t,o=Chapel.options.storagekey+"_hal_restart_",n=(Chapel.debug("HAL Session Key -> ",o),window.sessionStorage?(Chapel.debug("Session Storage Available"),e=function(e,t){window.sessionStorage.setItem(o+e,t)},t=function(e){return window.sessionStorage.getItem(o+e)}):(Chapel.debug("Session Storage Unavailable"),e=function(){},t=function(){},console.warn("Session storage is unavailable...")),{save:e,load:t});window.Chapel.Audio.state={_store:n,saveTracks:function(){var e;try{e=Fast.map(Chapel.Audio.classes.Track.list,function(e){return{id:e.id,sources:e.sources}}),Chapel.debug("Session Saved (Tracks) -> ",e),e=JSON.stringify(e),n.save("tracks",e)}catch(e){console.error(e.message)}},loadTracks:function(){var e;try{e=(e=n.load("tracks"))&&JSON.parse(e),Array.isArray(e)&&e.length&&(Chapel.debug("Session Loaded (Tracks) -> ",e),Fast.forEach(e,function(e){e.id&&e.sources&&!Chapel.Audio.classes.Track.has(e.id)?Chapel.Audio.newTrack.apply(null,[e.id].concat(e.sources)):Chapel.debug("Track reloading skipped.")}))}catch(e){console.error(e.message)}},savePlaylists:function(){try{var o=Chapel.Audio.classes.Playlist.list,e=Fast.map(Object.keys(o),function(e){var t={};return t.tracks=Fast.map(o[e].tracks,function(e){return e.id}),t.id=o[e].id,t});Chapel.debug("Session Saved (Playlists) -> ",e),e=JSON.stringify(e),n.save("playlists",e)}catch(e){console.error(e.message)}},loadPlaylists:function(){var e;try{(e=(e=n.load("playlists"))&&JSON.parse(e))&&Array.isArray(e)&&e.length&&(Chapel.debug("Session Loaded (Playlists) -> ",e),Fast.forEach(e,function(e){e.id&&e.tracks&&Chapel.Audio.createPlaylist(e.id,e.tracks)}))}catch(e){console.error(e.message)}},saveGroups:function(){var t;try{t={},Fast.forEach(Object.keys(Chapel.Audio.groups.custom),function(e){t[e]=Fast.map(Chapel.Audio.groups.custom[e],function(e){return"string"==typeof e?e:e.id})}),Chapel.debug("Session Saved (Groups) -> ",t),t=JSON.stringify(t),n.save("groups",t)}catch(e){console.error(e.message)}},loadGroups:function(){var t;try{(t=(t=n.load("groups"))&&JSON.parse(t))&&"object"==typeof t&&(Chapel.debug("Session Loaded (Groups) -> ",t),Fast.forEach(Object.keys(t),function(e){Fast.map(t[e],function(e){return Chapel.Audio.classes.Track.get(e)})}),Chapel.Audio.groups.custom=t)}catch(e){console.error(e.message)}}}}(),function(){"use strict";var e=Chapel.options;e.globalA&&void 0===window.A&&(Chapel.debug("Created global A interface."),window.A=window.Chapel.Audio),Chapel.Get.fromPassage&&(Chapel.debug("Loading tracks from track def special passage -> ",Chapel.Get.fromPassage),Chapel.Get.fromPassage.forEach(function(e,t){Chapel.Audio.newTrack.apply(null,[t].concat(e))})),$(document).on("unload",function(){Chapel.debug("User Prefs Saved"),window.Chapel.Audio.savePrefs()}),Chapel.Audio.classes.Track.renew(),Chapel.Audio.controls&&Chapel.Audio.controls.updateVolume(),Chapel.Get.isHarlowe3OrLater&&($(window).on("unload",function(){Chapel.debug("HAL State Saved"),Chapel.Audio.state.saveTracks(),Chapel.Audio.state.savePlaylists(),Chapel.Audio.state.saveGroups()}),Chapel.debug("HAL State Loaded"),Chapel.Audio.state.loadTracks(),Chapel.Audio.state.loadPlaylists(),Chapel.Audio.state.loadGroups()),e.persistPrefs&&(Chapel.debug("User Prefs Loaded"),Chapel.Audio.loadPrefs())}(),function(){"use strict";var i,s,e,u,t;Chapel.options.showControls&&(i=Engine,s=Chapel.Audio.controls.$user,e=function(){return"none"!==s.css("display")},u=function(){return e()||s.css("display","block"),s},t=function(){return e()&&s.css("display","none"),s},Chapel.Audio.menu={hide:t,show:u,isShown:e,links:{add:function(e,t,o){var n,a;if(!e||"string"!=typeof e)return r="undefined",alert(r),void console.error(r);o||"function"!=typeof t?(t&&"string"==typeof t&&(n=t),o&&"function"==typeof o&&(a=o)):(a=t,n=null);var r=$(document.createElement("tw-link")).append(e).attr({tabindex:"0",name:e.toLowerCase().trim()}).on("click",function(){n&&i.goToPassage(n),a&&a()}).addClass("story-menu").appendTo(s);return u(),r},clear:function(){return s.empty(),t()},hide:function(e){e=e.toLowerCase().trim(),$('tw-link.story-menu[name="'+e+'"]').addClass("hide")},show:function(e){e=e.toLowerCase().trim(),$('tw-link.story-menu[name="'+e+'"]').removeClass("hide")},toggle:function(e){e=e.toLowerCase().trim(),$('tw-link.story-menu[name="'+e+'"]').toggleClass("hide")},remove:function(e){e=e.toLowerCase().trim(),$('tw-link.story-menu[name="'+e+'"]').remove()}}})}(),function(){"use strict";var n=Chapel.Audio;function o(e){return e&&"function"==typeof e}function a(e,t){if(!e||"string"!=typeof e)return null;switch(e=e.toLowerCase().trim()){case"isplaying":e="isPlaying";break;case"playwhenpossible":e="playWhenPossible";break;case"ismuted":e="isAMuted";break;case"togglemute":e="toggleMute";break;case"getvolume":e="getVolume";break;case"islooping":e="isLooping";break;case"toggleloop":e="toggleLoop";break;case"fadein":e="fadeIn";break;case"fadeout":e="fadeOut";break;case"fadeto":e="fadeTo";break;case"stopall":e="stopAll"}if("isPlaying"===e&&"master"===t&&(e="audioPlaying"),"group"===t){if(o(n.group.prototype[e]))return e}else if("master"===t){if(o(n[e]))return e}else if(o(n.classes[t].prototype[e]))return e;throw new ReferenceError('Cannot run the command: "'+e+'" on the API "'+t+'". The command may be invalid, or this may be a bug in HAL.',"macros.js -> getCommand()",10)}window.Chapel.Macros.add({newtrack:function(){var e=[].slice.call(arguments);try{return n.newTrack.apply(null,e)}catch(e){alert("Error in the (newtrack:) macro: "+e.message)}},newplaylist:function(e,t){t=[].slice.call(arguments).slice(1);try{return n.createPlaylist(e,t)}catch(e){alert("Error in the (newplaylist:) macro: "+e.message)}},newgroup:function(e,t){t=[].slice.call(arguments).slice(1);try{return n.createGroup(e,t)}catch(e){alert("Error in the (newgroup:) macro: "+e.message)}},masteraudio:function(e){try{return e=a(e,"master"),n[e].apply(null,[].slice.call(arguments).slice(1))}catch(e){alert("Error in the (masteraudio:) macro: "+e.message)}},track:function(e,t){try{var o=n.track(e);return o[t=a(t,"Track")].apply(o,[].slice.call(arguments).slice(2))}catch(e){alert("Error in the (track:) macro: "+e.message)}},playlist:function(e,t){try{var o=n.playlist(e);return o[t=a(t,"Playlist")].apply(o,[].slice.call(arguments).slice(2))}catch(e){alert("Error in the (playlist:) macro: "+e.message)}},group:function(e,t){try{var o=n.group(e);return o[t=a(t,"group")].apply(o,[].slice.call(arguments).slice(2))}catch(e){alert("Error in the (group:) macro: "+e.message)}}})}();
/** End of HAL code */// Custom macros creation
// Harlowe.macro(
// "replace-2",
// function (fraise) {
// console.dir(fraise);
// console.dir(this);
// },
// function (atts) {
// console.dir(atts);
// console.dir(this);
// },
// );
function fadeAnimation(left, top) {
const animation = [
{ left: "0", top: "0", opacity: 1, filter: "blur(0)" },
{
left: `${left}`,
top: `${top}`,
opacity: 0.5,
filter: "blur(1em)",
},
];
return animation;
}
function animationPromise(span, direction, options) {
span.animate(fadeAnimation(direction.left, direction.top), options);
return Promise.all(
span.getAnimations().map((animation) => animation.finished),
);
}
function removeSpan(span) {
try {
span.remove();
} catch (err) {
console.log(err.name, err.message);
}
}
// Animations options constants
const animationDirections = [
[
{
left: "3em",
top: "-5em",
},
{
left: "-5em",
top: "-2em",
},
{
left: "-3em",
top: "1em",
},
],
[
{
left: "4em",
top: "-6em",
},
{
left: "2em",
top: "3em",
},
{
left: "-2em",
top: "-2em",
},
],
[
{
left: "6em",
top: "2em",
},
{
left: "-7em",
top: "-2em",
},
{
left: "-3em",
top: "8em",
},
],
[
{
left: "2em",
top: "8em",
},
{
left: "-4em",
top: "-3em",
},
{
left: "4em",
top: "4em",
},
],
];
const animationOptions = {
duration: 2000,
easing: " cubic-bezier( 0.165, 0.84, 0.44, 1 )",
fill: "both",
};
function animateLink(event) {
// Ajoute une classe pour enlever l'effet de hover sur les éléments déjà cliqués
event.target.classList.add("clicked");
const spans = event.target.getElementsByClassName("effect");
// Choisit un élément de la liste d'animations au hasard
const randEl = Math.floor(Math.random() * animationDirections.length);
for (const [i, direction] of animationDirections[randEl].entries()) {
spans[i].animate(
fadeAnimation(direction.left, direction.top),
animationOptions,
);
// Détection de la fin de l'animation
// animationPromise(spans[i], direction, animationOptions).then(
// () => console.log("nickel"),
// (err) => console.log(err.message),
// );
}
// Make the main element visible again
event.target.parentElement.querySelector(".main").style.visibility =
"visible";
// Après un clic, retire le listener sur l'élément cliqué.
this.removeEventListener(event.type, animateLink);
}
function closeIframe(e) {
e.preventDefault();
document.documentElement.style.setProperty("--color", "#daff7d");
document.documentElement.style.setProperty("--background", "#000014");
// Fonctionne mais sur la même origine seulement
setTimeout(() => {
window.parent.closeImmortelles();
}, 300);
console.log("FIN");
// window.postMessage({ event: "byeframe" });
//
// if (window.top !== window.self) {
// window.postMessage({ event: "byeframe" });
// // window.top.postMessage({ event: "byeframe" });
// }
}
Harlowe.macro(
"end",
function () {},
function () {
let content = "";
// console.table(this.data.descriptor.source);
this.data.descriptor.source.forEach((contentPart) => {
content += contentPart.text;
});
this.descriptor.source = `<tw-enchantment class="link enchantment-link" href="#" tabindex="0" id="nosfuturs"><tw-hook>${content}</tw-hook></tw-enchantment>`;
const link = this.descriptor.target[0];
link.addEventListener("click", closeIframe);
},
);
Harlowe.macro(
"hover",
function () {},
function () {
////////// CONTENT //////////
let content = "";
this.data.descriptor.source.forEach((contentPart) => {
content += contentPart.text;
});
// Remplacement des espace par espaces insécables pour éviter les problèmes de wrapping dans les span.effect
content = content.replace(" ", " ");
this.descriptor.attr.push({
class: function () {
return "olala";
},
});
this.descriptor.source =
"<span class='effect'>" +
content +
"</span><span class='effect'>" +
content +
"</span><span class='effect'>" +
content +
"</span><span class='main'>" +
content +
"</span>";
////////// EVENT LISTENER //////////
const link = this.descriptor.target[0];
link.addEventListener("click", animateLink);
},
);
// TODO: détecter le changement de tags pour faire une animation de l'opacité du filtre svg sur le body
// TODO: ajouter une nav en js par-dessus Twine
// Utile pour debugging ?
console.log(Harlowe.helpers.getPassageData("workshop"));