123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- ---
- layout: default
- ---
- <script>
- // Main Library-printing function
- function printLibrary(sheet) {
- const store = new SteinStore(
- "https://api.steinhq.com/v1/storages/5e8b937ab88d3d04ae0816a5"
- );
- var rules = "";
- store.read(sheet, { limit: 0, offset: 0 }).then(data => {
- rules = data.reverse();
- libHTML = "";
- // iterating over all the rules
- for (var i = 0; i < rules.length; i++) {
- libHTML += "<div class='library-item'>\n";
- // first the titles
- var title = rules[i]["communityname"];
- if (title == null) { title = "Untitled"; }
- libHTML += "<div class='library-rule-name'>" +
- "<a href='/create/?r=" + rules[i]["ruleID"] + "'>" +
- title + "</a></div>\n";
- // then the authors
- var author = rules[i]["author-text"];
- if (author != null) {
- libHTML += "<div class='library-rule-author'>" + author + "</div>";
- }
- // then the structures
- var structure = rules[i]["structure"];
- if (structure != null) {
- libHTML += "<p class='library-rule-structure'>" + structure;
- libHTML += "</p>\n\n";
- }
- // then the modules
- var modulesRaw = rules[i]["modules"];
- if (modulesRaw != null) {
- libHTML += "<div class='library-module-list'>";
- var modulesDOM = document.createElement("DIV");
- modulesDOM.innerHTML = "<div>" + modulesRaw + "</div>";
- var modules = modulesDOM.getElementsByClassName("module");
- for (var x = 0; x < modules.length; x++) {
- var moduleName = modules[x].children.item("module-name").innerHTML;
- libHTML += "<div class='module library-module'>" +
- moduleName + "</div>\n";
- }
- moduleName + "</div>\n";
- }
- libHTML += "</div>\n</div>\n";
- }
- libHTML += "</div>\n";
- document.getElementById("librarylist").innerHTML = libHTML;
- });
- }
- // allows for using alt sheets (though rule.html is not equipped)
- var source = "";
- window.onload = function() {
- if ((window.location.href.indexOf("/library/") != -1)) {
- source = "rules";
- }
- printLibrary(source);
- }
- </script>
- <article class="post">
- <header class="post-header">
- <h1 class="post-title">{{ page.title }}</h1>
- </header>
- <div class="post-content">
- {{ content }}
-
- <div id="librarylist">
- </div>
- </div>
- </article>
|