diff --git a/assets/css/index.css b/assets/css/index.css
index a2cedf1..16f419c 100644
--- a/assets/css/index.css
+++ b/assets/css/index.css
@@ -591,9 +591,11 @@ u {
.embed blockquote {
max-width: 100%;
}
+
.blockquote {
display: flex;
}
+
.blockquote blockquote {
padding: 0 8px 0 12px;
box-sizing: border-box;
@@ -604,6 +606,7 @@ u {
width: 4px;
border-radius: 4px;
}
+
.blockquoteDivider {
background-color: var(--interactive-muted);
}
@@ -645,12 +648,11 @@ u {
white-space: pre-wrap;
}
-.markup .markup :is(pre, blockquote) {
+.markup pre, .markup blockquote {
max-width: 90%;
}
.markup pre {
- max-width: 90%;
border-radius: 4px;
padding: 0;
font-family: Consolas, Andale Mono WT, Andale Mono, Lucida Console, Lucida Sans Typewriter, DejaVu Sans Mono, Bitstream Vera Sans Mono, Liberation Mono, Nimbus Mono L, Monaco, Courier New, Courier, monospace;
@@ -786,8 +788,9 @@ u {
margin-top: 5px;
animation: notifAn .5s ease;
background-color: #202225;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
padding: 10px;
- border-radius: 4px;
color: #8c4949;
display: none;
width: 100%;
diff --git a/assets/js/index.js b/assets/js/index.js
index a45d264..b45eb22 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -28,10 +28,16 @@ window.onload = () => {
if (mediaWidth && window.matchMedia(`(max-width:${mediaWidth}px)`).matches)
return txt.length > (length - 3) ? txt.substring(0, length - 3) + '...' : txt;
return txt;
- }, error = (msg, html) => {
- if (html) notif.innerHTML = msg;
- else notif.innerText = msg;
- notif.style.display = 'block';
+ }, error = (msg, time) => {
+ notif.innerHTML = msg, notif.style.display = 'block';
+ time && setTimeout(() => notif.animate({ opacity: '0', bottom: '-50px', offset: 1 }, { easing: 'ease', duration: 500 })
+ .onfinish = () => notif.style.removeProperty('display'), time);
+ return false;
+ }, allGood = e => {
+ let re = /"((icon_)?url")(: *)("(?!https?:\/\/).+?")/g.exec(editor.getValue());
+ if (re) return error(`URL should start with https://
or http://
on this line ${makeShort(re[0], 30, 600)}`);
+ if (e.timestamp && new Date(e.timestamp).toString() === "Invalid Date") return error('Timestamp is invalid');
+ return true;
}, markup = (txt, opts) => {
txt = txt
.replace(/<:[^:]+:(\d+)>/g, '
')
@@ -73,13 +79,13 @@ window.onload = () => {
if (data) el.innerHTML = data;
el.style.display = displayType || "unset";
}, hide = el => el.style.removeProperty('display'),
- regEscape = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'),
toObj = jsonString => JSON.parse(jsonString.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (x, y) => y ? "" : x)),
update = data => {
try {
content.innerHTML = data.content ? markup(data.content, { replaceEmojis: true }) : '';
if (data.embed) {
let e = data.embed;
+ if (!allGood(e)) return;
if (e.title) display(embedTitle, markup(`${e.url ? '' + e.title + '' : e.title}`, { replaceEmojis: true, inlineBlock: true }));
else hide(embedTitle);
if (e.description) display(embedDescription, markup(e.description, { inEmbed: true, replaceEmojis: true }));
@@ -130,11 +136,9 @@ window.onload = () => {
display(fields, undefined, 'grid');
} else hide(fields);
embed.classList.remove('empty');
- let re = /"((icon_)?url")(: *)("(?!https?:\/\/).+?")/g.exec(editor.getValue())
- if (re) error(`URL should start with https://
or http://
on this line ${makeShort(re[0], 30, 600)}`, true);
- else notif.animate({ opacity: '0', bottom: '-50px', offset: 1 }, { easing: 'ease', duration: 500 }).onfinish = () => notif.style.removeProperty('display');
+ notif.animate({ opacity: '0', bottom: '-50px', offset: 1 }, { easing: 'ease', duration: 500 }).onfinish = () => notif.style.removeProperty('display');
twemoji.parse(msgEmbed);
- }
+ } else embed.classList.add('empty');
} catch (e) {
error(e);
}
@@ -151,8 +155,8 @@ window.onload = () => {
});
update(toObj(editor.getValue()));
- document.querySelector('.timeText').innerText = tstamp()
- document.querySelectorAll('.markup pre > code').forEach((block) => hljs.highlightBlock(block))
+ document.querySelector('.timeText').innerText = tstamp();
+ document.querySelectorAll('.markup pre > code').forEach((block) => hljs.highlightBlock(block));
!window.navigator.userAgent.match(/Firefox\/[\d\.]+$/g) && // Firefox pushes the text up a little
document.querySelector('.botText').style.removeProperty('top');
};
\ No newline at end of file