Add base64 encoding for share link

This commit is contained in:
SPGoding
2019-08-05 21:29:13 +08:00
parent 9115af5582
commit 274321cbae
+2 -2
View File
@@ -15,7 +15,7 @@ addEntry($('#structure .pool').get());
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
if (params.has('q')) { if (params.has('q')) {
$('#source').val(params.get('q')); $('#source').val(atob(params.get('q')));
updateSouce(); updateSouce();
} }
@@ -42,7 +42,7 @@ function showSource() {
} }
function linkSource() { function linkSource() {
let link = window.location.origin + window.location.pathname + '?q=' + JSON.stringify(table); let link = window.location.origin + window.location.pathname + '?q=' + btoa(JSON.stringify(table));
$('#copyTextarea').removeClass('d-none').val(link); $('#copyTextarea').removeClass('d-none').val(link);
$('#copyTextarea').get()[0].select(); $('#copyTextarea').get()[0].select();
document.execCommand('copy'); document.execCommand('copy');