index.html 732 B

1234567891011121314151617181920212223242526
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Baba Yaga</title>
  5. <script src="/static/jquery-3.5.0.min.js"></script>
  6. </head>
  7. <body>
  8. <div id="root"></div>
  9. <script type="application/javascript">
  10. function renderPage() {
  11. if (!window.location.hash) {
  12. window.location.hash = "#index";
  13. }
  14. const currentPage = window.location.hash.substring(1);
  15. const req = new XMLHttpRequest();
  16. req.addEventListener("load", function () {
  17. $("#root").html(JSON.parse(this.responseText).rendered);
  18. });
  19. req.open("GET", `/p/${currentPage}`);
  20. req.setRequestHeader("Accept", "application/json");
  21. req.send();
  22. }
  23. renderPage();
  24. </script>
  25. </body>
  26. </html>