Skip to content

Commit ee6683b

Browse files
authored
fix(Classic Footer): hide CSS from Firefox context menus (#1937)
1 parent cafb84e commit ee6683b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/features/classic_footer/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { keyToCss } from '../../utils/css_map.js';
2-
import { a, button, span } from '../../utils/dom.js';
2+
import { a, button, span, link } from '../../utils/dom.js';
33
import { buildStyle, postSelector } from '../../utils/interface.js';
44
import { pageModifications } from '../../utils/mutations.js';
55
import { getPreferences } from '../../utils/preferences.js';
@@ -183,13 +183,15 @@ const processReblogButtons = (reblogButtons) => reblogButtons.forEach(async rebl
183183

184184
if (!canReblog) return;
185185

186+
const styleContent = `${reblogMenuPortalSelector}:has([aria-labelledby="${reblogButton.id}"]) { display: none; }`;
187+
186188
const reblogLink = a({
187189
'aria-label': reblogButton.getAttribute('aria-label'),
188190
class: reblogLinkClass,
189191
click: onReblogLinkClick,
190192
href: `/reblog/${blogName}/${idString}/${reblogKey}`
191193
}, [
192-
buildStyle(`${reblogMenuPortalSelector}:has([aria-labelledby="${reblogButton.id}"]) { display: none; }`),
194+
link({ rel: 'stylesheet', class: 'xkit', href: `data:text/css,${encodeURIComponent(styleContent)}` }),
193195
reblogButton.firstElementChild.cloneNode(true)]
194196
);
195197

src/utils/dom.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function element (tagName, properties = {}, children = []) {
8282
/** @type {VoidHTMLShorthand} */ export const hr = (props = {}) => element('hr', props);
8383
/** @type {VoidHTMLShorthand} */ export const img = (props = {}) => element('img', props);
8484
/** @type {VoidHTMLShorthand} */ export const input = (props = {}) => element('input', props);
85+
/** @type {VoidHTMLShorthand} */ export const link = (props = {}) => element('link', props);
8586

8687
/** @type {SVGShorthand} */ export const path = (props = {}, children = []) => element('path', { xmlns: 'http://www.w3.org/2000/svg', ...props }, children);
8788
/** @type {SVGShorthand} */ export const svg = (props = {}, children = []) => element('svg', { xmlns: 'http://www.w3.org/2000/svg', ...props }, children);

0 commit comments

Comments
 (0)