-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Removing some extra javascript again
Signed-off-by: Vincent Boutour <[email protected]>
- Loading branch information
Showing
9 changed files
with
96 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
document.addEventListener('readystatechange', (event) => { | ||
if (event.target.readyState !== 'complete') { | ||
return; | ||
} | ||
|
||
document.querySelectorAll('[data-confirm]').forEach((element) => { | ||
element.addEventListener('click', (e) => { | ||
if ( | ||
!confirm(`Are you sure you want to delete ${element.dataset.confirm}?`) | ||
) { | ||
e.preventDefault(); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
document.addEventListener('readystatechange', (event) => { | ||
if (event.target.readyState !== 'complete') { | ||
return; | ||
} | ||
|
||
const link = document.getElementById('go-back'); | ||
|
||
if (link) { | ||
link.setAttribute('href', document.referrer); | ||
link.addEventListener('click', (e) => { | ||
e.preventDefault(); | ||
window.addEventListener('popstate', () => { | ||
window.location.reload(true); | ||
}); | ||
history.back(); | ||
return false; | ||
}); | ||
} | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
document.addEventListener('readystatechange', (event) => { | ||
if (event.target.readyState !== 'complete') { | ||
return; | ||
} | ||
|
||
const urlLabel = document.getElementById('webhook-url-label'); | ||
if (!urlLabel) { | ||
return; | ||
} | ||
|
||
const urlWebhook = document.getElementById('webhook-url'); | ||
const telegramChatID = document.getElementById('telegram-chat-id'); | ||
|
||
document | ||
.getElementById('webhook-kind-raw') | ||
.addEventListener('change', (e) => { | ||
if (e.target.value === 'raw') { | ||
urlWebhook.placeholder = 'http://website.com/fibr'; | ||
urlLabel.innerHTML = 'URL'; | ||
telegramChatID.classList.add('hidden'); | ||
} | ||
}); | ||
|
||
document | ||
.getElementById('webhook-kind-discord') | ||
.addEventListener('change', (e) => { | ||
if (e.target.value === 'discord') { | ||
urlWebhook.placeholder = 'https://discord.com/api/webhooks/...'; | ||
urlLabel.innerHTML = 'URL'; | ||
telegramChatID.classList.add('hidden'); | ||
} | ||
}); | ||
|
||
document | ||
.getElementById('webhook-kind-slack') | ||
.addEventListener('change', (e) => { | ||
if (e.target.value === 'slack') { | ||
urlWebhook.placeholder = 'https://hooks.slack.com/services/...'; | ||
urlLabel.innerHTML = 'URL'; | ||
telegramChatID.classList.add('hidden'); | ||
} | ||
}); | ||
|
||
document | ||
.getElementById('webhook-kind-telegram') | ||
.addEventListener('change', (e) => { | ||
if (e.target.value === 'telegram') { | ||
urlLabel.innerHTML = 'Token'; | ||
urlWebhook.placeholder = 'Bot token'; | ||
telegramChatID.classList.remove('hidden'); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters