1
0
Fork 0
Browse Source

fix: repair external links

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
lido-space
André Jaenisch 10 months ago
parent
commit
e7d8635c8f
Signed by: ryuno-ki
GPG Key ID: 5A668E771F1ED854
  1. 2
      public/client.js
  2. 22
      public/index.html
  3. 14
      src/index.html
  4. 24
      src/js/client/init.js

2
public/client.js

File diff suppressed because one or more lines are too long

22
public/index.html

@ -20,7 +20,7 @@
<div>
<a href="#scene-user-form">Play a game</a>
<a href="#scene-settings">Settings</a>
<a href="#scene-credits">See the credits</a>
<a href="#scene-credits">Credits</a>
</div>
</section>
<section id="scene-user-form" tabindex="0" style="display: none;">
@ -149,7 +149,7 @@
<p>Good game, <span id="highscore-name">stranger</span>!</p>
<table id="highscore"></table>
<p>
<a id="tweet"></a>
<a id="tweet" target="_blank"></a>
<button type="button" onclick="location.reload()">
Back to start
</button>
@ -176,17 +176,27 @@
<h2>Credits</h2>
<p>
This game was inspired by
<a href="https://en.wikipedia.org/wiki/Qix">Qix</a>.
<a href="https://en.wikipedia.org/wiki/Qix" target="_blank">Qix</a>.
</p>
<p>
<a href="https://killedbyapixel.github.io/ZzFX/">ZzFX</a>
<a href="https://killedbyapixel.github.io/ZzFX/" target="_blank">ZzFX</a>
is used for sound effects.
</p>
<p>
Resources are bundled using
<a href="https://rollupjs.org/">Rollup</a>
<a href="https://rollupjs.org/" target="_blank">Rollup</a>
and
<a href="https://clean-css.github.io/">clean-css</a>.
<a href="https://clean-css.github.io/" target="_blank">clean-css</a>.
</p>
<p>
Find the source code at
<a href="https://jaenis.ch/hobbies/coding/repos/ryuno-ki/js13kgames-2021/src/branch/lido-space" target="_blank">
my Gitea instance
</a>
or
<a href="https://github.com/Ryuno-Ki/js13kgames-2021/tree/lido-space" target="_blank">
on GitHub
</a>.
</p>
<p><a href="#scene-title">Back to start</a></p>
</section>

14
src/index.html

@ -149,7 +149,7 @@
<p>Good game, <span id="highscore-name">stranger</span>!</p>
<table id="highscore"></table>
<p>
<a id="tweet"></a>
<a id="tweet" target="_blank"></a>
<button type="button" onclick="location.reload()">
Back to start
</button>
@ -176,25 +176,25 @@
<h2>Credits</h2>
<p>
This game was inspired by
<a href="https://en.wikipedia.org/wiki/Qix">Qix</a>.
<a href="https://en.wikipedia.org/wiki/Qix" target="_blank">Qix</a>.
</p>
<p>
<a href="https://killedbyapixel.github.io/ZzFX/">ZzFX</a>
<a href="https://killedbyapixel.github.io/ZzFX/" target="_blank">ZzFX</a>
is used for sound effects.
</p>
<p>
Resources are bundled using
<a href="https://rollupjs.org/">Rollup</a>
<a href="https://rollupjs.org/" target="_blank">Rollup</a>
and
<a href="https://clean-css.github.io/">clean-css</a>.
<a href="https://clean-css.github.io/" target="_blank">clean-css</a>.
</p>
<p>
Find the source code at
<a href="https://jaenis.ch/hobbies/coding/repos/ryuno-ki/js13kgames-2021/src/branch/lido-space">
<a href="https://jaenis.ch/hobbies/coding/repos/ryuno-ki/js13kgames-2021/src/branch/lido-space" target="_blank">
my Gitea instance
</a>
or
<a href="https://github.com/Ryuno-Ki/js13kgames-2021/tree/lido-space">
<a href="https://github.com/Ryuno-Ki/js13kgames-2021/tree/lido-space" target="_blank">
on GitHub
</a>.
</p>

24
src/js/client/init.js

@ -211,15 +211,17 @@ function makeMatch () {
* Chromium web browser.
*/
function patchLinks () {
Array.from(document.querySelectorAll('a')).forEach((link) => {
link.addEventListener('click', (e) => {
const href = link.getAttribute('href')
if (href) {
e.preventDefault()
const target = href.slice('#scene-'.length)
navigate(target)
}
}, false)
})
Array.from(document.querySelectorAll('a'))
.filter((link) => !link.target)
.forEach((link) => {
link.addEventListener('click', (e) => {
const href = link.getAttribute('href')
if (href) {
e.preventDefault()
const target = href.slice('#scene-'.length)
navigate(target)
}
}, false)
})
}

Loading…
Cancel
Save