diff options
author | Mario <mario@mariovavti.com> | 2023-05-04 09:28:05 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-05-04 09:28:05 +0000 |
commit | dfa43b48566ebdc758a46de0090cfcc9617471b1 (patch) | |
tree | e42fbcd6100e1cea35b6cee3614f5ff5940569e5 /view/tpl/directory_header.tpl | |
parent | a24a1ca6d79cf48ae18352a9df9e94bc6c4c7431 (diff) | |
parent | 2d4b35fbc99062d52c6c32cacd158ceda661bb31 (diff) | |
download | volse-hubzilla-dfa43b48566ebdc758a46de0090cfcc9617471b1.tar.gz volse-hubzilla-dfa43b48566ebdc758a46de0090cfcc9617471b1.tar.bz2 volse-hubzilla-dfa43b48566ebdc758a46de0090cfcc9617471b1.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'view/tpl/directory_header.tpl')
-rw-r--r-- | view/tpl/directory_header.tpl | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/view/tpl/directory_header.tpl b/view/tpl/directory_header.tpl index f5ce7ce0a..a261762ac 100644 --- a/view/tpl/directory_header.tpl +++ b/view/tpl/directory_header.tpl @@ -19,7 +19,68 @@ {{** make sure this element is at the bottom - we rely on that in endless scroll **}} <div id="page-end" class="float-start w-100"></div> </div> -<script>$(document).ready(function() { loadingPage = false;});</script> <div id="page-spinner" class="spinner-wrapper"> <div class="spinner m"></div> </div> +<script> + $(document).ready(function() { + loadingPage = false; + {{if $directory_admin}} + $(document).on('click', '.directory-censor', function (e) { + e.preventDefault(); + + let that = this; + let url; + let path; + let severity; + let parent = this.closest('.directory-actions'); + let el; + + url = new URL(that.href) + + severity = url.searchParams.get('severity'); + path = url.pathname; + + console.log(url.searchParams.get('severity')); + + $.get( + path, + { + aj: 1, + severity : severity + }, + function(data) { + console.log(data) + if (data.success) { + + if (that.classList.contains('directory-censor-unsafe')) { + severity = data.flag ? 0 : 1; + el = parent.getElementsByClassName('directory-censor-hide')[0]; + if (el.classList.contains('active')) { + el.classList.toggle('active'); + url.searchParams.set('severity', 2); + el.href = url.toString(); + } + } + + if (that.classList.contains('directory-censor-hide')) { + severity = data.flag ? 0 : 2; + el = parent.getElementsByClassName('directory-censor-unsafe')[0]; + if (el.classList.contains('active')) { + el.classList.toggle('active'); + url.searchParams.set('severity', 1); + el.href = url.toString(); + } + } + + url.searchParams.set('severity', severity); + that.href = url.toString(); + that.classList.toggle('active'); + + } + } + ); + }); + {{/if}} + }); +</script> |