diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index be536a4..04a4a4a 100644 --- a/user_script/checkmk_swissknife.user.js +++ b/user_script/checkmk_swissknife.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Checkmk SwissKnife // @namespace https://luigidacunto.com/ -// @version 2.9.5 +// @version 2.9.9 // @description Raccolta di miglioramenti all'interfaccia di Checkmk WATO. Ogni fix o enhancement viene aggiunto qui come feature indipendente. // @author Luigi D'Acunto // @homepageURL https://git.luigidacunto.com/tools/checkmk-swissknife @@ -827,34 +827,39 @@ vertical-align: middle; } .cmk-sk-inv-btn, .cmk-sk-copy-btn, .cmk-sk-copy-short-btn { - display: inline-flex; - align-items: center; - justify-content: center; - width: 16px; - height: 16px; - border-radius: 3px; - cursor: pointer; + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + width: 16px !important; + height: 16px !important; + border-radius: 3px !important; + cursor: pointer !important; opacity: 0.8; flex-shrink: 0; - padding: 0; + padding: 0 !important; + margin: 1px !important; + box-sizing: border-box !important; text-decoration: none !important; + font-size: 0 !important; + line-height: 0 !important; + vertical-align: middle !important; } - .cmk-sk-inv-btn, .cmk-sk-inv-btn:visited { - background: rgba(229,165,0,0.08); + .cmk-sk-inv-btn { + background: rgba(229,165,0,0.08) !important; color: #e5a500 !important; - border: 1px solid #e5a500; + border: 1px solid #e5a500 !important; } - .cmk-sk-inv-btn:hover { opacity: 1; background: rgba(229,165,0,0.18) !important; } + .cmk-sk-inv-btn:hover { opacity: 1 !important; background: rgba(229,165,0,0.18) !important; } .cmk-sk-copy-btn { - background: rgba(90,180,214,0.08); + background: rgba(90,180,214,0.08) !important; color: #5ab4d6 !important; - border: 1px solid #5ab4d6; + border: 1px solid #5ab4d6 !important; } .cmk-sk-copy-btn:hover { opacity: 1; background: rgba(90,180,214,0.18) !important; } .cmk-sk-copy-short-btn { - background: rgba(160,120,200,0.08); + background: rgba(160,120,200,0.08) !important; color: #a078c8 !important; - border: 1px solid #a078c8; + border: 1px solid #a078c8 !important; } .cmk-sk-copy-short-btn:hover { opacity: 1; background: rgba(160,120,200,0.18) !important; } .cmk-sk-copy-btn.copied, .cmk-sk-copy-short-btn.copied { @@ -869,23 +874,23 @@ const CLIP_SVG = ''; hostCells.forEach(td => { - const link = td.querySelector('a[href*="view_name=hoststatus"]'); - if (!link) return; - const params = new URLSearchParams(link.getAttribute('href').split('?')[1] || ''); - const hostname = params.get('host'); + let hostname = null; + for (const a of td.querySelectorAll('a[href*="host="]')) { + const h = new URLSearchParams(a.getAttribute('href').split('?')[1] || '').get('host'); + if (h) { hostname = h; break; } + } if (!hostname) return; const shortname = hostname.split('.')[0]; const group = doc.createElement('span'); group.className = 'cmk-sk-btn-group'; - const btn = doc.createElement('a'); + const btn = doc.createElement('button'); btn.className = 'cmk-sk-inv-btn'; - btn.href = `wato.py?host=${encodeURIComponent(hostname)}&mode=inventory`; - btn.target = '_blank'; - btn.rel = 'noopener'; + btn.type = 'button'; btn.title = `Service Discovery: ${hostname}`; btn.innerHTML = ''; + btn.addEventListener('click', () => { window.open(`wato.py?host=${encodeURIComponent(hostname)}&mode=inventory`, '_blank', 'noopener'); }); const copyBtn = doc.createElement('button'); copyBtn.className = 'cmk-sk-copy-btn';