optimize scripts
This commit is contained in:
parent
c07fc2070f
commit
d0f331f15a
7 changed files with 20 additions and 9 deletions
|
@ -1,12 +1,12 @@
|
||||||
// both
|
// both
|
||||||
function send(message) {
|
function send(message) {
|
||||||
let r = new XMLHttpRequest();
|
const r = new XMLHttpRequest();
|
||||||
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
|
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
|
||||||
r.setRequestHeader("Content-Type", "text/plain");
|
r.setRequestHeader("Content-Type", "text/plain");
|
||||||
r.send(message);
|
r.send(message);
|
||||||
}
|
}
|
||||||
// send notification
|
// send notification
|
||||||
let ntfyInput = document.getElementById("ntfy-input");
|
const ntfyInput = document.getElementById("ntfy-input");
|
||||||
function sendNotification() {
|
function sendNotification() {
|
||||||
if (ntfyInput.value.length <= 0) return;
|
if (ntfyInput.value.length <= 0) return;
|
||||||
send(ntfyInput.value);
|
send(ntfyInput.value);
|
||||||
|
|
5
astro/src/components/nochrome-scripts.astro
Normal file
5
astro/src/components/nochrome-scripts.astro
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!-- optimized -->
|
||||||
|
<script src="../scripts/sound.js"></script>
|
||||||
|
|
||||||
|
<!-- unoptimized -->
|
||||||
|
<script is:inline src="/scripts/galactic-font.js"></script>
|
9
astro/src/components/normal-scripts.astro
Normal file
9
astro/src/components/normal-scripts.astro
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
<!-- optimized -->
|
||||||
|
<script src="../scripts/lastfm.js"></script>
|
||||||
|
<script src="../scripts/sound.js"></script>
|
||||||
|
|
||||||
|
<!-- unoptimized -->
|
||||||
|
<script is:inline src="/scripts/ntfy.js"></script>
|
||||||
|
<script is:inline src="/scripts/fuckchrome.js"></script>
|
||||||
|
<script is:inline src="/scripts/sga.js"></script>
|
|
@ -2,6 +2,7 @@
|
||||||
import Header from "../components/Header.astro";
|
import Header from "../components/Header.astro";
|
||||||
import Head from "../components/Head.astro";
|
import Head from "../components/Head.astro";
|
||||||
import Footer from "../components/Footer.astro";
|
import Footer from "../components/Footer.astro";
|
||||||
|
import NochromeScripts from "../components/nochrome-scripts.astro";
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +24,6 @@ const { title } = Astro.props;
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<Footer />
|
<Footer />
|
||||||
<script src="/scripts/rain.js"></script>
|
<NochromeScripts />
|
||||||
<script src="/scripts/galactic-font.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import Head from "../components/Head.astro";
|
import Head from "../components/Head.astro";
|
||||||
import Header from "../components/Header.astro";
|
import Header from "../components/Header.astro";
|
||||||
import Footer from "../components/Footer.astro";
|
import Footer from "../components/Footer.astro";
|
||||||
|
import NormalScripts from "../components/normal-scripts.astro";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -22,11 +23,7 @@ const { title } = Astro.props;
|
||||||
</section>
|
</section>
|
||||||
<slot />
|
<slot />
|
||||||
<Footer />
|
<Footer />
|
||||||
<script src="/scripts/sga.js"></script>
|
<NormalScripts />
|
||||||
<script src="/scripts/lastfm.js"></script>
|
|
||||||
<script src="/scripts/sound.js"></script>
|
|
||||||
<script src="/scripts/ntfy.js"></script>
|
|
||||||
<script src="/scripts/fuckchrome.js"></script>
|
|
||||||
<audio
|
<audio
|
||||||
id="clickSound"
|
id="clickSound"
|
||||||
src="/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3">
|
src="/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3">
|
||||||
|
|
Loading…
Reference in a new issue