Skip to content

Commit 8bb2371

Browse files
committed
feat: Add comprehensive debugging for Cusdis reactions
- Add script load event handler for better reaction detection - Enhance reaction checking with multiple selector variations - Add detailed console logging for debugging reaction visibility - Force visibility of any hidden reaction elements with CSS - Log Cusdis configuration to help diagnose issues - Check for comments and reaction containers separately
1 parent 1a0b900 commit 8bb2371

1 file changed

Lines changed: 37 additions & 4 deletions

File tree

docs/assets/cusdis.js

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757

5858
// Check if reactions are working after a delay
5959
setTimeout(checkReactions, 2000);
60+
61+
// Also check when Cusdis is fully loaded
62+
cusdisScript.onload = function() {
63+
console.log('Cusdis script loaded, checking for reactions...');
64+
setTimeout(checkReactions, 1000);
65+
};
6066
}
6167
}
6268

@@ -368,7 +374,8 @@
368374
/* Ensure reaction container is visible - multiple selector variations */
369375
#cusdis_thread .cusdis-reactions,
370376
#cusdis_thread [class*="reactions"],
371-
#cusdis_thread .reactions-container {
377+
#cusdis_thread .reactions-container,
378+
#cusdis_thread .reactions {
372379
display: flex !important;
373380
flex-wrap: wrap !important;
374381
gap: 0.75rem !important;
@@ -377,6 +384,15 @@
377384
padding: 0.75rem 0 !important;
378385
border-top: 1px solid var(--md-default-fg-color--lightest) !important;
379386
padding-top: 1rem !important;
387+
visibility: visible !important;
388+
opacity: 1 !important;
389+
}
390+
391+
/* Force show any hidden reaction elements */
392+
#cusdis_thread [style*="display: none"],
393+
#cusdis_thread [style*="visibility: hidden"] {
394+
display: flex !important;
395+
visibility: visible !important;
380396
}
381397
382398
/* Responsive design */
@@ -403,8 +419,10 @@
403419
}
404420

405421
function checkReactions() {
422+
console.log('Cusdis: Checking for reactions...');
423+
406424
// Check if reactions are visible with multiple selector variations
407-
const reactions = document.querySelectorAll('.cusdis-reaction, [class*="reaction"], .cusdis-reaction-button');
425+
const reactions = document.querySelectorAll('.cusdis-reaction, [class*="reaction"], .cusdis-reaction-button, .reaction-btn');
408426
if (reactions.length === 0) {
409427
console.log('Cusdis: No reaction buttons found, checking configuration...');
410428

@@ -417,7 +435,7 @@
417435

418436
// Check again after a short delay
419437
setTimeout(() => {
420-
const retryReactions = document.querySelectorAll('.cusdis-reaction, [class*="reaction"], .cusdis-reaction-button');
438+
const retryReactions = document.querySelectorAll('.cusdis-reaction, [class*="reaction"], .cusdis-reaction-button, .reaction-btn');
421439
console.log(`Cusdis: Retry found ${retryReactions.length} reaction buttons`);
422440
}, 1000);
423441
}
@@ -426,7 +444,22 @@
426444
}
427445

428446
// Also check for reaction containers
429-
const reactionContainers = document.querySelectorAll('.cusdis-reactions, [class*="reactions"], .reactions-container');
447+
const reactionContainers = document.querySelectorAll('.cusdis-reactions, [class*="reactions"], .reactions-container, .reactions');
430448
console.log(`Cusdis: Found ${reactionContainers.length} reaction containers`);
449+
450+
// Check if there are any comments at all
451+
const comments = document.querySelectorAll('.cusdis-comment, [class*="comment"]');
452+
console.log(`Cusdis: Found ${comments.length} comments`);
453+
454+
// Log the current Cusdis configuration
455+
const cusdisThread = document.getElementById('cusdis_thread');
456+
if (cusdisThread) {
457+
console.log('Cusdis configuration:', {
458+
'data-reaction': cusdisThread.getAttribute('data-reaction'),
459+
'data-theme': cusdisThread.getAttribute('data-theme'),
460+
'data-version': cusdisThread.getAttribute('data-version'),
461+
'data-lang': cusdisThread.getAttribute('data-lang')
462+
});
463+
}
431464
}
432465
})();

0 commit comments

Comments
 (0)