Skip to content

Commit

Permalink
Preserve Mark Unread button on ajax updates (refined-github#996)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Jan 15, 2018
1 parent a27c844 commit de6a7da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion source/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ td.js-line-comments:last-child .timeline-comment-actions .add-reaction-popover::
}

/* Mark as unread */
.btn-mark-unread {
.rgh-btn-mark-unread {
width: 100%;
margin-top: 8px;
}

Expand Down
6 changes: 3 additions & 3 deletions source/features/mark-unread.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ function stripHash(url) {
function addMarkUnreadButton() {
const container = select('.js-thread-subscription-status');
if (container) {
const button = <button class="btn btn-sm btn-mark-unread js-mark-unread">Mark as unread</button>;
const button = <button class="btn btn-sm rgh-btn-mark-unread">Mark as unread</button>;
button.addEventListener('click', markUnread, {
once: true
});
container.append(button);
container.after(button);
}
}

Expand Down Expand Up @@ -385,7 +385,7 @@ function destroy() {
listener.destroy();
}
listeners.length = 0;
for (const button of select.all('.js-mark-unread')) {
for (const button of select.all('.rgh-btn-mark-unread')) {
button.remove();
}
}

0 comments on commit de6a7da

Please sign in to comment.