From d11a720c18e518849b57bf607883751a7e0805f5 Mon Sep 17 00:00:00 2001 From: Paul Hibbitts Date: Mon, 28 Oct 2024 13:54:03 -0700 Subject: [PATCH 1/5] Cleanup HTML. --- docs/index.html | 85 +++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/docs/index.html b/docs/index.html index da1b4fa..608e66a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -71,20 +71,14 @@ --sidebar-nav-link-font-weight--active: bold; --sidebar-nav-pagelink-background--active: - no-repeat 0px center / 5px 6px - linear-gradient(225deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px), - no-repeat 5px center / 5px 6px - linear-gradient(135deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px); + no-repeat 0px center / 5px 6px linear-gradient(225deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px), + no-repeat 5px center / 5px 6px linear-gradient(135deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px); --sidebar-nav-pagelink-background--collapse: - no-repeat 2px calc(50% - 2.5px) / 6px 5px - linear-gradient(45deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4px), - no-repeat 2px calc(50% + 2.5px) / 6px 5px - linear-gradient(135deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4px); + no-repeat 2px calc(50% - 2.5px) / 6px 5px linear-gradient(45deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4px), + no-repeat 2px calc(50% + 2.5px) / 6px 5px linear-gradient(135deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4px); --sidebar-nav-pagelink-background--loaded: - no-repeat 0px center / 5px 6px - linear-gradient(225deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px), - no-repeat 5px center / 5px 6px - linear-gradient(135deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px); + no-repeat 0px center / 5px 6px linear-gradient(225deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px), + no-repeat 5px center / 5px 6px linear-gradient(135deg, transparent 2.75px, #0374B5 2.75px 4.25px, transparent 4.25px); --navbar-root-margin: 0 0 0 .8em; --navbar-root-color--active: #0374B5; @@ -95,7 +89,6 @@ --docsifytabs-tab-color: var(--base-color); } - @@ -166,7 +159,7 @@ name: 'Docsify Open Course Starter Kit', homepage: 'home.md', loadSidebar: !(getURLParameterByName(['standalone', 'embedded']) || standalone || false), - loadNavbar: !(getURLParameterByName(['standalone', 'embedded']) && !(getURLParameterByName('navbar')) || standalone && !navbar ||false), + loadNavbar: !(getURLParameterByName(['standalone', 'embedded']) && !(getURLParameterByName('navbar')) || standalone && !navbar || false), externalLinkTarget: standalone ? '_top' : (getURLParameterByName(['standalone', 'embedded'], '_top', '_blank')), loadFooter: (getURLParameterByName('footer') || footer || false), @@ -254,7 +247,7 @@ } } } - + /* JS to change Embedly cards to light or dark theme based on system setting when using the light + dark theme (uncomment to use) */ /* const embeds = Array.from(htmlElement.querySelectorAll('.embedly-card')) @@ -307,11 +300,11 @@ hook.doneEach(function () { var hasEmbedly = document.getElementsByClassName('embedly-card'); if (hasEmbedly.length > 0) { - // elements with class "embedly-card" exist - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = 'https://cdn.embedly.com/widgets/platform.js'; - document.head.appendChild(script); + // elements with class "embedly-card" exist + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = 'https://cdn.embedly.com/widgets/platform.js'; + document.head.appendChild(script); } // Remove optional ToC area if full width header image is present @@ -334,17 +327,17 @@ const allIframes = Array.from(document.querySelectorAll('iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"], iframe[src*="docs.google.com"], iframe[src*="onedrive.live.com"]')); // Filter out iframes that are not already wrapped with a div including the classes 'video-container-16by9' and 'video-container-4by3' - const targetIframes = allIframes.filter(function(iframe) { + const targetIframes = allIframes.filter(function (iframe) { const parentDiv = iframe.parentNode; return !parentDiv.matches('.video-container-16by9, .video-container-4by3'); }); // Wrap each target iframe with a div element - targetIframes.forEach(function(iframe) { + targetIframes.forEach(function (iframe) { const wrapperDiv = document.createElement('div'); wrapperDiv.classList.add('video-container-16by9'); // Preserve existing classes on the iframe - iframe.classList.forEach(function(className) { + iframe.classList.forEach(function (className) { wrapperDiv.classList.add(className); }); // Replace the iframe with the wrapper div @@ -362,8 +355,8 @@ // Build the current URL without the hash let currentUrlWithoutHash = new URL( - location.origin + location.pathname + - location.search + location.origin + location.pathname + + location.search ); // Get the search parameters from the URL (before the hash) @@ -376,28 +369,28 @@ // Check if the URL contains the 'id' query parameter in either search or hash if (isUrlHasIdQuery || isHashHasIdQuery) { - - // Get the 'id' from either search or hash - let urlId = isUrlHasIdQuery ? urlQueryParam.get(TARGET_QUERY) : hashParams.get(TARGET_QUERY); - - // Delay the scrolling to ensure everything is loaded - setTimeout(function () { - try { - let targetElement = document.querySelector('#' + urlId); - if (targetElement) { - // Scroll to the element with smooth behavior - targetElement.scrollIntoView({ - behavior: 'smooth', // Enables smooth scrolling - block: 'start', // Aligns the top of the element to the top of the viewport - }); - } - } catch (e) { - console.log('custom scroll failed', e); - } - }, SCROLL_DELAY); + + // Get the 'id' from either search or hash + let urlId = isUrlHasIdQuery ? urlQueryParam.get(TARGET_QUERY) : hashParams.get(TARGET_QUERY); + + // Delay the scrolling to ensure everything is loaded + setTimeout(function () { + try { + let targetElement = document.querySelector('#' + urlId); + if (targetElement) { + // Scroll to the element with smooth behavior + targetElement.scrollIntoView({ + behavior: 'smooth', // Enables smooth scrolling + block: 'start', // Aligns the top of the element to the top of the viewport + }); + } + } catch (e) { + console.log('custom scroll failed', e); + } + }, SCROLL_DELAY); } }); - + } ] } @@ -419,7 +412,7 @@ - + From a0d2b02ca1ba3e1af81acb2639e857fa7c0b2bf6 Mon Sep 17 00:00:00 2001 From: Paul Hibbitts Date: Mon, 28 Oct 2024 13:54:32 -0700 Subject: [PATCH 2/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07c0b17..efae565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Improved:** * Use of window.matchMedia.addListener replaced with window.matchMedia.addEventListener +* Cleanup HTML ## [v1.2.20](https://github.com/hibbitts-design/docsify-open-course-starter-kit/releases/tag/v1.2.20) ### 10/17/2024 From 2730206ce57cc74fcc7c8f3616507526c2d13910 Mon Sep 17 00:00:00 2001 From: Paul Hibbitts Date: Wed, 30 Oct 2024 13:30:58 -0700 Subject: [PATCH 3/5] Added default setting of off for `mergeNavbar`. --- docs/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.html b/docs/index.html index 608e66a..3d6b731 100644 --- a/docs/index.html +++ b/docs/index.html @@ -160,6 +160,7 @@ homepage: 'home.md', loadSidebar: !(getURLParameterByName(['standalone', 'embedded']) || standalone || false), loadNavbar: !(getURLParameterByName(['standalone', 'embedded']) && !(getURLParameterByName('navbar')) || standalone && !navbar || false), + mergeNavbar: false, externalLinkTarget: standalone ? '_top' : (getURLParameterByName(['standalone', 'embedded'], '_top', '_blank')), loadFooter: (getURLParameterByName('footer') || footer || false), From 2bf0a0a6bb5de547f0b141d9ece3f1a56e4d71a2 Mon Sep 17 00:00:00 2001 From: Paul Hibbitts Date: Wed, 30 Oct 2024 13:31:01 -0700 Subject: [PATCH 4/5] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index efae565..f166be8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## [v1.2.21](https://github.com/hibbitts-design/docsify-open-course-starter-kit/releases/tag/v1.2.21) ### XX/XX/2024 +**New:** +* Added default setting of off for `mergeNavbar` to move Navbar items to the top of the Sidebar on smaller screens + **Improved:** * Use of window.matchMedia.addListener replaced with window.matchMedia.addEventListener * Cleanup HTML From 6e3db3a38456116ffac764254f1627c4248725a6 Mon Sep 17 00:00:00 2001 From: Paul Hibbitts Date: Wed, 30 Oct 2024 14:01:10 -0700 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f166be8..94e01fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### XX/XX/2024 **New:** -* Added default setting of off for `mergeNavbar` to move Navbar items to the top of the Sidebar on smaller screens +* Added default setting of false for `mergeNavbar` to move Navbar items to the top of the Sidebar on smaller screens **Improved:** * Use of window.matchMedia.addListener replaced with window.matchMedia.addEventListener