Skip to content

Digital Clock Widget #1599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2024
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
15 changes: 15 additions & 0 deletions Service Portal Widgets/Digital Clock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Digital Clock Widget for ServiceNow Portal
This widget displays a simple digital clock with a black background and white text. It shows the current time in hours, minutes, and seconds and updates every second.

## Features
Displays the current time in HH:MM:SS format.
Black background with white text for easy readability.
Automatic time update every second.

## Usage
Add this widget to any ServiceNow Portal page where you want to display the digital clock.
The clock automatically updates every second without requiring any additional configuration.

## Customization
Background Color: You can change the background-color property in CSS to a different color if desired.
Font Color: Modify the color property to set a custom text color.
3 changes: 3 additions & 0 deletions Service Portal Widgets/Digital Clock/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="digital-clock">
<span>{{ currentTime }}</span>
</div>
12 changes: 12 additions & 0 deletions Service Portal Widgets/Digital Clock/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
api.controller = function($scope, $interval) {
function updateTime() {
var now = new Date();
$scope.currentTime = now.toLocaleTimeString();
}

// Initialize the clock on load
updateTime();

// Update the clock every second
$interval(updateTime, 1000);
};
13 changes: 13 additions & 0 deletions Service Portal Widgets/Digital Clock/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.digital-clock {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
width: 200px;
margin: auto;
background-color: #000;
color: #fff;
font-family: 'Courier New', Courier, monospace;
font-size: 2em;
border-radius: 5px;
}
Loading