diff --git a/assets/css/index.css b/assets/css/index.css index 0a2c95f..d7eddfe 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -1806,6 +1806,26 @@ body { transition: .5s ease; } +.top-btn.copy { + left: 190px; +} + +.top-btn.copy>svg { + width: 15px; + left: 1px; + top: -.5px; +} + +.top-btn.copy>svg.mark { + width: 18px; + left: -1px; +} + +.top-btn.copy>svg * { + fill: var(#fff); + transition: all .3s ease; +} + .top-btn>svg { width: 20px; height: 100%; @@ -1878,21 +1898,23 @@ body { .top-btn.menu>.box .item>input { pointer-events: none; } -.top-btn.menu > .box .item > .icon::after { + +.top-btn.menu>.box .item>.icon::after { display: none; - position: absolute; - content: ""; - width: 4px; - height: 4px; - background: #00bb9c; - z-index: 1000000; - border-radius: 100%; - left: 7px; - transform: translateY(7px); + position: absolute; + content: ""; + width: 4px; + height: 4px; + background: #00bb9c; + z-index: 1000000; + border-radius: 100%; + left: 7px; + transform: translateY(7px); } -body.autoUpdateURL .top-btn.menu > .box .item.auto > .icon::after, -body.reversed .top-btn.menu > .box .item.reverse > .icon::after { +body.autoUpdateURL .top-btn.menu>.box .item.auto>.icon::after, +body.no-user .top-btn.menu>.box .item.noUser>.icon::after, +body.reversed .top-btn.menu>.box .item.reverse>.icon::after { display: block; } @@ -2047,7 +2069,7 @@ body.emptyEmbed.emptyContent .emptyTxt { position: absolute; cursor: pointer; z-index: 5; - left: 170px; + left: 226px; border-left: 2px solid #4c5057; padding-left: 15px; bottom: auto; @@ -2056,6 +2078,7 @@ body.emptyEmbed.emptyContent .emptyTxt { .pickerToggle>svg { width: 17px; + transform: translateY(2px); } .main .side1 { diff --git a/assets/js/script.js b/assets/js/script.js index 9463e45..dfcc19b 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -13,7 +13,7 @@ var params = new URL(top.location.href).searchParams, useJsonEditor = params.get('editor') === 'json' || options.useJsonEditor, verified = hasParam('verified') || options.verified, reverseColumns = hasParam('reverse') || options.reverseColumns, - noUser = hasParam('nouser') || options.noUser, + noUser = localStorage.getItem('noUser') || hasParam('nouser') || options.noUser, onlyEmbed = hasParam('embed') || options.onlyEmbed, allowPlaceholders = hasParam('placeholders') || options.allowPlaceholders, autoUpdateURL = localStorage.getItem('autoUpdateURL') || options.autoUpdateURL, @@ -927,7 +927,7 @@ addEventListener('DOMContentLoaded', () => { }) document.querySelector('.top-btn.menu').addEventListener('click', e => { - if (e.target.closest('.item.datalink')) + if (e.target.closest('.item.dataLink')) return prompt('Here\'s the current URL with base64 embed data:', jsonToBase64(json, true)); const input = e.target.closest('.item')?.querySelector('input'); @@ -942,6 +942,9 @@ addEventListener('DOMContentLoaded', () => { reverse(reverseColumns); reverseColumns = !reverseColumns; toggleStored('reverseColumns'); + } else if (e.target.closest('.item.noUser')) { + document.body.classList.toggle('no-user'); + toggleStored('noUser'); } else if (e.target.closest('.item.auto-params')) { if (input.checked) localStorage.setItem('autoParams', true); else localStorage.removeItem('autoParams'); @@ -987,4 +990,29 @@ addEventListener('DOMContentLoaded', () => { }) if (onlyEmbed) document.querySelector('.side1')?.remove(); + + document.querySelector('.top-btn.copy').addEventListener('click', e => { + const mark = e.target.closest('.top-btn.copy').querySelector('.mark'), + jsonData = JSON.stringify(json, null, 4), + next = () => { + mark.classList.remove('hidden'); + mark.previousElementSibling.classList.add('hidden'); + + setTimeout(() => { + mark.classList.add('hidden'); + mark.previousElementSibling.classList.remove('hidden'); + }, 1500); + } + + if (!navigator.clipboard?.writeText(jsonData).then(next).catch(err => alert('Could not copy to clipboard: ' + err.message))) { + const textarea = document.createElement('textarea'); + textarea.value = jsonData; + document.body.appendChild(textarea); + textarea.select(); + textarea.setSelectionRange(0, 50000); + document.execCommand('copy'); + document.body.removeChild(textarea); + next(); + } + }); }); \ No newline at end of file diff --git a/builder.config.js b/builder.config.js index 241716a..d5445c0 100644 --- a/builder.config.js +++ b/builder.config.js @@ -5,7 +5,6 @@ options = { avatar: 'https://cdn.discordapp.com/embed/avatars/1.png', verified: false, noUser: false, - hasParam: false, dataSpecified: false, guiTabs: ['author', 'description'], useJsonEditor: false, diff --git a/index.html b/index.html index b74a240..ca02277 100644 --- a/index.html +++ b/index.html @@ -57,6 +57,16 @@ +
+ + + + + + +
@@ -95,11 +105,11 @@