diff --git a/README.md b/README.md index 14773fd..936f447 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ Call your site with GET parameters to change the WhiteboardID or the Username - username => The name which will be shown to others while drawing - title => Change the name of the Browser Tab - randomid => if set to true, a random whiteboardId will be generated if not given aswell +- copyfromwid => set this to a whiteboardId you want a copy from. Only copies the content if the current whiteboard is empty. ## Configuration diff --git a/src/js/main.js b/src/js/main.js index b775ce6..7ea9685 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -36,6 +36,7 @@ if (urlParams.get("whiteboardid") !== whiteboardId) { const myUsername = urlParams.get("username") || "unknown" + (Math.random() + "").substring(2, 6); const accessToken = urlParams.get("accesstoken") || ""; +const copyfromwid = urlParams.get("copyfromwid") || ""; // Custom Html Title const title = urlParams.get("title"); @@ -170,7 +171,17 @@ function initWhiteboard() { // request whiteboard from server $.get(subdir + "/api/loadwhiteboard", { wid: whiteboardId, at: accessToken }).done( function (data) { + console.log(data); whiteboard.loadData(data); + if (copyfromwid && data.length == 0) { + //Copy from witheboard if current is empty and get parameter is given + $.get(subdir + "/api/loadwhiteboard", { + wid: copyfromwid, + at: accessToken, + }).done(function (data) { + whiteboard.loadData(data); + }); + } } );