From 246b10bd81dd181cfa94c4c4910827214622f7b6 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 25 Feb 2020 16:41:28 -0500 Subject: [PATCH] Add a permalink button --- macrovision.html | 1 + macrovision.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/macrovision.html b/macrovision.html index 508a9894..3c521293 100644 --- a/macrovision.html +++ b/macrovision.html @@ -63,6 +63,7 @@ + diff --git a/macrovision.js b/macrovision.js index e627f775..f875ab17 100644 --- a/macrovision.js +++ b/macrovision.js @@ -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();