Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored quizdown setup to allow for multiple quizzes per page; Reo… #409

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/addendum/github-certs-quizzes/github-action-cert.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ This quiz is designed to help prepare you for your upcoming GitHub Action Certif

## Quiz

<div id="quizdown">
<div id="quiz-github-action-cert.js" ></div>
<div class="quizdown">
<div id="addendum/github-certs-quizzes/github-action-cert.js" ></div>
</div>
15 changes: 8 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<script src="https://cdn.jsdelivr.net/npm/quizdown@latest/public/build/quizdown.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quizdown@latest/public/build/extensions/quizdownKatex.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quizdown@latest/public/build/extensions/quizdownHighlight.js"></script>
<script>quizdown.register(quizdownHighlight).register(quizdownKatex).init()</script>
<script>quizdown.register(quizdownHighlight).register(quizdownKatex).init()</script>

<link rel="stylesheet" href="/fontawesome/css/all.min.css" >
<link rel="stylesheet" href="css/common.css">
Expand All @@ -31,7 +31,7 @@
<body>
<div id="app">Loading...</div>
<script src="//unpkg.com/[email protected]/index.js"></script>

<script>
window.$docsify = {
name: 'Liatrio\'s DevOps Bootcamp',
Expand Down Expand Up @@ -75,15 +75,16 @@
// Quizdown
function(hook) {
hook.doneEach(function () {
let node = document.getElementById('quizdown');
let node = document.getElementsByClassName('quizdown');
const config = {
'locale': 'en',
'locale': 'en',
'shuffleAnswers': false,
'primaryColor': '#24ae1dff',
};
if (node && node.firstElementChild) {
import(`./src/quizzes/${node.firstElementChild.id}`).then(module => {
for (let i = 0; i < node.length; i++) {
import(`./src/quizzes/${node[i].firstElementChild.id}`).then(module => {
const { rawQuizdown } = module;
quizdown.createApp(rawQuizdown, node, config);
quizdown.createApp(rawQuizdown, node[i], config);
}).catch(error => {
console.error("Error importing quiz, make sure the file name matches the quizdown inner div's id: ", error);
});
Expand Down
Loading