Skip to content

Commit

Permalink
don't count answer button as edit button
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Jan 19, 2024
1 parent b6f1c88 commit 9d6e0e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/scripts/quick_tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { cloneControlButton, createControlButtonTemplate } from '../util/control
import { keyToCss } from '../util/css_map.js';
import { dom } from '../util/dom.js';
import { postSelector } from '../util/interface.js';
import { translate } from '../util/language_data.js';
import { megaEdit } from '../util/mega_editor.js';
import { pageModifications } from '../util/mutations.js';
import { notify } from '../util/notifications.js';
Expand Down Expand Up @@ -235,7 +236,7 @@ postOptionPopupElement.addEventListener('click', processPostOptionBundleClick);
export const main = async function () {
controlButtonTemplate = createControlButtonTemplate(symbolId, buttonClass);

pageModifications.register(`${postSelector} footer ${controlIconSelector} a[href*="/edit/"]`, addControlButtons);
pageModifications.register(`${postSelector} footer ${controlIconSelector} a[href*="/edit/"][aria-label=${translate('Edit')}]`, addControlButtons);
registerPostOption('quick-tags', { symbolId, onclick: togglePostOptionPopupDisplay });

populatePopups();
Expand Down
3 changes: 2 additions & 1 deletion src/scripts/trim_reblogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createControlButtonTemplate, cloneControlButton } from '../util/control
import { keyToCss } from '../util/css_map.js';
import { dom } from '../util/dom.js';
import { filterPostElements, postSelector } from '../util/interface.js';
import { translate } from '../util/language_data.js';
import { showModal, hideModal, modalCancelButton } from '../util/modals.js';
import { onNewPosts } from '../util/mutations.js';
import { notify } from '../util/notifications.js';
Expand Down Expand Up @@ -159,7 +160,7 @@ const processPosts = postElements => filterPostElements(postElements).forEach(as
const existingButton = postElement.querySelector(`.${buttonClass}`);
if (existingButton !== null) { return; }

const editButton = postElement.querySelector(`footer ${controlIconSelector} a[href*="/edit/"]`);
const editButton = postElement.querySelector(`footer ${controlIconSelector} a[href*="/edit/"][aria-label=${translate('Edit')}]`);
if (!editButton) { return; }

const { trail = [], content = [] } = await timelineObject(postElement);
Expand Down

0 comments on commit 9d6e0e2

Please sign in to comment.