From 5a22ed2f302e7490998216c5e65c18f485b72652 Mon Sep 17 00:00:00 2001 From: MANCHALA YASWANTH <71426465+MYaswanth28@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:34:16 +0530 Subject: [PATCH 1/2] Create annoucement_banner.js --- .../annoucement_banner.js | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Client-Side Components/UI Scripts/PersistentAnnouncementBanner/annoucement_banner.js diff --git a/Client-Side Components/UI Scripts/PersistentAnnouncementBanner/annoucement_banner.js b/Client-Side Components/UI Scripts/PersistentAnnouncementBanner/annoucement_banner.js new file mode 100644 index 0000000000..ad1bb9c922 --- /dev/null +++ b/Client-Side Components/UI Scripts/PersistentAnnouncementBanner/annoucement_banner.js @@ -0,0 +1,51 @@ +(function() { + var BANNER_TEXT = ' **SYSTEM ALERT:** Scheduled maintenance for all services will occur this Saturday from 1 AM to 4 AM UTC. Expect minor downtime. 🚨'; + var BANNER_BG_COLOR = '#ffcc00'; // Warning yellow + var BANNER_TEXT_COLOR = '#333333'; + + // Check if the user has already dismissed this version of the banner + var isDismissed = (g_preference.get(PREF_KEY) === 'true'); + + if (isDismissed) { + return; + } + var banner = document.createElement('div'); + banner.setAttribute('id', 'global_announcement_banner'); + banner.innerHTML = BANNER_TEXT; + banner.style.cssText = [ + 'position: fixed;', + 'top: 0;', + 'left: 0;', + 'width: 100%;', + 'padding: 10px 40px 10px 15px;', // Added padding on the right for the close button + 'background-color: ' + BANNER_BG_COLOR + ';', + 'color: ' + BANNER_TEXT_COLOR + ';', + 'z-index: 10000;', // High z-index to ensure it sits on top of everything + 'text-align: center;', + 'font-weight: bold;', + 'box-shadow: 0 2px 5px rgba(0,0,0,0.2);' + ].join(''); + var closeButton = document.createElement('span'); + closeButton.innerHTML = '×'; // Times symbol + closeButton.style.cssText = [ + 'position: absolute;', + 'top: 50%;', + 'right: 15px;', + 'transform: translateY(-50%);', + 'font-size: 20px;', + 'cursor: pointer;', + 'font-weight: normal;', + 'line-height: 1;' + ].join(''); + + closeButton.onclick = function() { + // Remove the banner from the DOM + banner.remove(); + + // Set the User Preference so the banner stays dismissed across sessions + g_preference.set(PREF_KEY, 'true'); + }; + banner.appendChild(closeButton); + document.body.appendChild(banner); + +})(); From c1f1389ecb62dc57215649e49de8725964700e3c Mon Sep 17 00:00:00 2001 From: MANCHALA YASWANTH <71426465+MYaswanth28@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:36:23 +0530 Subject: [PATCH 2/2] Create README.md --- .../UI Scripts/PersistentAnnouncementBanner/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Client-Side Components/UI Scripts/PersistentAnnouncementBanner/README.md diff --git a/Client-Side Components/UI Scripts/PersistentAnnouncementBanner/README.md b/Client-Side Components/UI Scripts/PersistentAnnouncementBanner/README.md new file mode 100644 index 0000000000..2562e719e5 --- /dev/null +++ b/Client-Side Components/UI Scripts/PersistentAnnouncementBanner/README.md @@ -0,0 +1,7 @@ +This UI Script is used to inject a custom, highly visible, and persistent notification banner across the top of the entire ServiceNow platform interface. + +It is ideal for communicating critical, non-transactional system messages such as scheduled maintenance, major outages, or company-wide policy announcements. + +The key feature of this banner is that it is dismissible, and it uses a User Preference to ensure that once a user closes a specific version of the announcement + +The Reason to use this is , Announcements Banner Module Sometimes Loads Slower or Doesnt trigger the notification banner , instead this scripts all the time,if user is logged in