Skip to content

Commit

Permalink
Cleanup HTML.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhibbitts committed Oct 28, 2024
1 parent fd3b23c commit ad38eaa
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@
}

/* Support Browser-level image lazy loading of images */
if (getURLParameterByName(['lazy-load-images', 'lazyLoadImages'], null, null, window.location.href, true) === 'true' ) {
if (getURLParameterByName(['lazy-load-images', 'lazyLoadImages'], null, null, window.location.href, true) === 'true') {
htmlElement.innerHTML = htmlElement.innerHTML.replace(/<img(.*?)>/g, function (match, p1) {
if (p1.indexOf('loading=') === -1) {
return match.replace('>', ' loading="lazy">');
Expand Down Expand Up @@ -1254,8 +1254,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)
Expand All @@ -1268,33 +1268,33 @@

// Check if the URL contains the 'id' query parameter in either search or hash
if (isUrlHasIdQuery || isHashHasIdQuery) {
dd && console.log('url or hash has id, will scroll to element');
// 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 () {
dd && console.log('will scroll now!');
try {
let targetElement = document.getElementById(urlId); // Use `getElementById` to directly reference the element
dd && console.log(urlId);
if (targetElement) {
// Use requestAnimationFrame for immediate scroll to the element
requestAnimationFrame(() => {
// Scroll smoothly to the element's top position
window.scrollTo({
top: targetElement.offsetTop,
behavior: 'smooth' // Add smooth scrolling
});
});
} else {
dd && console.log('Element not found');
}
} catch (e) {
dd && console.log('custom scroll failed', e);
}
}, SCROLL_DELAY);
dd && console.log('url or hash has id, will scroll to element');

// 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 () {
dd && console.log('will scroll now!');
try {
let targetElement = document.getElementById(urlId); // Use `getElementById` to directly reference the element
dd && console.log(urlId);
if (targetElement) {
// Use requestAnimationFrame for immediate scroll to the element
requestAnimationFrame(() => {
// Scroll smoothly to the element's top position
window.scrollTo({
top: targetElement.offsetTop,
behavior: 'smooth' // Add smooth scrolling
});
});
} else {
dd && console.log('Element not found');
}
} catch (e) {
dd && console.log('custom scroll failed', e);
}
}, SCROLL_DELAY);
}

if (window.$docsify['basePath']) {
Expand Down Expand Up @@ -1521,8 +1521,8 @@
]
}

<!-- Credit to Beau Shaw for dymamic remote docsify technique -->
<!-- To render a Markdown file named ** README.md ** (the expected default name) the URL would be https://hibbitts-design.github.io/test-docsify-project-docs/?basePath=https://raw.githubusercontent.com/hibbitts-design/docsify-open-course-starter-kit/main -->
// Credit to Beau Shaw for dymamic remote docsify technique
// To render a Markdown file named ** README.md ** (the expected default name) the URL would be https://hibbitts-design.github.io/test-docsify-project-docs/?basePath=https://raw.githubusercontent.com/hibbitts-design/docsify-open-course-starter-kit/main
if (getURLParameterByName('basePath')) {
const params = new URLSearchParams(window.location.search);
params.forEach((value, key) => {
Expand Down Expand Up @@ -1776,10 +1776,10 @@
<script>
if (getURLParameterByName(['search', 'searchbox'], null, null, window.location.href, true) === 'true') {

<!-- Docsify Search Plugin current release -->
<!-- document.write('<script src="assets/vendor/docsify/plugins/custom/search.min.js"><\/script>'); -->
// Docsify Search Plugin current release
// document.write('<script src="assets/vendor/docsify/plugins/custom/search.min.js"><\/script>');

<!-- Docsify Search Plugin "develop" branch preview files -->
// Docsify Search Plugin "develop" branch preview files
document.write('<script src="assets/vendor/docsify/plugins/preview/custom/search.js"><\/script>');
}
</script>
Expand Down

0 comments on commit ad38eaa

Please sign in to comment.