include data from request parameter
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 2 May 2019 00:49:47 +0000 (02:49 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 2 May 2019 00:49:47 +0000 (02:49 +0200)
.htaccess [new file with mode: 0644]
widget.html

diff --git a/.htaccess b/.htaccess
new file mode 100644 (file)
index 0000000..f391cd0
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,3 @@
+RewriteEngine  on
+RewriteCond    %{REQUEST_FILENAME}.html -f
+RewriteRule    ^([^/]+)  $1.html
index c604c5912391bc47bd3723a906c89676a45a30f9..ddcff037e93f8d90228421ba5dadc00a05e5640e 100644 (file)
@@ -12,7 +12,9 @@
 <body>
 <p id="clan">No clan data</p>
 <script>
-       fetch('/schtarr/inno.json')
+       let request = window.location.pathname.split('/')
+       request.splice(2, 1) // strip page name
+       fetch(request.join('/') + '.json')
        .then(res => res.json())
        .then(clan => {
                document.getElementById('clan').outerHTML = `