From aaac22beff500c57bc863d64b5f0e8c96ae5da06 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 09:58:25 +0200 Subject: [PATCH 01/52] testing custom start button --- book/_config.yml | 12 ++++++++---- book/some_content/_custom_launch_button.js | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 book/some_content/_custom_launch_button.js diff --git a/book/_config.yml b/book/_config.yml index 011975c..efaedca 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -30,10 +30,11 @@ sphinx: # Options passed on to the use_edit_page_button: true # Replace with false if you don't want the edit page button (i.e. if you don't user to propose changes themselves or have a private repo) use_repository_button: true # Replace with false if you don't want the repository button (i.e. if you have a private repo) use_issues_button : true # Replace with false if you don't want the issues button (i.e. if you don't want to use GitHub issues or have a private repo) - launch_buttons: - jupyterhub_url: https://ewatercycle2526.ewatercycle-tud.src.surf-hosted.nl/jupyter # server is not operational - notebook_interface: "jupyterlab" - thebe: true # Required for live code: https://teachbooks.io/manual/features/live_code.html +# launch_buttons: +# jupyterhub_url: https://ewatercycle2526.ewatercycle-tud.src.surf-hosted.nl/jupyter # server is not operational +# notebook_interface: "jupyterlab" +# thebe: true # Required for live code: https://teachbooks.io/manual/features/live_code.html + html_show_copyright: false # As the copyright is included in the author field html_last_updated_fmt: '%B %-d, %Y' # Adds the date of the last update to the footer html_static_path: ["figures"] # Add folder that contain files that need to be included, such as the location of the logo(s) @@ -52,5 +53,8 @@ sphinx: # Options passed on to the - sphinx_named_colors # Allows you to use custom colors in your book https://teachbooks.io/manual/external/Sphinx-Named-Colors/README.html - sphinx_dropdown_toggle # Adds a button to toggle all dropdowns with one click + html: + extra_js: + - _custom_launch_button.js bibtex_bibfiles: - references.bib # Required for references diff --git a/book/some_content/_custom_launch_button.js b/book/some_content/_custom_launch_button.js new file mode 100644 index 0000000..07a4764 --- /dev/null +++ b/book/some_content/_custom_launch_button.js @@ -0,0 +1,17 @@ +window.addEventListener("DOMContentLoaded", () => { + const launchButton = document.querySelector(".jb-button.launch-button"); + + if (launchButton) { + launchButton.addEventListener("click", (event) => { + event.preventDefault(); // Prevent default behavior + const userUrl = prompt("Enter your JupyterHub server URL (e.g., https://yourhub.domain):"); + + if (userUrl && userUrl.startsWith("https://")) { + const interface = "lab"; // or "tree" if you prefer classic + window.open(`${userUrl}/${interface}`, "_blank"); + } else { + alert("Please enter a valid HTTPS URL."); + } + }); + } +}); From 57f6cee815067222e6ec527a5557febc78697476 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:02:49 +0200 Subject: [PATCH 02/52] updated workflow for development branch --- .github/workflows/call-deploy-book.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/call-deploy-book.yml b/.github/workflows/call-deploy-book.yml index 30850c6..769f03e 100644 --- a/.github/workflows/call-deploy-book.yml +++ b/.github/workflows/call-deploy-book.yml @@ -3,7 +3,7 @@ name: call-deploy-book on: push: branches: - - 'main' + - 'development' # If your git repository has the Jupyter Book within some-subfolder next to # unrelated files, you can make this run only if a file within that specific # folder (or the workflow file itself) has been modified. From 6ab765e8ff904fb6995a7beaca9f4defbe7394ae Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:08:19 +0200 Subject: [PATCH 03/52] testing custom launch button --- book/_config.yml | 2 +- .../custom_launch_button.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename book/{some_content/_custom_launch_button.js => _static/custom_launch_button.js} (100%) diff --git a/book/_config.yml b/book/_config.yml index efaedca..c06866f 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -55,6 +55,6 @@ sphinx: # Options passed on to the html: extra_js: - - _custom_launch_button.js + - _static/custom_launch_button.js bibtex_bibfiles: - references.bib # Required for references diff --git a/book/some_content/_custom_launch_button.js b/book/_static/custom_launch_button.js similarity index 100% rename from book/some_content/_custom_launch_button.js rename to book/_static/custom_launch_button.js From 90b7464a7ae86fd07c6b18bddb5a4bc819cf6861 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:13:59 +0200 Subject: [PATCH 04/52] testing custom launch button --- book/_config.yml | 8 ++--- book/_static/custom_launch_button.js | 46 ++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/book/_config.yml b/book/_config.yml index c06866f..f9aefab 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -30,10 +30,10 @@ sphinx: # Options passed on to the use_edit_page_button: true # Replace with false if you don't want the edit page button (i.e. if you don't user to propose changes themselves or have a private repo) use_repository_button: true # Replace with false if you don't want the repository button (i.e. if you have a private repo) use_issues_button : true # Replace with false if you don't want the issues button (i.e. if you don't want to use GitHub issues or have a private repo) -# launch_buttons: -# jupyterhub_url: https://ewatercycle2526.ewatercycle-tud.src.surf-hosted.nl/jupyter # server is not operational -# notebook_interface: "jupyterlab" -# thebe: true # Required for live code: https://teachbooks.io/manual/features/live_code.html + launch_buttons: + jupyterhub_url: https://ewatercycle2526.ewatercycle-tud.src.surf-hosted.nl/jupyter # server is not operational + notebook_interface: "jupyterlab" + thebe: true # Required for live code: https://teachbooks.io/manual/features/live_code.html html_show_copyright: false # As the copyright is included in the author field html_last_updated_fmt: '%B %-d, %Y' # Adds the date of the last update to the footer diff --git a/book/_static/custom_launch_button.js b/book/_static/custom_launch_button.js index 07a4764..4aebd66 100644 --- a/book/_static/custom_launch_button.js +++ b/book/_static/custom_launch_button.js @@ -1,17 +1,45 @@ window.addEventListener("DOMContentLoaded", () => { + // Create modal HTML + const modalHTML = ` + + `; + document.body.insertAdjacentHTML("beforeend", modalHTML); + const launchButton = document.querySelector(".jb-button.launch-button"); + const modal = document.getElementById("customModal"); + const input = document.getElementById("jupyterUrlInput"); + const launchBtn = document.getElementById("launchBtn"); + const cancelBtn = document.getElementById("cancelBtn"); if (launchButton) { launchButton.addEventListener("click", (event) => { - event.preventDefault(); // Prevent default behavior - const userUrl = prompt("Enter your JupyterHub server URL (e.g., https://yourhub.domain):"); - - if (userUrl && userUrl.startsWith("https://")) { - const interface = "lab"; // or "tree" if you prefer classic - window.open(`${userUrl}/${interface}`, "_blank"); - } else { - alert("Please enter a valid HTTPS URL."); - } + event.preventDefault(); + modal.style.display = "block"; }); } + + launchBtn.addEventListener("click", () => { + const url = input.value.trim(); + if (url.startsWith("https://")) { + window.open(`${url}/lab`, "_blank"); + modal.style.display = "none"; + input.value = ""; + } else { + alert("Please enter a valid HTTPS URL."); + } + }); + + cancelBtn.addEventListener("click", () => { + modal.style.display = "none"; + input.value = ""; + }); }); From 06503c9d447e14c5addcf68f5a55989c6bd83fc9 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:27:44 +0200 Subject: [PATCH 05/52] testing custom launch button --- book/_config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/book/_config.yml b/book/_config.yml index f9aefab..feae7af 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -35,6 +35,9 @@ sphinx: # Options passed on to the notebook_interface: "jupyterlab" thebe: true # Required for live code: https://teachbooks.io/manual/features/live_code.html + html: + extra_js: + - _static/custom_launch_button.js html_show_copyright: false # As the copyright is included in the author field html_last_updated_fmt: '%B %-d, %Y' # Adds the date of the last update to the footer html_static_path: ["figures"] # Add folder that contain files that need to be included, such as the location of the logo(s) @@ -53,8 +56,6 @@ sphinx: # Options passed on to the - sphinx_named_colors # Allows you to use custom colors in your book https://teachbooks.io/manual/external/Sphinx-Named-Colors/README.html - sphinx_dropdown_toggle # Adds a button to toggle all dropdowns with one click - html: - extra_js: - - _static/custom_launch_button.js + bibtex_bibfiles: - references.bib # Required for references From 894a71bd968b72f7542f2b6a3ca19a998b22aed2 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:33:50 +0200 Subject: [PATCH 06/52] testing custom launch button --- book/_config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/_config.yml b/book/_config.yml index feae7af..6c1dceb 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -35,9 +35,9 @@ sphinx: # Options passed on to the notebook_interface: "jupyterlab" thebe: true # Required for live code: https://teachbooks.io/manual/features/live_code.html - html: - extra_js: - - _static/custom_launch_button.js + html: + extra_js: + - _static/custom_launch_button.js html_show_copyright: false # As the copyright is included in the author field html_last_updated_fmt: '%B %-d, %Y' # Adds the date of the last update to the footer html_static_path: ["figures"] # Add folder that contain files that need to be included, such as the location of the logo(s) From fc9d412b9a0dce51f87a3f90fb87a5d6c4c9a9e3 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:38:53 +0200 Subject: [PATCH 07/52] testing custom launch button --- book/_static/custom_launch_button.js | 59 ++++++++---------------- book/_static/custom_launch_button_old.js | 45 ++++++++++++++++++ 2 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 book/_static/custom_launch_button_old.js diff --git a/book/_static/custom_launch_button.js b/book/_static/custom_launch_button.js index 4aebd66..c49d066 100644 --- a/book/_static/custom_launch_button.js +++ b/book/_static/custom_launch_button.js @@ -1,45 +1,24 @@ window.addEventListener("DOMContentLoaded", () => { - // Create modal HTML - const modalHTML = ` - - `; - document.body.insertAdjacentHTML("beforeend", modalHTML); + const targetContainer = document.querySelector(".launch-buttons"); - const launchButton = document.querySelector(".jb-button.launch-button"); - const modal = document.getElementById("customModal"); - const input = document.getElementById("jupyterUrlInput"); - const launchBtn = document.getElementById("launchBtn"); - const cancelBtn = document.getElementById("cancelBtn"); + if (targetContainer) { + // Create the new button + const customButton = document.createElement("a"); + customButton.textContent = "Launch Custom JupyterHub"; + customButton.className = "jb-button custom-launch-button"; + customButton.style.marginLeft = "10px"; + customButton.style.backgroundColor = "#007ACC"; + customButton.style.color = "white"; + customButton.style.padding = "6px 12px"; + customButton.style.borderRadius = "4px"; + customButton.style.textDecoration = "none"; - if (launchButton) { - launchButton.addEventListener("click", (event) => { - event.preventDefault(); - modal.style.display = "block"; - }); - } - - launchBtn.addEventListener("click", () => { - const url = input.value.trim(); - if (url.startsWith("https://")) { - window.open(`${url}/lab`, "_blank"); - modal.style.display = "none"; - input.value = ""; - } else { - alert("Please enter a valid HTTPS URL."); - } - }); + // Set your custom URL here + const customUrl = "https://your-custom-jupyterhub-url/lab"; + customButton.href = customUrl; + customButton.target = "_blank"; - cancelBtn.addEventListener("click", () => { - modal.style.display = "none"; - input.value = ""; - }); + // Add the button to the page + targetContainer.appendChild(customButton); + } }); diff --git a/book/_static/custom_launch_button_old.js b/book/_static/custom_launch_button_old.js new file mode 100644 index 0000000..4aebd66 --- /dev/null +++ b/book/_static/custom_launch_button_old.js @@ -0,0 +1,45 @@ +window.addEventListener("DOMContentLoaded", () => { + // Create modal HTML + const modalHTML = ` + + `; + document.body.insertAdjacentHTML("beforeend", modalHTML); + + const launchButton = document.querySelector(".jb-button.launch-button"); + const modal = document.getElementById("customModal"); + const input = document.getElementById("jupyterUrlInput"); + const launchBtn = document.getElementById("launchBtn"); + const cancelBtn = document.getElementById("cancelBtn"); + + if (launchButton) { + launchButton.addEventListener("click", (event) => { + event.preventDefault(); + modal.style.display = "block"; + }); + } + + launchBtn.addEventListener("click", () => { + const url = input.value.trim(); + if (url.startsWith("https://")) { + window.open(`${url}/lab`, "_blank"); + modal.style.display = "none"; + input.value = ""; + } else { + alert("Please enter a valid HTTPS URL."); + } + }); + + cancelBtn.addEventListener("click", () => { + modal.style.display = "none"; + input.value = ""; + }); +}); From 147925c4bf4970def2afcc34e121f15ed8348241 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:42:35 +0200 Subject: [PATCH 08/52] testing custom launch button --- book/_config.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/book/_config.yml b/book/_config.yml index 6c1dceb..6acae4f 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -11,6 +11,8 @@ only_build_toc_files: true # Replace this with false i html: favicon : "figures/ewatercycle_logo.png" # Replace this with your own favicon baseurl : "https://www.ewatercycle.org/getting-started" # Replace this with your own URL + extra_js: + - _static/custom_launch_button.js sphinx: # Options passed on to the underlying sphinx-parser config: @@ -34,10 +36,6 @@ sphinx: # Options passed on to the jupyterhub_url: https://ewatercycle2526.ewatercycle-tud.src.surf-hosted.nl/jupyter # server is not operational notebook_interface: "jupyterlab" thebe: true # Required for live code: https://teachbooks.io/manual/features/live_code.html - - html: - extra_js: - - _static/custom_launch_button.js html_show_copyright: false # As the copyright is included in the author field html_last_updated_fmt: '%B %-d, %Y' # Adds the date of the last update to the footer html_static_path: ["figures"] # Add folder that contain files that need to be included, such as the location of the logo(s) From 2bdd7228e0e9513f006bbff16f7a3161693f1fa9 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 10:46:17 +0200 Subject: [PATCH 09/52] testing custom launch button --- book/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/_config.yml b/book/_config.yml index 6acae4f..89bf9f8 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -12,7 +12,7 @@ html: favicon : "figures/ewatercycle_logo.png" # Replace this with your own favicon baseurl : "https://www.ewatercycle.org/getting-started" # Replace this with your own URL extra_js: - - _static/custom_launch_button.js + - _static/custom_launch_button_old.js sphinx: # Options passed on to the underlying sphinx-parser config: From ee7b14dcf614057b0f4f88fe3df0332558d5bee2 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 11:00:44 +0200 Subject: [PATCH 10/52] testing custom launch button --- book/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/_config.yml b/book/_config.yml index 89bf9f8..6acae4f 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -12,7 +12,7 @@ html: favicon : "figures/ewatercycle_logo.png" # Replace this with your own favicon baseurl : "https://www.ewatercycle.org/getting-started" # Replace this with your own URL extra_js: - - _static/custom_launch_button_old.js + - _static/custom_launch_button.js sphinx: # Options passed on to the underlying sphinx-parser config: From da55e455c58351aec496232791926be66b20e1a0 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 11:02:21 +0200 Subject: [PATCH 11/52] testing custom launch button --- book/_static/custom_launch_button.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/book/_static/custom_launch_button.js b/book/_static/custom_launch_button.js index c49d066..345b0d1 100644 --- a/book/_static/custom_launch_button.js +++ b/book/_static/custom_launch_button.js @@ -1,24 +1,22 @@ window.addEventListener("DOMContentLoaded", () => { - const targetContainer = document.querySelector(".launch-buttons"); + const header = document.querySelector("header"); - if (targetContainer) { - // Create the new button + if (header) { const customButton = document.createElement("a"); customButton.textContent = "Launch Custom JupyterHub"; - customButton.className = "jb-button custom-launch-button"; - customButton.style.marginLeft = "10px"; + customButton.className = "custom-launch-button"; customButton.style.backgroundColor = "#007ACC"; customButton.style.color = "white"; customButton.style.padding = "6px 12px"; + customButton.style.marginLeft = "10px"; customButton.style.borderRadius = "4px"; customButton.style.textDecoration = "none"; + customButton.style.fontWeight = "bold"; // Set your custom URL here - const customUrl = "https://your-custom-jupyterhub-url/lab"; - customButton.href = customUrl; + customButton.href = "https://your-custom-jupyterhub-url/lab"; customButton.target = "_blank"; - // Add the button to the page - targetContainer.appendChild(customButton); + header.appendChild(customButton); } }); From d666f48c98bc4af351a497d94c594aeeaffc2251 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 11:09:42 +0200 Subject: [PATCH 12/52] testing custom launch button --- book/_static/custom_launch_button.js | 48 +++++++++++++++++--- book/_static/custom_launch_button_old.js | 57 +++++++----------------- 2 files changed, 60 insertions(+), 45 deletions(-) diff --git a/book/_static/custom_launch_button.js b/book/_static/custom_launch_button.js index 345b0d1..a97e544 100644 --- a/book/_static/custom_launch_button.js +++ b/book/_static/custom_launch_button.js @@ -1,9 +1,24 @@ window.addEventListener("DOMContentLoaded", () => { - const header = document.querySelector("header"); + // Create the modal HTML + const modalHTML = ` + + `; + document.body.insertAdjacentHTML("beforeend", modalHTML); + // Create the custom button + const header = document.querySelector("header"); if (header) { const customButton = document.createElement("a"); - customButton.textContent = "Launch Custom JupyterHub"; + customButton.textContent = "🚀 Launch eWaterCycle JupyterHub"; customButton.className = "custom-launch-button"; customButton.style.backgroundColor = "#007ACC"; customButton.style.color = "white"; @@ -12,11 +27,34 @@ window.addEventListener("DOMContentLoaded", () => { customButton.style.borderRadius = "4px"; customButton.style.textDecoration = "none"; customButton.style.fontWeight = "bold"; + customButton.style.cursor = "pointer"; - // Set your custom URL here - customButton.href = "https://your-custom-jupyterhub-url/lab"; - customButton.target = "_blank"; + customButton.addEventListener("click", () => { + document.getElementById("customModal").style.display = "block"; + }); header.appendChild(customButton); } + + // Modal button logic + const launchBtn = document.getElementById("launchBtn"); + const cancelBtn = document.getElementById("cancelBtn"); + const input = document.getElementById("jupyterUrlInput"); + const modal = document.getElementById("customModal"); + + launchBtn.addEventListener("click", () => { + const url = input.value.trim(); + if (url.startsWith("https://")) { + window.open(`${url}/lab`, "_blank"); + modal.style.display = "none"; + input.value = ""; + } else { + alert("Please enter a valid HTTPS URL."); + } + }); + + cancelBtn.addEventListener("click", () => { + modal.style.display = "none"; + input.value = ""; + }); }); diff --git a/book/_static/custom_launch_button_old.js b/book/_static/custom_launch_button_old.js index 4aebd66..345b0d1 100644 --- a/book/_static/custom_launch_button_old.js +++ b/book/_static/custom_launch_button_old.js @@ -1,45 +1,22 @@ window.addEventListener("DOMContentLoaded", () => { - // Create modal HTML - const modalHTML = ` - - `; - document.body.insertAdjacentHTML("beforeend", modalHTML); + const header = document.querySelector("header"); - const launchButton = document.querySelector(".jb-button.launch-button"); - const modal = document.getElementById("customModal"); - const input = document.getElementById("jupyterUrlInput"); - const launchBtn = document.getElementById("launchBtn"); - const cancelBtn = document.getElementById("cancelBtn"); + if (header) { + const customButton = document.createElement("a"); + customButton.textContent = "Launch Custom JupyterHub"; + customButton.className = "custom-launch-button"; + customButton.style.backgroundColor = "#007ACC"; + customButton.style.color = "white"; + customButton.style.padding = "6px 12px"; + customButton.style.marginLeft = "10px"; + customButton.style.borderRadius = "4px"; + customButton.style.textDecoration = "none"; + customButton.style.fontWeight = "bold"; - if (launchButton) { - launchButton.addEventListener("click", (event) => { - event.preventDefault(); - modal.style.display = "block"; - }); - } - - launchBtn.addEventListener("click", () => { - const url = input.value.trim(); - if (url.startsWith("https://")) { - window.open(`${url}/lab`, "_blank"); - modal.style.display = "none"; - input.value = ""; - } else { - alert("Please enter a valid HTTPS URL."); - } - }); + // Set your custom URL here + customButton.href = "https://your-custom-jupyterhub-url/lab"; + customButton.target = "_blank"; - cancelBtn.addEventListener("click", () => { - modal.style.display = "none"; - input.value = ""; - }); + header.appendChild(customButton); + } }); From 4f02d57f42663b6f3fdc8beb4c02719406fee4a2 Mon Sep 17 00:00:00 2001 From: Mark Melotto Date: Wed, 3 Sep 2025 11:13:10 +0200 Subject: [PATCH 13/52] testing custom launch button --- book/_static/custom_launch_button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/_static/custom_launch_button.js b/book/_static/custom_launch_button.js index a97e544..c2ccb67 100644 --- a/book/_static/custom_launch_button.js +++ b/book/_static/custom_launch_button.js @@ -4,7 +4,7 @@ window.addEventListener("DOMContentLoaded", () => {