<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <title>Startle Machine</title>
        <link rel="stylesheet" href="style.css" />
        <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
        <script type="text/javascript" src="main.js"></script>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <!-- card related -->
        <meta property="og:title" content="Startle Machine" />
        <meta
            property="og:description"
            content="Generates silence occasionally broken up by random sound effects"
        />
        <meta property="org:url" content="https://prank.klemek.fr" />
        <script
            defer
            src="https://tics.klemek.fr/script.js"
            data-website-id="a711dcac-b6d4-47ec-bfc2-ca36c25ff4fd"
        ></script>
    </head>
    <body>
        <main id="app" style="display: none">
            <h1>Startle Machine</h1>
            <p>
                Generates silence occasionally broken up by random sound
                effects.<br />Click the button below and leave this tab to start
                the prank.
            </p>
            <button
                class="start"
                :disabled="started || !canStart"
                @click="start"
            >
                {{ started ? 'You can leave this tab now...' : (canStart ?
                'Start the prank' : 'Select at least one sound') }}
            </button>
            <br />
            <h2>Configuration</h2>
            <table class="config">
                <colgroup>
                    <col style="width: 25%" />
                    <col />
                    <col style="width: 25%" />
                </colgroup>
                <tr>
                    <td><label for="minDelay">Minimum delay:</label></td>
                    <td>
                        <input
                            id="minDelay"
                            type="range"
                            v-model="minDelay"
                            min="1"
                            max="60"
                        />
                    </td>
                    <td>{{ minDelay }} minutes</td>
                </tr>
                <tr>
                    <td><label for="maxDelay">Maximum delay:</label></td>
                    <td>
                        <input
                            id="maxDelay"
                            type="range"
                            v-model="maxDelay"
                            min="1"
                            max="60"
                        />
                    </td>
                    <td>{{ maxDelay }} minutes</td>
                </tr>
                <tr>
                    <td><label for="volume">Volume:</label></td>
                    <td>
                        <input
                            id="volume"
                            type="range"
                            v-model="volume"
                            min="0"
                            max="100"
                        />
                    </td>
                    <td>{{ volume }}%</td>
                </tr>
                <tr>
                    <td><label for="disguise">Disguise as:</label></td>
                    <td colspan="2">
                        <select v-model="fakeId">
                            <option v-for="fake, i in fakes" :value="i">
                                {{ fake.name }} ({{ fake.url }})
                            </option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <button
                            title="Change sound pitch on every play"
                            :class="randomPitch ? '' : 'inactive'"
                            @click="randomPitch = !randomPitch"
                        >
                            Random pitch: {{ randomPitch ? '✅' : '❌' }}
                        </button>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <button
                            title="Clear page content on start"
                            :class="hidePrank ? '' : 'inactive'"
                            @click="hidePrank = !hidePrank"
                        >
                            Blank page on start: {{ hidePrank ? '✅' : '❌' }}
                        </button>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <button
                            title="Redirect to another page when prank is found"
                            :class="redirect ? '' : 'inactive'"
                            @click="redirect = !redirect"
                        >
                            Redirect when found: {{ redirect ? '✅' : '❌' }}
                        </button>
                    </td>
                </tr>
            </table>
            <h3>
                Sounds
                <small
                    ><a href="#" @click="selectAll">Select all</a> -
                    <a href="#" @click="unselectAll">Unselect all</a></small
                >
            </h3>
            <div class="sound-container">
                <button
                    v-for="sound in sounds"
                    :class="sound.active ? '' : 'inactive'"
                    @click="sound.active = !sound.active"
                >
                    {{ sound.name }}
                </button>
            </div>
            <br />
            <small
                ><a href="https://github.com/klemek" target="_blank">@klemek</a>
                -
                <a
                    href="https://github.com/klemek/startle-machine"
                    target="_blank"
                    >Github Repository</a
                >
                - 2024</small
            >
        </main>
    </body>
</html>
