From 94781673dddb4f5ca05723d9b6b33c785cf8fb77 Mon Sep 17 00:00:00 2001 From: DrDrij Date: Sat, 7 Sep 2024 18:03:12 +1000 Subject: [PATCH 1/2] Materials page checks URL for preselected tag --- _layouts/materials.html | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/_layouts/materials.html b/_layouts/materials.html index 0cd1b11..b23af7e 100644 --- a/_layouts/materials.html +++ b/_layouts/materials.html @@ -166,6 +166,47 @@

li.addEventListener('click', addTagToFilter); }); + + // Get the already initialized Choices.js instance + //const selectElement = document.getElementById('mySelect'); + //const choicesInstance = choices; + + // Function to get the value from query string or anchor hash + function getSelectionFromUrl() { + const urlParams = new URLSearchParams(window.location.search); + const hash = window.location.hash.substring(1); + + // Check for query string parameter 'select' first + if (urlParams.has('select')) { + return urlParams.get('select'); + } + // If not found, check for hash value + else if (hash) { + return hash; + } + return null; + } + + // Auto-select the option based on the URL + function autoSelectOption() { + const selection = getSelectionFromUrl(); + if (selection) { + const option = choices.setChoiceByValue(selection); + + let evt = document.createEvent("Event"); + evt.initEvent("change", true, true); + tagSelect.dispatchEvent(evt); + + // Check if the option exists + if (!option) { + console.warn(`Option with value "${selection}" not found.`); + } + } + } + + // Call the autoSelectOption function on page load + autoSelectOption(); + }); From 1f3c88d4f56cab542ac92486ded224ac26dd2efb Mon Sep 17 00:00:00 2001 From: DrDrij Date: Sat, 7 Sep 2024 18:27:38 +1000 Subject: [PATCH 2/2] Update landing page buttons for REMARK and DemARK --- _layouts/home.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_layouts/home.html b/_layouts/home.html index d551dac..38f3833 100755 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -40,9 +40,9 @@

REMARK

R[eplications/eproductions] and Explorations Made using ARK

-

A REMARK is an executable archive that reproduces its own results on any computer using docker

+

A REMARK is an executable archive that reproduces its own results on any computer

- +
@@ -54,7 +54,7 @@

OTHER

View the complete collection of our tools, materials, demonstrations, tutorials, blogs, assignments, documentation, and teaching

- +