瀏覽代碼

Add a permalink button

tags/v0.1.0
Fen Dweller 5 年之前
父節點
當前提交
246b10bd81
共有 2 個檔案被更改,包括 11 行新增0 行删除
  1. +1
    -0
      macrovision.html
  2. +10
    -0
      macrovision.js

+ 1
- 0
macrovision.html 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存