include data from local request parameter
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 13 May 2019 21:12:00 +0000 (23:12 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 13 May 2019 21:12:00 +0000 (23:12 +0200)
Like v0.1-7-g1d18af433a (2019-05-02) [include data from request parameter]
but using topmost window (supporting original path of iframe redirects
such as in riot.im widgets).

widget.html

index 12d83e6e653f8f0307edfa3d93f658fcc5e3f27c..64f35a252f067397445d576128b16e10c74b478a 100644 (file)
@@ -12,7 +12,9 @@
 <body>
 <p id="clan">No clan data</p>
 <script>
-       fetch('/schtarr/inno.json')
+       let request = this.location.pathname.split('/')
+       request.splice(2, 1) // strip page name
+       fetch(request.join('/') + '.json')
        .then(res => {
                if (res.status != 200) {
                        console.log('got %o', res)