From f85cbb49c901b43f38d79ac5e2ad23cc4826f8bd Mon Sep 17 00:00:00 2001 From: shuki Date: Wed, 4 Mar 2026 03:17:51 +0200 Subject: [PATCH] Fix alert: use !important via style tag to override WHM CSS WHM's CSS overrides inline styles on positioned elements. Inject a style tag with !important rules targeting #gniza-alert to ensure fixed positioning, padding, and sizing are applied correctly. Co-Authored-By: Claude Opus 4.6 --- whm/gniza-whm/remotes.cgi | 8 +++++++- whm/gniza-whm/setup.cgi | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/whm/gniza-whm/remotes.cgi b/whm/gniza-whm/remotes.cgi index 51ece88..fed0b28 100644 --- a/whm/gniza-whm/remotes.cgi +++ b/whm/gniza-whm/remotes.cgi @@ -714,11 +714,17 @@ function gnizaTestConnection() { function gnizaToast(type, msg) { var prev = document.getElementById('gniza-alert'); if (prev) prev.remove(); + var s = document.getElementById('gniza-alert-style'); + if (!s) { + s = document.createElement('style'); + s.id = 'gniza-alert-style'; + s.textContent = '#gniza-alert{position:fixed!important;top:24px!important;right:24px!important;z-index:9999!important;max-width:480px!important;padding:12px 20px!important;border-radius:8px!important;font-size:14px!important;box-shadow:0 4px 12px rgba(0,0,0,.15)!important;transition:opacity .3s!important;display:block!important;}'; + document.head.appendChild(s); + } var el = document.createElement('div'); el.id = 'gniza-alert'; el.className = 'alert alert-' + type; el.textContent = msg; - el.style.cssText = 'position:fixed;top:24px;right:24px;z-index:9999;max-width:480px;padding:12px 20px;border-radius:8px;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,.15);transition:opacity .3s'; document.body.appendChild(el); setTimeout(function() { el.style.opacity = '0'; }, type === 'error' ? 6000 : 3000); setTimeout(function() { el.remove(); }, type === 'error' ? 6500 : 3500); diff --git a/whm/gniza-whm/setup.cgi b/whm/gniza-whm/setup.cgi index 84fc313..5e12df7 100644 --- a/whm/gniza-whm/setup.cgi +++ b/whm/gniza-whm/setup.cgi @@ -316,11 +316,17 @@ function gnizaTestConnection() { function gnizaToast(type, msg) { var prev = document.getElementById('gniza-alert'); if (prev) prev.remove(); + var s = document.getElementById('gniza-alert-style'); + if (!s) { + s = document.createElement('style'); + s.id = 'gniza-alert-style'; + s.textContent = '#gniza-alert{position:fixed!important;top:24px!important;right:24px!important;z-index:9999!important;max-width:480px!important;padding:12px 20px!important;border-radius:8px!important;font-size:14px!important;box-shadow:0 4px 12px rgba(0,0,0,.15)!important;transition:opacity .3s!important;display:block!important;}'; + document.head.appendChild(s); + } var el = document.createElement('div'); el.id = 'gniza-alert'; el.className = 'alert alert-' + type; el.textContent = msg; - el.style.cssText = 'position:fixed;top:24px;right:24px;z-index:9999;max-width:480px;padding:12px 20px;border-radius:8px;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,.15);transition:opacity .3s'; document.body.appendChild(el); setTimeout(function() { el.style.opacity = '0'; }, type === 'error' ? 6000 : 3000); setTimeout(function() { el.remove(); }, type === 'error' ? 6500 : 3500);