Buckler/static/buckler.js

35 lines
909 B
JavaScript
Raw Normal View History

2019-09-25 12:51:36 -04:00
function load() {
let headers = document.querySelectorAll('h2');
headers.forEach(function(header) {
header.addEventListener('click', function() {
let article = this.nextElementSibling;
if (article.style.display === 'none') {
article.style.display = '';
} else {
article.style.display = 'none';
}
});
});
}
2019-09-20 19:24:12 -04:00
function perm_change(row) {
let user_perms = users_perms[row.children[0].textContent];
2019-09-26 14:39:48 -04:00
let row_perms = {};
2019-09-20 19:24:12 -04:00
for (let child of row.children) {
if (child.firstChild.type == "checkbox") {
if (child.firstChild.checked) {
2019-09-26 14:39:48 -04:00
row_perms[child.firstChild.dataset.appName] = true;
2019-09-20 19:24:12 -04:00
} else {
2019-09-26 14:39:48 -04:00
row_perms[child.firstChild.dataset.appName] = false;
2019-09-20 19:24:12 -04:00
}
}
}
let perms_changed = false;
2019-09-26 14:39:48 -04:00
for (let app_name of Object.keys(user_perms)) {
if (user_perms[app_name] != row_perms[app_name]) {
2019-09-20 19:24:12 -04:00
perms_changed = true;
}
}
console.log("perms_changed = " + perms_changed);
}