{% if not reveal_respondents %}
-
{% else %}
-
@@ -63,28 +63,28 @@
// Fallback for environments where HTMX isn't active or the hx-* attributes don't trigger.
// Attach a click handler to buttons with class .show-respondents-btn that will fetch
// the fragment URL (from data-url) and replace the container content.
-(function(){
- try {
- var els = document.querySelectorAll('.show-respondents-btn');
- els.forEach(function(btn){
- btn.addEventListener('click', function(ev){
+ (function(){
+ try {
+ var els = document.querySelectorAll('.show-respondents-btn');
+ els.forEach(function(btn){
+ btn.addEventListener('click', function(ev){
// If HTMX is present it will handle the request; only run fallback when not handled.
- if (window.htmx) return;
- ev.preventDefault();
- var url = btn.getAttribute('data-url');
- if (!url) return;
- fetch(url, {credentials: 'same-origin'})
- .then(function(r){ if (!r.ok) throw new Error('Network response was not ok'); return r.text(); })
- .then(function(html){
- var container = document.querySelector('#anatomy-responses-container');
- if (container) container.outerHTML = html;
- }).catch(function(err){
- console.error('Failed to load responses fragment', err);
- });
- }, {passive: false});
- });
- } catch (e) {
+ if (window.htmx) return;
+ ev.preventDefault();
+ var url = btn.getAttribute('data-url');
+ if (!url) return;
+ fetch(url, {credentials: 'same-origin'})
+ .then(function(r){ if (!r.ok) throw new Error('Network response was not ok'); return r.text(); })
+ .then(function(html){
+ var container = document.querySelector('#anatomy-responses-container');
+ if (container) container.outerHTML = html;
+ }).catch(function(err){
+ console.error('Failed to load responses fragment', err);
+ });
+ }, {passive: false});
+ });
+ } catch (e) {
// ignore
- }
-})();
+ }
+ })();