forked from MapComplete/MapComplete
Documentation updates, patches image paths in themes to load remote images from Github
This commit is contained in:
parent
0abaf5c139
commit
882e2c4aa9
8 changed files with 93 additions and 18 deletions
4
index.ts
4
index.ts
|
@ -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>")`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue