Content deleted Content added
Polygnotus (talk | contribs) ←Created page with '// Wikipedia Highlighted Comments Navigator // Add to your common.js to navigate through unread highlighted comments $(document).ready(function() { // Wait a bit for the page to fully load and highlights to be applied setTimeout(function() { initCommentNavigator(); }, 1000); }); function initCommentNavigator() { const highlights = $('.ext-discussiontools-init-highlight'); if (highlights.length === 0) { return; // N...' Tag: Recreated |
Polygnotus (talk | contribs) m Polygnotus moved page User:Polygnotus/Scripts/tmp.js to User:Polygnotus/Scripts/NewCommentsNavigator.js |
||
(3 intermediate revisions by the same user not shown) | |||
Line 12:
const highlights = $('.ext-discussiontools-init-highlight');
// Only show navigator if there are more than 1 highlighted comment
if (highlights.length
return;
}
Line 22 ⟶ 23:
<div id="comment-navigator" style="
position: fixed;
background: #f8f9fa;
border-top:
z-index: 1000;
font-size:
align-items: center;
justify-content: center;
gap: 15px;
">
<
<span
"><span id="comment-counter">1</span> / ${highlights.length}</span>
background: #0645ad;▼
<button id="next-comment" type="button"
<button id="close-navigator" type="button"
margin-left: 20px;
">✕</button>
</div>
`;
Line 102 ⟶ 108:
// Event handlers
$('#prev-comment').click(function(e) {
e.preventDefault();
e.stopPropagation();
if (currentIndex > 0) {
currentIndex--;
updateSelection(currentIndex);
}
return false;
});
$('#next-comment').click(function(e) {
e.preventDefault();
e.stopPropagation();
if (currentIndex < highlights.length - 1) {
currentIndex++;
updateSelection(currentIndex);
}
return false;
});
$('#close-navigator').click(function(e) {
e.preventDefault();
e.stopPropagation();
// Remove outlines and hide navigator
highlights.css('outline', '');
$('#comment-navigator').remove();
return false;
});
|