Browse Source

Add a permalink button

tags/v0.1.0
Fen Dweller 5 years ago
parent
commit
246b10bd81
2 changed files with 11 additions and 0 deletions
  1. +1
    -0
      macrovision.html
  2. +10
    -0
      macrovision.js

+ 1
- 0
macrovision.html View File

@@ -63,6 +63,7 @@
<button id="menu-order-height">Order by height</button>
</span>
<span class="menubar-group">
<button id="menu-permalink">Permalink</button>
<button id="menu-export">Export</button>
<button id="menu-save">Save</button>
<button id="menu-load">Load</button>


+ 10
- 0
macrovision.js View File

@@ -1055,6 +1055,10 @@ document.addEventListener("DOMContentLoaded", () => {
}
});

document.querySelector("#menu-permalink").addEventListener("click", e => {
linkScene();
});

document.querySelector("#menu-export").addEventListener("click", e => {
copyScene();
});
@@ -1298,6 +1302,12 @@ function exportScene() {
return results;
}

function linkScene() {
loc = new URL(window.location);


window.location = loc.protocol + "//" + loc.host + loc.pathname + "?scene=" + btoa(JSON.stringify(exportScene()));
}
function copyScene() {
const results = exportScene();



Loading…
Cancel
Save