diff --git a/assets/js/components.js b/assets/js/components.js index 847d819..29b6276 100644 --- a/assets/js/components.js +++ b/assets/js/components.js @@ -1,59 +1,4 @@ -var emoticons = { - ">=-(": "๐Ÿ˜ ", - "=\")": "๐Ÿ˜Š", - "=-\")": "๐Ÿ˜Š", - "<\\3": "๐Ÿ’”", - "=-/": "๐Ÿ˜•", - ":'(": "๐Ÿ˜ข", - ":'-(": "๐Ÿ˜ข", - ":,(": "๐Ÿ˜ข", - ":,-(": "cr๐Ÿ˜ขy", - "='(": "๐Ÿ˜ข", - "='-(": "๐Ÿ˜ข", - "=,(": "๐Ÿ˜ข", - "=,-(": "๐Ÿ˜ข", - "=-(": "๐Ÿ˜ฆ", - "โ™ก": "heartโค๏ธ", - "]=-(": "๐Ÿ‘ฟ", - "0=-)": "๐Ÿ˜‡", - ":')": "๐Ÿ˜‚", - ":'-)": "๐Ÿ˜‚", - ":,)": "๐Ÿ˜‚", - ":,-)": "๐Ÿ˜‚", - ":'D": "๐Ÿ˜‚", - ":'-D": "๐Ÿ˜‚", - ":,D": "๐Ÿ˜‚", - ":,-D": "๐Ÿ˜‚", - "=')": "๐Ÿ˜‚", - "='-)": "๐Ÿ˜‚", - "=,)": "๐Ÿ˜‚", - "=,-)": "๐Ÿ˜‚", - "='D": "๐Ÿ˜‚", - "='-D": "๐Ÿ˜‚", - "=-*": "๐Ÿ˜—", - "X-)": "๐Ÿ˜†", - "=-|": "๐Ÿ˜", - "=-O": "๐Ÿ˜ฎ", - "=-@": "๐Ÿ˜ก", - "=-D": "๐Ÿ˜„", - ":)": "๐Ÿ™‚", - ":-)": "๐Ÿ™‚", - "=-)": "๐Ÿ™‚", - "]=-)": "๐Ÿ˜ˆ", - ":,'(": "๐Ÿ˜ญ", - ":,'-(": "๐Ÿ˜ญ", - ";(": "๐Ÿ˜ญ", - ";-(": "๐Ÿ˜ญ", - "=,'(": "๐Ÿ˜ญ", - "=,'-(": "๐Ÿ˜ญ", - "=-P": "๐Ÿ˜›", - "B-)": "๐Ÿ˜Ž", - ",=-(": "๐Ÿ˜“", - ",=-)": "๐Ÿ˜…", - "=-$": "๐Ÿ˜’", - ";)": "๐Ÿ˜‰", - ";-)": "๐Ÿ˜‰" -}, emojis = { +var emojis = { "open_hands": "๐Ÿ‘", "open_hands_tone1": "๐Ÿ‘๐Ÿป", "open_hands_tone2": "๐Ÿ‘๐Ÿผ", diff --git a/assets/js/index.js b/assets/js/index.js index 484fe86..c4dfea7 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -42,10 +42,7 @@ window.onload = () => { if (opts.inlineBlock) txt = txt.replace(/\`([^\`]+?)\`|\`\`([^\`]+?)\`\`|\`\`\`((?:\n|.)+?)\`\`\`/g, (m, x, y, z) => x ? `${x}` : y ? `${y}` : z ? `${z}` : m); else txt = txt.replace(/\`\`\`(\w{1,15})?\n((?:\n|.)+?)\`\`\`|\`\`(.+?)\`\`(?!\`)|\`([^\`]+?)\`/g, (m, w, x, y, z) => w && x ? `
${x}
` : x ? `
${x}
` : y || z ? `${y || z}` : m); if (opts.inEmbed) txt = txt.replace(/\[([^\[\]]+)\]\((.+?)\)/g, `$1`); - if (opts.replaceEmojis) { - txt = txt.replace(/(?[^>]+)(? x && emojis[x] ? emojis[x] : match); - !opts.noEmoticons && Object.keys(emoticons).forEach(e => txt = txt.replace(new RegExp(`(?<=^|\\s)${regEscape(e)}(?=$|\\s)`, 'g'), emoticons[e])); - } + if (opts.replaceEmojis) txt = txt.replace(/(?[^>]+)(? x && emojis[x] ? emojis[x] : match); txt = txt .replace(/(?<=\n|^)\s*>\s+([^\n]+)/g, '
$1
') .replace(/\n/g, '
'); @@ -82,7 +79,7 @@ window.onload = () => { content.innerHTML = data.content ? markup(data.content, { replaceEmojis: true }) : ''; if (data.embed) { let e = data.embed; - if (e.title) display(embedTitle, markup(`${e.url ? '' + e.title + '' : e.title}`, { replaceEmojis: true, noEmoticons: true, inlineBlock: true })); + 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 })); else hide(embedDescription); @@ -133,7 +130,7 @@ window.onload = () => { } else hide(fields); embed.classList.remove('empty'); let re = /"((icon_)?url")(: *)("(?!https?:\/\/).+?")/g.exec(editor.getValue()) - if (re) error(`URLs should start with https:// or http:// on this line ${makeShort(re[0], 30, 600)}`, true); + 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'); twemoji.parse(msgEmbed); } diff --git a/assets/media/layout.png b/assets/media/layout.png index 7b7c926..18446c0 100644 Binary files a/assets/media/layout.png and b/assets/media/layout.png differ diff --git a/index.html b/index.html index dc4c14e..2675946 100644 --- a/index.html +++ b/index.html @@ -32,10 +32,10 @@