diff options
Diffstat (limited to 'assets/default/js')
-rw-r--r-- | assets/default/js/base.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/assets/default/js/base.js b/assets/default/js/base.js index 99e03370..d5c29c69 100644 --- a/assets/default/js/base.js +++ b/assets/default/js/base.js | |||
@@ -466,6 +466,28 @@ function init(description) { | |||
466 | }); | 466 | }); |
467 | } | 467 | } |
468 | 468 | ||
469 | const changeVisibilityButtons = document.querySelectorAll('.actions-change-visibility'); | ||
470 | if (changeVisibilityButtons != null && token != null) { | ||
471 | [...changeVisibilityButtons].forEach((button) => { | ||
472 | button.addEventListener('click', (event) => { | ||
473 | event.preventDefault(); | ||
474 | const visibility = event.target.getAttribute('data-visibility'); | ||
475 | |||
476 | const links = []; | ||
477 | const linkCheckedCheckboxes = document.querySelectorAll('.link-checkbox:checked'); | ||
478 | [...linkCheckedCheckboxes].forEach((checkbox) => { | ||
479 | links.push({ | ||
480 | id: checkbox.value, | ||
481 | title: document.querySelector(`.linklist-item[data-id="${checkbox.value}"] .linklist-link`).innerHTML, | ||
482 | }); | ||
483 | }); | ||
484 | |||
485 | const ids = links.map(item => item.id); | ||
486 | window.location = `?change_visibility&token=${token.value}&newVisibility=${visibility}&ids=${ids.join('+')}`; | ||
487 | }); | ||
488 | }); | ||
489 | } | ||
490 | |||
469 | /** | 491 | /** |
470 | * Select all button | 492 | * Select all button |
471 | */ | 493 | */ |