update jsonToBase64()

This commit is contained in:
Glitchii 2021-09-06 17:51:57 +01:00
parent f4f542a6c4
commit 4cee22107f

View file

@ -16,14 +16,11 @@ var params = new URL(location).searchParams,
onlyEmbed = hasParam('embed'),
activeFields, colNum = 1, num = 0, validationError,
jsonToBase64 = (jsonCode, withURL, redirect) => {
let data = jsonCode || json;
if (typeof data === 'object')
data = JSON.stringify(data);
data = btoa(escape(data));
data = btoa(escape((JSON.stringify(typeof jsonCode === 'object' ? jsonCode : json))));
if (withURL) {
let currentURL = new URL(location);
currentURL.searchParams.append('data', data);
redirect && (window.location = currentURL)
if (redirect) window.location = currentURL;
data = currentURL.href;
}
return data;
@ -740,8 +737,8 @@ window.onload = () => {
error(false);
twemoji.parse(msgEmbed);
} else document.body.classList.add('emptyEmbed');
if (!embedCont.innerText)
document.body.classList.add('emptyEmbed');
if (!embedCont.innerText) document.body.classList.add('emptyEmbed');
json = data;
} catch (e) {
console.log(e);
error(e);