Update settings.js
Fixed a bug in copying the URL
This commit is contained in:
@@ -194,27 +194,30 @@ async function generateUrl() {
|
|||||||
|
|
||||||
async function copyUrl() {
|
async function copyUrl() {
|
||||||
|
|
||||||
const output = document.getElementById("outputUrl");
|
const output = document.getElementById("outputUrl")
|
||||||
|
const value = output.value;
|
||||||
output.select();
|
|
||||||
document.execCommand("copy");
|
|
||||||
|
|
||||||
const button = document.querySelector('.url-bar button');
|
const button = document.querySelector('.url-bar button');
|
||||||
const buttonDefaulText = 'Copy URL';
|
const buttonDefaulText = 'Copy URL';
|
||||||
|
|
||||||
button.textContent = 'ChatRD URL Copied!';
|
navigator.clipboard.writeText(value)
|
||||||
button.style.backgroundColor = "#00dd63";
|
.then(() => {
|
||||||
|
|
||||||
setTimeout(() => {
|
button.textContent = 'ChatRD URL Copied!';
|
||||||
button.textContent = buttonDefaulText;
|
button.style.backgroundColor = "#00dd63";
|
||||||
button.removeAttribute('style');
|
|
||||||
}, 3000);
|
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
button.textContent = buttonDefaulText;
|
||||||
|
button.removeAttribute('style');
|
||||||
|
}, 3000);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error("Failed to copy: ", err);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function setupAddEmoteModal() {
|
async function setupAddEmoteModal() {
|
||||||
const modal = document.getElementById("addEmoteModal");
|
const modal = document.getElementById("addEmoteModal");
|
||||||
const nameInput = document.getElementById("newEmoteName");
|
const nameInput = document.getElementById("newEmoteName");
|
||||||
|
Reference in New Issue
Block a user