PopupMenuとPopClipのポップアップが重ならないようにする
Macの便利アプリPopClip
↓ これを
https://gyazo.com/5b83291b821df403f503d29f978d8fa7
↓ こうします
https://gyazo.com/25b3167e05d4fc1f9aa186b4011cbd3f
code:script.js
if (/Macintosh/.test(navigator.userAgent) && !/Porter/.test(navigator.userAgent)) {
setTimeout(() => {
const observer = new MutationObserver(records => {
for (const record of records) {
for (const node of record.addedNodes) {
if (node.getAttribute('class') !== 'selections') {
continue;
}
const popup = node.getElementsByClassName('popup-menu')0; if (!popup) return;
popup.style.top = (() => {
const selectionList = document.getElementsByClassName('selection');
let lowestSelection = selectionList0; const length = selectionList.length;
if (length !== 1) {
for (let i = 1; i < length; i++) {
if (parseInt(selectionListi-1.style.top) < parseInt(selectionListi.style.top)) { lowestSelection = selectionListi; }
}
}
return (parseInt(lowestSelection.style.top) + parseInt(lowestSelection.style.height) + popup.clientHeight + 25) + 'px';
})();
const triangleStyle = popup.getElementsByClassName('triangle')0.style; triangleStyle.borderTop = 'none';
triangleStyle.borderBottom = '6px solid #111'; triangleStyle.top = '-6px';
break;
}
}
});
observer.observe(document.getElementById('editor'), { childList: true });
}, 2000);
}
UserScript.icon