fix(lampa): ensure injected left-menu item is active and clickable
This commit is contained in:
@@ -106,6 +106,8 @@
|
||||
css.id = 'p365x-style';
|
||||
css.textContent = '' +
|
||||
'#p365x-fab{position:fixed;right:24px;bottom:24px;z-index:99999;background:#e91e63;color:#fff;border:none;border-radius:999px;padding:10px 14px;font-weight:700;}' +
|
||||
'#p365x-left-menu-item{opacity:1!important;pointer-events:auto!important;filter:none!important;}' +
|
||||
'#p365x-left-menu-item .menu__text,#p365x-left-menu-item .menu__ico{opacity:1!important;color:inherit!important;}' +
|
||||
'#p365x-root{position:fixed;inset:0;z-index:99998;background:#111;color:#fff;display:none;}' +
|
||||
'#p365x-head{padding:12px 16px;display:flex;gap:10px;align-items:center;border-bottom:1px solid #333;}' +
|
||||
'#p365x-list{padding:10px;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px;overflow:auto;height:calc(100% - 64px);}' +
|
||||
@@ -223,6 +225,10 @@
|
||||
var item = ce('div', 'menu__item selector');
|
||||
item.id = 'p365x-left-menu-item';
|
||||
item.setAttribute('data-action', 'p365x');
|
||||
item.setAttribute('tabindex', '0');
|
||||
item.style.opacity = '1';
|
||||
item.style.pointerEvents = 'auto';
|
||||
item.style.filter = 'none';
|
||||
item.innerHTML = '' +
|
||||
'<div class="menu__ico">' +
|
||||
'<svg width="24" height="24" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">' +
|
||||
@@ -232,12 +238,23 @@
|
||||
'</div>' +
|
||||
'<div class="menu__text">P365X</div>';
|
||||
|
||||
item.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
function runOpen(e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
openPanel();
|
||||
}
|
||||
|
||||
item.addEventListener('click', runOpen);
|
||||
item.addEventListener('keydown', function (e) {
|
||||
var key = e && (e.key || e.code);
|
||||
if (key === 'Enter' || key === 'NumpadEnter' || key === ' ') runOpen(e);
|
||||
});
|
||||
|
||||
// Дублируем обработчик на внутренние узлы — некоторые темы ловят клик только там
|
||||
item.addEventListener('mouseup', runOpen);
|
||||
|
||||
host.appendChild(item);
|
||||
log('Left menu entry injected via DOM fallback');
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user