diff --git a/pages/all/flash-cards/index.njk b/pages/all/flash-cards/index.njk index 9e0dcf8..b8a8fa9 100644 --- a/pages/all/flash-cards/index.njk +++ b/pages/all/flash-cards/index.njk @@ -51,5 +51,5 @@ eleventyExcludeFromCollections: true {% endblock %} {% block scripts %} - + {% endblock %} diff --git a/pages/all/multiple-choice/index.njk b/pages/all/multiple-choice/index.njk index 6e99697..3ee94cd 100644 --- a/pages/all/multiple-choice/index.njk +++ b/pages/all/multiple-choice/index.njk @@ -52,5 +52,4 @@ eleventyExcludeFromCollections: true {% block scripts %} - {% endblock %} diff --git a/pages/all/short-answer/index.njk b/pages/all/short-answer/index.njk index 741955b..b7b0281 100644 --- a/pages/all/short-answer/index.njk +++ b/pages/all/short-answer/index.njk @@ -52,5 +52,4 @@ eleventyExcludeFromCollections: true {% block scripts %} - {% endblock %} diff --git a/pages/flash-cards/index.njk b/pages/flash-cards/index.njk index 33f7d0b..3d1a522 100644 --- a/pages/flash-cards/index.njk +++ b/pages/flash-cards/index.njk @@ -49,5 +49,5 @@ eleventyExcludeFromCollections: true {% endblock %} {% block scripts %} - + {% endblock %} diff --git a/pages/multiple-choice/index.njk b/pages/multiple-choice/index.njk index f196558..1dd179f 100644 --- a/pages/multiple-choice/index.njk +++ b/pages/multiple-choice/index.njk @@ -52,5 +52,4 @@ eleventyExcludeFromCollections: true {% block scripts %} - {% endblock %} diff --git a/pages/short-answer/index.njk b/pages/short-answer/index.njk index 5b5208b..574837c 100644 --- a/pages/short-answer/index.njk +++ b/pages/short-answer/index.njk @@ -51,5 +51,4 @@ eleventyExcludeFromCollections: true {% block scripts %} - {% endblock %} diff --git a/src/js/flash-cards.js b/src/js/flash-cards.js new file mode 100644 index 0000000..3940984 --- /dev/null +++ b/src/js/flash-cards.js @@ -0,0 +1,3 @@ +import { updatePaginationLinks } from './helpers/update-pagination-links'; + +updatePaginationLinks(); diff --git a/src/js/update-pagination-links.js b/src/js/helpers/update-pagination-links.js similarity index 98% rename from src/js/update-pagination-links.js rename to src/js/helpers/update-pagination-links.js index c53b993..1f498e0 100644 --- a/src/js/update-pagination-links.js +++ b/src/js/helpers/update-pagination-links.js @@ -53,7 +53,7 @@ const updateQuestionNumber = (currentQuestionIndex) => { } }; -(() => { +export const updatePaginationLinks = () => { const questionsRaw = sessionStorage.getItem('questions'); const currentQuestionIndexRaw = sessionStorage.getItem( 'currentQuestionIndex' @@ -89,4 +89,4 @@ const updateQuestionNumber = (currentQuestionIndex) => { window.location.href = event.target.href; }); } -})(); +}; diff --git a/src/js/multiple-choice.js b/src/js/multiple-choice.js index a116fbe..0547010 100644 --- a/src/js/multiple-choice.js +++ b/src/js/multiple-choice.js @@ -1,3 +1,5 @@ +import { updatePaginationLinks } from './helpers/update-pagination-links'; + const optionButtons = document.querySelectorAll('.js-multiple-choice'); const explanation = document.querySelector('.js-explanation'); const explanationSection = document.querySelector('.js-explanation-section'); @@ -12,8 +14,10 @@ const handleOptionButtonClick = (event) => { }); event.target.setAttribute('aria-pressed', isPressed ? 'false' : 'true'); - explanationSection.innerHTML = `