Documentation updates, patches image paths in themes to load remote images from Github

This commit is contained in:
Pieter Vander Vennet 2021-04-17 11:37:22 +02:00
parent 0abaf5c139
commit 882e2c4aa9
8 changed files with 93 additions and 18 deletions

View file

@ -67,7 +67,7 @@ defaultLayout = QueryParameters.GetQueryParameter("layout", defaultLayout, "The
let layoutToUse: LayoutConfig = AllKnownLayouts.allKnownLayouts.get(defaultLayout.toLowerCase());
const userLayoutParam = QueryParameters.GetQueryParameter("userlayout", "false");
const userLayoutParam = QueryParameters.GetQueryParameter("userlayout", "false", "If not 'false', a custom (non-official) theme is loaded. This custom layout can be done in multiple ways: \n\n- The hash of the URL contains a base64-encoded .json-file containing the theme definition\n- The hash of the URL contains a lz-compressed .json-file, as generated by the custom theme generator\n- The parameter itself is an URL, in which case that URL will be downloaded. It should point to a .json of a theme");
const layoutFromBase64 = decodeURIComponent(userLayoutParam.data);
document.getElementById('centermessage').innerText = '';
document.getElementById("decoration-desktop").remove();
@ -87,7 +87,7 @@ if (layoutFromBase64.startsWith("http")) {
const parsed = JSON.parse(data);
// Overwrite the id to the wiki:value
parsed.id = link;
const layout = new LayoutConfig(parsed, false);
const layout = new LayoutConfig(parsed, false).patchImages(link, data);
InitUiElements.InitAll(layout, layoutFromBase64, testing, layoutFromBase64, btoa(data));
} catch (e) {
new FixedUiElement(`<a href="${link}">${link}</a> is invalid:<br/>${e}<br/> <a href='https://${window.location.host}/'>Go back</a>")`)