From 127229d9cb4f84b6d258f3faa7e5a05cc5b37f8c Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 6 Oct 2020 14:42:08 -0400 Subject: [PATCH] Copy the permalink to the clipboard and put it in the url bar, rather than reloading the page --- macrovision.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/macrovision.js b/macrovision.js index 36a0f2c9..1c7f98d9 100644 --- a/macrovision.js +++ b/macrovision.js @@ -3646,10 +3646,12 @@ function b64DecodeUnicode(str) { function linkScene() { loc = new URL(window.location); - - - window.location = loc.protocol + "//" + loc.host + loc.pathname + "?scene=" + b64EncodeUnicode(JSON.stringify(exportScene())); + const link = loc.protocol + "//" + loc.host + loc.pathname + "?scene=" + b64EncodeUnicode(JSON.stringify(exportScene())); + window.history.replaceState(null, "Macrovision", link); + navigator.clipboard.writeText(link); + toast("Copied permalink to clipboard"); } + function copyScene() { const results = exportScene();