aboutsummaryrefslogtreecommitdiff
path: root/src/main/assets/scripts.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/assets/scripts.js')
-rw-r--r--src/main/assets/scripts.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js
index 6c5e987b..4422fdb3 100644
--- a/src/main/assets/scripts.js
+++ b/src/main/assets/scripts.js
@@ -492,6 +492,23 @@ function setPrivacy(e, mid) {
.catch(console.err);
return false;
}
+function toggleWL(e, name) {
+ fetch('/api/users/wl?name=' + name
+ + '&hash=' + document.getElementById('body').getAttribute('data-hash'), {
+ credentials: 'same-origin',
+ method: 'POST'
+ })
+ .then(handleErrors)
+ .then(function(response) {
+ if (response.ok) {
+ window.location.reload();
+ } else {
+ alert('Something went wrong :(');
+ }
+ })
+ .catch(console.err);
+ return false;
+}
function getTags() {
fetch('/api/tags?hash=' + document.getElementById('body').getAttribute('data-hash'), {
@@ -714,6 +731,14 @@ ready(() => {
e.preventDefault();
});
});
+ Array.from(document.querySelectorAll('.a-vip')).forEach(function(e) {
+ e.addEventListener('click', function(e) {
+ toggleWL(
+ e.target,
+ e.target.closest('[data-name]').getAttribute('data-name'));
+ e.preventDefault();
+ });
+ });
Array.from(document.querySelectorAll('.ir a[data-fname], .msg-media a[data-fname]')).forEach(function(el) {
el.addEventListener('click', function(e) {
let fname = /** @type {HTMLElement} */ (e.target).closest('[data-fname]').getAttribute('data-fname');