library.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ---
  2. layout: default
  3. ---
  4. <style type="text/css">
  5. #rulename {
  6. font-size: 1.2em;
  7. }
  8. </style>
  9. <script>
  10. function printLibrary() {
  11. const store = new SteinStore(
  12. "https://api.steinhq.com/v1/storages/5e8b937ab88d3d04ae0816a5"
  13. );
  14. var rules = "";
  15. store.read("rules", { limit: 0, offset: 0 }).then(data => {
  16. console.log(data);
  17. rules = data.reverse();
  18. libHTML = "";
  19. for (var i = 0; i < rules.length; i++) {
  20. var title = rules[i]["communityname"]
  21. if (title == null) { title = "Untitled"; }
  22. libHTML += "<h2 id='rulename'>" +
  23. "<a href='/create/?r=" + rules[i]["ruleID"] + "'>" +
  24. title + "</a></h2>\n";
  25. libHTML += "<p>" + rules[i]["structure"] + "</p>\n\n";
  26. }
  27. document.getElementById("libraryList").innerHTML = libHTML;
  28. });
  29. }
  30. window.onload = function() {
  31. printLibrary();
  32. }
  33. </script>
  34. <article class="post">
  35. <header class="post-header">
  36. <h1 class="post-title">{{ page.title }}</h1>
  37. </header>
  38. <div class="post-content">
  39. {{ content }}
  40. <hr /><br />
  41. <div id="libraryList">
  42. </div>
  43. </div>
  44. </article>