Skip to content
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

Tag Tracking+: Fix search dropdown mode #1325

Closed
Closed
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
11 changes: 6 additions & 5 deletions src/features/tag_tracking_plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ const searchCountClass = 'xkit-tag-tracking-plus-search-count';
const excludeClass = 'xkit-tag-tracking-plus-done';
const includeFiltered = true;

const tagLinkSelector = `${keyToCss('searchResult')} h3 ~ a${keyToCss('typeaheadRow')}[href^="/tagged/"]`;
const tagTextSelector = keyToCss('tagText');
const tagLinkSelector = `${keyToCss('searchResult', 'followedTags')} :is(h3, h4) ~ a${keyToCss('typeaheadRow')}[href^="/tagged/"]`;
const modalTagLinkSelector = `${keyToCss('manageTagsModal')} ${keyToCss('tagItem')}`;
const tagTextSelector = keyToCss('tagText', 'tagName');

let trackedTags;
const unreadCounts = new Map();
Expand Down Expand Up @@ -146,13 +147,13 @@ const processTagLinks = function (tagLinkElements) {
if (tagLinkElement.querySelector('[data-count-for]') !== null) return;

const tagTextElement = tagLinkElement.querySelector(tagTextSelector);
const tag = tagTextElement.textContent;
const tag = tagTextElement.textContent.replace('#', '');
const unreadCountElement = dom(
'span',
{
class: searchCountClass,
'data-count-for': `#${tag}`,
style: 'margin-left: auto; margin-right: 1ch; opacity: 0.65;'
style: 'margin-left: auto; margin-right: 1ch; opacity: 0.65; flex: 0'
},
null,
[unreadCounts.get(tag) ?? '\u22EF']
Expand Down Expand Up @@ -187,7 +188,7 @@ export const main = async function () {
document.body.dataset.tagTrackingPlusShowSearch = showUnread === 'both' || showUnread === 'search';
document.body.dataset.tagTrackingPlusShowSidebar = showUnread === 'both' || showUnread === 'sidebar';

pageModifications.register(tagLinkSelector, processTagLinks);
pageModifications.register(`${tagLinkSelector}, ${modalTagLinkSelector}`, processTagLinks);

sidebarItem = addSidebarItem({
id: 'tag-tracking-plus',
Expand Down