Skip to content

Commit

Permalink
Change docs/js/main.js to a module
Browse files Browse the repository at this point in the history
- The main script is now a module
  • Loading branch information
almic committed Apr 12, 2024
1 parent 81d88da commit 1e1e5cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<link rel="stylesheet" href="css/page.css">
<link rel="stylesheet" href="css/main.css">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<script src="js/basic.js" type="module"></script>
<script src="js/main.js" type="module"></script>

<script src="js/main.js"></script>
<script src="js/basic.js" type="module"></script>

<!-- Code highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/night-owl.min.css">
Expand Down
11 changes: 11 additions & 0 deletions docs/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ async function loadSourceCode(name, path) {
elements.forEach((element) => (element.innerHTML = sourceCode));
}

/**
* Toggles collapsed state on the named elements, and toggles the text on the
* given element
*/
function collapse(self, toggleText, name) {
self.classList.toggle('collapse-active');
if (!self.getAttribute('data-toggle-text')) {
Expand Down Expand Up @@ -67,3 +71,10 @@ function hideButtons(button) {
button.removeAttribute('hidden');
}
}

//@ts-ignore
window.collapse = collapse;
//@ts-ignore
window.hideButtons = hideButtons;
//@ts-ignore
window.loadSourceCode = loadSourceCode;
4 changes: 2 additions & 2 deletions docs/soundscape.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<link rel="stylesheet" href="css/page.css">
<link rel="stylesheet" href="css/main.css">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<script src="js/soundscape.js" type="module"></script>
<script src="js/main.js" type="module"></script>

<script src="js/main.js"></script>
<script src="js/soundscape.js" type="module"></script>

<!-- Code highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/night-owl.min.css">
Expand Down

0 comments on commit 1e1e5cc

Please sign in to comment.