Skip to content

Commit

Permalink
Add more support for older browsers and add minified main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
CurbaiCode committed Aug 20, 2024
1 parent 57a9dc5 commit baf2ac4
Show file tree
Hide file tree
Showing 6 changed files with 465 additions and 376 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 id="title">Home</h1>
</div>
<ul class="head-right">
<section id="toolbar">
<li><button onclick="modal()"><span>Settings</span><i class="gs">gear</i></button></li>
<li><button onclick="modal('settings')"><span>Settings</span><i class="gs">gear</i></button></li>
</section>
<li class="menu"><button onclick="menu('toolbar')"><i class="gs">chevron-down</i></button></li>
</ul>
Expand Down Expand Up @@ -100,6 +100,6 @@ <h1 id="modal-title">Modal</h1>
</div>
<script src="https://cdn.jsdelivr.net/gh/CurbaiCode/[email protected]/scripts/gustsymbols.min.js"></script>
<script src="scripts/msgpackr.min.js"></script>
<script src="scripts/main.js"></script>
<script src="scripts/main.min.js"></script>
</body>
</html>
39 changes: 32 additions & 7 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ function libCatalog() { // Get collections
slide("collection", "lib", c, document.getElementById("books").innerHTML == "" || (curCollection && c.id != curCollection.id)); // Load books the first time, then if different collection
});
})();
item.append(img, label);
item.appendChild(img);
item.appendChild(label);
el.appendChild(item);
}
libraryCache = library;
Expand All @@ -432,7 +433,8 @@ function libCatalog() { // Get collections
var action = document.createElement("button");
action.textContent = "Try Again";
action.id = "action"; // For adding click listener
err.append(msg, action);
err.appendChild(msg);
err.appendChild(action);
} else {
err.appendChild(msg);
}
Expand Down Expand Up @@ -531,7 +533,18 @@ function bookCatalog() { // Get parts
for (var part of book.parts) {
var item = document.createElement("li");
var label = document.createElement("p");
label.textContent = part.name;
var tc = document.createTextNode(part.name);
if (part.before) {
var before = document.createElement("span");
before.textContent = part.before;
label.appendChild(before);
}
label.appendChild(tc);
if (part.after) {
var after = document.createElement("span");
after.textContent = part.after;
label.appendChild(after);
}
(function () {
var p = part;
if (p.chapters) {
Expand Down Expand Up @@ -581,7 +594,18 @@ function partCatalog() { // Get chapters
for (var chapter of chapters) {
var item = document.createElement("li");
var label = document.createElement("p");
label.textContent = chapter.name;
var tc = document.createTextNode(chapter.name);
if (chapter.before) {
var before = document.createElement("span");
before.textContent = chapter.before;
label.appendChild(before);
}
label.appendChild(tc);
if (chapter.after) {
var after = document.createElement("span");
after.textContent = chapter.after;
label.appendChild(after);
}
(function () {
var c = chapter;
item.addEventListener("click", function () {
Expand Down Expand Up @@ -731,9 +755,10 @@ function parseNote(el, note) {
function note(link) {
var id = link.id.slice(1);
var t = "";
for (var child of link.childNodes) { // Search for title label
if (child.nodeType == Node.TEXT_NODE) {
t = child.nodeValue;
var cn = link.childNodes;
for (var i = 0; i < cn.length; i++) { // Search for title label
if (cn[i].nodeType == Node.TEXT_NODE) {
t = cn[i].nodeValue;
break;
}
}
Expand Down
Loading

0 comments on commit baf2ac4

Please sign in to comment.