Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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);

})();
Loading