8000 Make Mark All As Read optional by karlhorky · Pull Request #155 · fregante/notifications-preview-github · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make Mark All As Read optional #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions source/github-notifications-preview.jsx
8000
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ async function openDropdown({currentTarget: indicator}) {
if (!isOpen(dropdown) && list.length > 0) {
const container = $('.NPG-dropdown', dropdown);
empty(container);

const dropdownHeader = (
<div
style={{
Expand Down Expand Up @@ -168,7 +169,11 @@ async function openDropdown({currentTarget: indicator}) {
</div>
</div>
);
container.append(dropdownHeader);

if (options.markAllAsRead) {
container.append(dropdownHeader);
}

container.append(...list);

delegate('.NPG-dropdown button', 'click', async event => {
Expand Down Expand Up @@ -206,7 +211,10 @@ async function openDropdown({currentTarget: indicator}) {

// All notifications are read, remove the header
if ($$('.js-notifications-list-item, .js-notifications-group').length === 0) {
dropdownHeader.remove();
if (options.markAllAsRead) {
dropdownHeader.remove();
}

closeDropdown();
}
});
Expand Down
1 change: 1 addition & 0 deletions source/options-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import OptionsSync from 'webext-options-sync';
const optionsStorage = new OptionsSync({
defaults: {
previewCount: true,
markAllAsRead: true,
dropdown: 'compact',
participating: false,
closeOnMouseleave: false,
Expand Down
6 changes: 6 additions & 0 deletions source/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
Show notification number in blue bubble
</label>
</p>
<p>
<label>
<input type="checkbox" name="markAllAsRead">
Show "Mark all as read" link
</label>
</p>
<p>
<label>
<input type="checkbox" name="participating">
Expand Down
0