Update 'RenderHTML.html'

This commit is contained in:
Brychan Dempsey 2021-06-10 00:21:00 +12:00
parent 0bc67fe87b
commit 5a3e3a33fc

View File

@ -19,6 +19,7 @@
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
const requestURL = urlParams.get('url') const requestURL = urlParams.get('url')
const selector = urlParams.get('selector') const selector = urlParams.get('selector')
var pageLink;
// Fetch the content // Fetch the content
fetch(queryLoc + requestURL) fetch(queryLoc + requestURL)
.then(function (data) { .then(function (data) {
@ -47,7 +48,14 @@
// 2.) disable cross-origin requests // 2.) disable cross-origin requests
var fixedURL = hlinks[i].href.replace(windowLoc.split('#')[0], "").replace(queryLoc, "") var fixedURL = hlinks[i].href.replace(windowLoc.split('#')[0], "").replace(queryLoc, "")
// If the remaining character is the hash, this is a same-page section link // If the remaining character is the hash, this is a same-page section link
if (fixedURL.startsWith("#")) { // There are two cases here;
// 1.) The hash-url is just a typical page-link
// 2.) The hash-url is a page content reference
if (fixedURL.contains("#page=")) {
pageLink.add(fixedURL);
}
else if (fixedURL.startsWith("#")){
fixedURL = requestURL + fixedURL; fixedURL = requestURL + fixedURL;
} }
// selector is the selector used to select the element. Use body if the whole page is required // selector is the selector used to select the element. Use body if the whole page is required