Skip to content

Commit

Permalink
Check for Basepath only once at start of remote parms loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhibbitts committed Aug 21, 2023
1 parent 6c3d228 commit ea2a553
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@

if (getURLParameterByName('font-family')) {
fontfamily = getURLParameterByName('font-family', null, null, window.location.href, true);
document.getElementById('fontfamily').value = fontfamily;
document.getElementById('fontfamily').value = encodeURI(fontfamily);
}

if (getURLParameterByName('font-size')) {
Expand Down Expand Up @@ -1311,26 +1311,25 @@

<!-- 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 -->
const params = new URLSearchParams(window.location.search);
params.forEach((value, key) => {
// TODO: Parse numbers?

// console.log(value,key);
if (key === 'basePath' && !(allowedDomains === '')) {
const { hostname } = new URL(value);
if (!(allowedDomains.includes(hostname))) {
alert('Only the domain(s) ' + allowedDomains + ' permitted for a Markdown source file URL.');
throw new Error('Only the domain ' + allowedDomains + ' permitted for a Markdown source file URL.');
if (getURLParameterByName('basePath')) {
const params = new URLSearchParams(window.location.search);
params.forEach((value, key) => {
// TODO: Parse numbers?

// console.log(value,key);
if (key === 'basePath' && !(allowedDomains === '')) {
const { hostname } = new URL(value);
if (!(allowedDomains.includes(hostname))) {
alert('Only the domain(s) ' + allowedDomains + ' permitted for a Markdown source file URL.');
throw new Error('Only the domain ' + allowedDomains + ' permitted for a Markdown source file URL.');
} else {
window.$docsify[key] = value;
}
} else {
window.$docsify[key] = value;
}
} else {
// ensure to only load when displaying remote files
if (getURLParameterByName('basePath')) {
window.$docsify[key] = value;
}
}
});
});
}

// If switch of light/dark theme mode
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
Expand Down

0 comments on commit ea2a553

Please sign in to comment.