From 8bcd6eb79a53506b96fb0c3c42e50e00c5d7efdb Mon Sep 17 00:00:00 2001 From: Ryo Hilmawan <54142180+CloudHill@users.noreply.github.com> Date: Sat, 21 Nov 2020 13:18:21 +0700 Subject: [PATCH] Fix visual issues and modal detection (#279) --- mods/notion-icons/mod.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mods/notion-icons/mod.js b/mods/notion-icons/mod.js index f4d868d..8f2a61f 100644 --- a/mods/notion-icons/mod.js +++ b/mods/notion-icons/mod.js @@ -177,7 +177,7 @@ module.exports = { if (iconData.enhancerIcons) { // Load sprite sheet icon.innerHTML = - `
`; + `
`; } else { icon.innerHTML = ``; // Make sure icons load @@ -315,14 +315,18 @@ module.exports = { const observer = new MutationObserver((list, observer) => { for ( let { addedNodes } of list) { - if (addedNodes[0] && - addedNodes[0].style && - (addedNodes[0].style.cssText === 'pointer-events: auto; position: relative; z-index: 0;' || - addedNodes[0].style.cssText === 'pointer-events: auto; position: relative; z-index: 1;' || - addedNodes[0].style.cssText === 'pointer-events: auto; position: relative; z-index: 2;') && - document.querySelector('.notion-media-menu') - ) - addIconsTab(); + if ( + addedNodes[0] && + addedNodes[0].style && + document.querySelector('.notion-media-menu') + ) { + for (let i = 0; i <= 3; i++) { + if (addedNodes[0].style.cssText === `pointer-events: auto; position: relative; z-index: ${i};`) { + addIconsTab(); + return; + } + } + } } }); observer.observe(overlay, {