Changed layout image, removed emoticons
This commit is contained in:
parent
fe12fe15c6
commit
82f9209b5c
4 changed files with 8 additions and 65 deletions
|
@ -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": "👐🏼",
|
||||
|
|
|
@ -42,10 +42,7 @@ window.onload = () => {
|
|||
if (opts.inlineBlock) txt = txt.replace(/\`([^\`]+?)\`|\`\`([^\`]+?)\`\`|\`\`\`((?:\n|.)+?)\`\`\`/g, (m, x, y, z) => x ? `<code class="inline">${x}</code>` : y ? `<code class="inline">${y}</code>` : z ? `<code class="inline">${z}</code>` : m);
|
||||
else txt = txt.replace(/\`\`\`(\w{1,15})?\n((?:\n|.)+?)\`\`\`|\`\`(.+?)\`\`(?!\`)|\`([^\`]+?)\`/g, (m, w, x, y, z) => w && x ? `<pre><code class="${w}">${x}</code></pre>` : x ? `<pre><code class="hljs nohighlight">${x}</code></pre>` : y || z ? `<code class="inline">${y || z}</code>` : m);
|
||||
if (opts.inEmbed) txt = txt.replace(/\[([^\[\]]+)\]\((.+?)\)/g, `<a title="$1" target="_blank" class="anchor" href="$2">$1</a>`);
|
||||
if (opts.replaceEmojis) {
|
||||
txt = txt.replace(/(?<!code(?: \w+=".+")?>[^>]+)(?<!\/[^\s"]+?):((?!\/)\w+):/g, (match, x) => 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(/(?<!code(?: \w+=".+")?>[^>]+)(?<!\/[^\s"]+?):((?!\/)\w+):/g, (match, x) => x && emojis[x] ? emojis[x] : match);
|
||||
txt = txt
|
||||
.replace(/(?<=\n|^)\s*>\s+([^\n]+)/g, '<div class="blockquote"><div class="blockquoteDivider"></div><blockquote>$1</blockquote></div>')
|
||||
.replace(/\n/g, '<br>');
|
||||
|
@ -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 ? '<a class="anchor" target="_blank" href="' + url(e.url) + '">' + e.title + '</a>' : e.title}`, { replaceEmojis: true, noEmoticons: true, inlineBlock: true }));
|
||||
if (e.title) display(embedTitle, markup(`${e.url ? '<a class="anchor" target="_blank" href="' + url(e.url) + '">' + e.title + '</a>' : 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 <code>https://</code> or <code>http://</code> on this line <span class="inline full">${makeShort(re[0], 30, 600)}</span>`, true);
|
||||
if (re) error(`URL should start with <code>https://</code> or <code>http://</code> on this line <span class="inline full">${makeShort(re[0], 30, 600)}</span>`, true);
|
||||
else notif.animate({ opacity: '0', bottom: '-50px', offset: 1 }, { easing: 'ease', duration: 500 }).onfinish = () => notif.style.removeProperty('display');
|
||||
twemoji.parse(msgEmbed);
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 381 KiB After Width: | Height: | Size: 327 KiB |
|
@ -23,7 +23,8 @@
|
|||
<script src="https://unpkg.com/jsonlint@1.6.3/web/jsonlint.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.3/addon/lint/lint.min.css" />
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.3/addon/lint/lint.min.js"></script>
|
||||
<script src="https://glitchii.github.io/embedbuilder/assets/js/components.js"></script>
|
||||
<!-- <script src="https://glitchii.github.io/embedbuilder/assets/js/components.js"></script> -->
|
||||
<script src="http://localhost:5500/assets/js/components.js"></script>
|
||||
<script src="./assets/js/index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -32,10 +33,10 @@
|
|||
<div class="top item">
|
||||
<textarea style="display: none;">
|
||||
{
|
||||
"content": "You can~~not~~ do `this`.```\nAnd :laughing:this.\nprint('Hi') :) ```\n*italics* or _italics_ __*underline italics*__\n**bold** __**underline bold**__\n***bold italics*** __***underline bold italics***__\n__underline__ ~~Strikethrough~~\n> Hi",
|
||||
"content": "You can~~not~~ do `this`.```py\nAnd this.\nprint('Hi')```\n*italics* or _italics_ __*underline italics*__\n**bold** __**underline bold**__\n***bold italics*** __***underline bold italics***__\n__underline__ ~~Strikethrough~~",
|
||||
"embed": {
|
||||
"title": "Hello ~~people~~ world :wave:",
|
||||
"description": "You can use [links](https://discord.com), emojis 😎 :smile:, emoticons :-)\n```\nAlso code blocks```",
|
||||
"description": "You can use [links](https://discord.com) or emojis :smile: 😎\n```\nAnd also code blocks```",
|
||||
"color": 4321431,
|
||||
"timestamp": "2020-12-08T13:37:35.401Z",
|
||||
"url": "https://discord.com",
|
||||
|
|
Loading…
Add table
Reference in a new issue