mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-09 16:19:25 -07:00
Overlay 2.0 (#12)
This commit is contained in:
16
src/renderer/yomitan-popup.ts
Normal file
16
src/renderer/yomitan-popup.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export const YOMITAN_POPUP_IFRAME_SELECTOR = 'iframe.yomitan-popup, iframe[id^="yomitan-popup"]';
|
||||
export const YOMITAN_POPUP_SHOWN_EVENT = 'yomitan-popup-shown';
|
||||
export const YOMITAN_POPUP_HIDDEN_EVENT = 'yomitan-popup-hidden';
|
||||
|
||||
export function isYomitanPopupIframe(element: Element | null): boolean {
|
||||
if (!element) return false;
|
||||
if (element.tagName.toUpperCase() !== 'IFRAME') return false;
|
||||
|
||||
const hasModernPopupClass = element.classList?.contains('yomitan-popup') ?? false;
|
||||
const hasLegacyPopupId = (element.id ?? '').startsWith('yomitan-popup');
|
||||
return hasModernPopupClass || hasLegacyPopupId;
|
||||
}
|
||||
|
||||
export function hasYomitanPopupIframe(root: ParentNode = document): boolean {
|
||||
return root.querySelector(YOMITAN_POPUP_IFRAME_SELECTOR) !== null;
|
||||
}
|
||||
Reference in New Issue
Block a user