Move from file IDs to file paths (with retrocompatibility)
This commit is contained in:
parent
56cf62f1eb
commit
a2503d5def
7 changed files with 62 additions and 49 deletions
|
@ -5,18 +5,22 @@
|
|||
<script src="button.js"></script>
|
||||
<script>
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const fileID = urlParams.get('id');
|
||||
let path = urlParams.get('path');
|
||||
if(path === null) {
|
||||
const fileID = urlParams.get('id'); // legacy support
|
||||
path = "/data/assets/" + fileID + ".svg";
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const editLink = document.createElement('a');
|
||||
editLink.href = getEditLink(fileID);
|
||||
editLink.href = getEditLink(path);
|
||||
document.body.appendChild(editLink);
|
||||
|
||||
const htmlContainer = document.createElement('div');
|
||||
htmlContainer.innerHTML = await getSVG(fileID);
|
||||
htmlContainer.innerHTML = await getSVG(path);
|
||||
editLink.appendChild(htmlContainer);
|
||||
|
||||
addButton(document, fileID);
|
||||
addButton(document, path);
|
||||
});
|
||||
</script>
|
||||
<link rel="stylesheet" href="index.css">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue