diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-10-13 12:07:13 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-10-13 12:07:13 +0200 |
commit | d9f6275ebca035fec8331652c677981056793ccc (patch) | |
tree | 37a64baf4f0eba6b781040605965383d8aded2cc /assets/default/js/base.js | |
parent | 38672ba0d1c722e5d6d33a58255ceb55e9410e46 (diff) | |
parent | d63ff87a009313141ae684ec447b902562ff6ee7 (diff) | |
download | Shaarli-stable.tar.gz Shaarli-stable.tar.zst Shaarli-stable.zip |
Merge branch 'v0.11' into stablestable
Diffstat (limited to 'assets/default/js/base.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 | */ |