highlight

This commit is contained in:
xhyrom 2021-12-21 14:27:41 +01:00
parent 8d00dc7041
commit d1e834ad86
2 changed files with 29 additions and 27 deletions

View file

@ -5,7 +5,7 @@ let json = {
$('input').change((e) => { $('input').change((e) => {
json[e.currentTarget.id] = e.currentTarget.value; json[e.currentTarget.id] = e.currentTarget.value;
document.getElementById('json').innerText = JSON.stringify(json); document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
}) })
$('button[id=addRole]').click((e) => { $('button[id=addRole]').click((e) => {
@ -32,12 +32,12 @@ $('button[id=addRole]').click((e) => {
emoji: result.value[2] || null emoji: result.value[2] || null
}) })
document.getElementById('json').innerText = JSON.stringify(json); document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
} else Swal.fire('Missing parameters') } else Swal.fire('Missing parameters')
}).catch(swal.noop) }).catch(swal.noop)
}) })
$(window).on('load', () => { $(window).on('load', () => {
$('input').toArray().forEach((i) => i.value = ''); $('input').toArray().forEach((i) => i.value = '');
document.getElementById('json').innerText = JSON.stringify(json); document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
}) })

View file

@ -1,38 +1,40 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang='en'>
<head> <head>
<meta charset="UTF-8"> <meta charset='UTF-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Roles Bot</title> <title>Roles Bot</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" integrity="sha512-c42qTSw/wPZ3/5LBzD+Bw5f7bSF2oxou6wEb+I/lqeaKV5FDIfMvvRp772y4jcJLKuGUOpbJMdg/BTl50fJYAw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css' integrity='sha512-c42qTSw/wPZ3/5LBzD+Bw5f7bSF2oxou6wEb+I/lqeaKV5FDIfMvvRp772y4jcJLKuGUOpbJMdg/BTl50fJYAw==' crossorigin='anonymous' referrerpolicy='no-referrer' />
<meta name="keywords" content="ReactionRoles, discord, discordbot, discordroles, roles-bot"> <meta name='keywords' content='ReactionRoles, discord, discordbot, discordroles, roles-bot'>
<meta property="og:site_name" content="Roles Bot"> <meta property='og:site_name' content='Roles Bot'>
<meta property="og:title" content="Roles Bot"> <meta property='og:title' content='Roles Bot'>
<meta property="og:description" content=""> <meta property='og:description' content=''>
<meta property="og:image" content="https://i.imgur.com/MSdTu2M.png"> <meta property='og:image' content='https://i.imgur.com/MSdTu2M.png'>
<meta name="author" content="xHyroM"> <meta name='author' content='xHyroM'>
<meta name="theme-color" content=#ead800> <meta name='theme-color' content=#ead800>
<link rel="stylesheet" href="dist/style.css"> <link rel='stylesheet' href='dist/style.css'>
<link rel="icon" href="assets/logo.ico"> <link rel='icon' href='assets/logo.ico'>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css"> <script src='https://kit.fontawesome.com/5acf4d9e80.js' crossorigin='anonymous'></script>
<script src="https://kit.fontawesome.com/5acf4d9e80.js" crossorigin="anonymous"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js'></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js'></script>
<script>hljs.initHighlightingOnLoad();</script>
</head> </head>
<body> <body>
<section class="flex-container"> <section class='flex-container'>
<div class="container"> <div class='container'>
<h1>Generate</h1> <h1>Generate</h1>
<form> <form>
<input placeholder="Message" name="message" id="message"/><br> <!--Message--> <input placeholder='Message' name='message' id='message'/><br> <!--Message-->
<input placeholder="Channel Id" name="channel" id="channel"/> <!--Channel Id--> <input placeholder='Channel Id' name='channel' id='channel'/> <!--Channel Id-->
</form> </form>
<button id='addRole'>Add Role</button> <button id='addRole'>Add Role</button>
<pre><code class="language-json"><p class="code" id='json'></p></code></pre> <pre class='hljs language-json'><code id='json'></code></pre>
</div> </div>
</section> </section>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script> <script src='//cdn.jsdelivr.net/npm/sweetalert2@11'></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src='app/js/script.js'></script>
<script src="app/js/script.js"></script>
</body> </body>
</html> </html>