HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<link href="https://fonts.googleapis.com/css?family=Orbitron|Text+Me+One" rel="stylesheet">
<div class="container">
<div class="ClockHolder">
<div class="WeekDays">
<span>sat</span>
<span>sun</span>
<span>mon</span>
<span>tue</span>
<span>wed</span>
<span>thu</span>
<span>fri</span>
</div>
<div class="TimeHolder">
<div class="TimeOptions">
<i class="fas fa-clock" data-title="Time"></i>
<i class="fas fa-stopwatch" data-title="StopWatch"></i>
<i class="far fa-clock" data-title="CountDown"></i>
</div>
<div class="Numbers">
<div class="NumberHolder H1">
<span class="d1"></span>
<span class="d2"></span>
<span class="d3"></span>
<span class="d4"></span>
<span class="d5"></span>
<span class="d6"></span>
<span class="d7"></span>
</div>
<div class="NumberHolder H2">
<span class="d1"></span>
<span class="d2"></span>
<span class="d3"></span>
<span class="d4"></span>
<span class="d5"></span>
<span class="d6"></span>
<span class="d7"></span>
</div>
<span>:</span>
<div class="NumberHolder M1">
<span class="d1"></span>
<span class="d2"></span>
<span class="d3"></span>
<span class="d4"></span>
<span class="d5"></span>
<span class="d6"></span>
<span class="d7"></span>
</div>
<div class="NumberHolder M2">
<span class="d1"></span>
<span class="d2"></span>
<span class="d3"></span>
<span class="d4"></span>
<span class="d5"></span>
<span class="d6"></span>
<span class="d7"></span>
</div>
<span>:</span>
<div class="NumberHolder S1">
<span class="d1"></span>
<span class="d2"></span>
<span class="d3"></span>
<span class="d4"></span>
<span class="d5"></span>
<span class="d6"></span>
<span class="d7"></span>
</div>
<div class="NumberHolder S2">
<span class="d1"></span>
<span class="d2"></span>
<span class="d3"></span>
<span class="d4"></span>
<span class="d5"></span>
<span class="d6"></span>
<span class="d7"></span>
</div>
</div>
<div class="AlarmInput">
<input type="number" placeholder="Enter Seconds">
</div>
<div class="TimeFormat">
<div class="Type">
<span>12hr</span>
<span class="active">24hr</span>
</div>
<div class="Formats">
<span>am</span>
<span>pm</span>
</div>
<div class="control">
<span class="Start active"><i class="fas fa-play"></i>Start</span>
<span class="Pause"><i class="fas fa-pause"></i>Pause</span>
<span class="Stop active"><i class="fas fa-stop"></i>Stop</span>
</div>
</div>
</div>
</div>
</div>
/* Css Reset */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: "";
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* Css Code */
body {
background-color: #7b1fa2;
font-family: "Text Me One", sans-serif;
}
.container {
width: 90%;
max-width: 1400px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
justify-content: center;
}
.ClockHolder {
width: 500px;
background-color: #1b252a;
padding: 30px 50px;
border-radius: 15px;
border: 3px solid #0277bd;
position: relative;
}
.ClockHolder::after {
content: " ";
position: absolute;
bottom: -15px;
left: 50%;
width: 70%;
height: 15px;
background-color: #0277bd;
transform: translate(-50%, 0);
border-radius: 3px 3px 8px 8px;
}
.ClockHolder::before {
}
.WeekDays {
display: flex;
width: 100%;
justify-content: space-between;
text-transform: uppercase;
color: #646c72;
cursor: default;
}
.WeekDays .active {
color: aliceblue;
position: relative;
}
.WeekDays .active::after {
content: "";
position: absolute;
bottom: -3px;
left: 0;
height: 2px;
width: 100%;
background-color: aliceblue;
}
.Numbers,
.TimeHolder {
display: flex;
justify-content: space-around;
width: 100%;
padding: 20px 0 5px;
align-items: flex-end;
}
.NumberHolder {
position: relative;
width: 60px;
height: 95px;
}
.d1,
.d2,
.d3,
.d4,
.d5,
.d6,
.d7 {
width: 8px;
height: 40px;
background-color: azure;
position: absolute;
}
.d1::after,
.d2::after,
.d3::after,
.d4::after,
.d5::after,
.d6::after,
.d7::after {
content: "";
position: absolute;
background-color: azure;
width: 7px;
height: 7px;
top: -7px;
left: 0;
clip-path: polygon(0 0, 0% 100%, 100% 100%);
}
.d1::before,
.d2::before,
.d3::before,
.d4::before,
.d5::before,
.d6::before,
.d7::before {
content: "";
position: absolute;
background-color: azure;
width: 7px;
height: 7px;
bottom: -7px;
left: 0;
clip-path: polygon(0 0, 100% 0, 0 100%);
}
.d7 {
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(90deg);
}
.d7::before {
clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.d7::after {
clip-path: polygon(0 100%, 100% 100%, 50% 0);
}
@keyframes From01 {
from {
top: 0;
left: 0;
}
to {
top: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
}
@keyframes From02 {
from {
bottom: 0;
left: 0;
}
to {
bottom: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
}
@keyframes From05 {
from {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
to {
top: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
}
@keyframes From06 {
from {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
to {
bottom: 0;
left: calc(100% - 7px);
transform: rotate(180deg) translate(0, 0);
}
}
.TimeOptions {
display: flex;
flex-direction: column;
color: aliceblue;
}
.Numbers > span {
font-size: 100px;
color: aliceblue;
}
.NumberHolder {
margin: 0 7px;
}
.Formats span {
display: none;
color: aliceblue;
font-size: 2em;
cursor: default;
}
.Formats .active {
display: block;
}
.Type {
display: flex;
flex-direction: column;
color: #98afaf;
}
.Type span {
position: relative;
margin: 2px 0;
cursor: pointer;
}
.Type span::before {
content: "";
position: absolute;
bottom: -1px;
left: 0;
width: 0;
height: 1px;
background-color: #98afaf;
transition: all 0.4s ease;
}
.Type span:hover::before {
width: 100%;
}
.TimeFormat {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 110px;
}
.Type .active {
color: aquamarine;
}
.Type .active::after {
content: "\f053";
font-weight: 900;
font-family: "Font Awesome 5 Free";
position: absolute;
top: 50%;
right: -20px;
transform: translate(-50%, -50%);
}
.Type .active::before {
width: 100%;
}
.TimeOptions i {
margin: 10px 3px;
position: relative;
cursor: pointer;
}
.TimeOptions i::after {
display: block;
opacity: 0;
pointer-events: none;
position: absolute;
background: #fff;
color: #646464;
content: attr(data-title);
font-size: 12px;
padding: 3px 11px;
top: -45%;
left: 50%;
white-space: nowrap;
transform: translate(-50%, -50%) scale3d(0.2, 0.2, 1);
transition: all 0.35s ease-in-out;
line-height: initial;
border-radius: 100px;
z-index: 20;
}
.control {
display: none;
color: #f0ffff;
position: relative;
margin-left: 10px;
}
.control span {
position: relative;
cursor: pointer;
text-align: center;
display: none;
margin-bottom: 20px;
}
.control .Pause {
display: none;
}
.control span.active {
display: block;
}
.control span i {
margin-bottom: 5px;
}
.TimeOptions i:hover::after {
opacity: 1;
transform: translate(-50%, -50%) scale3d(1, 1, 1);
}
.StopWatch .Type,
.StopWatch .Formats,
.Alarm .Type,
.Alarm .Formats {
display: none;
}
.StopWatch .control,
.Alarm .control {
display: block;
}
.ClockHolder::before {
content: "";
position: absolute;
width: 110%;
height: 10px;
background-color: #00000077;
bottom: -25px;
left: -5%;
border-radius: 100%;
filter: blur(5px);
}
.AlarmInput {
display: none;
}
.AlarmInput input {
height: 100px;
font-size: 100px;
max-width: 400px;
font-family: "Orbitron", sans-serif;
background-color: #1b252a;
border: none;
padding: 5px 20px;
color: azure;
letter-spacing: 5px;
position: relative;
}
.AlarmInput input:focus {
border: 1px solid #fff;
}
.Alarm .AlarmInput {
display: block;
}
.Alarm .AlarmInput.DisNone {
display: none;
}
.AlarmInput input::-webkit-input-placeholder {
/* Chrome/Opera/Safari */
font-size: 30px;
}
.AlarmInput input::-moz-placeholder {
/* Firefox 19+ */
font-size: 30px;
}
.AlarmInput input:-ms-input-placeholder {
/* IE 10+ */
font-size: 30px;
}
.AlarmInput input:-moz-placeholder {
/* Firefox 18- */
font-size: 30px;
}
.show1 .d1 {
animation: From01 0.35s ease 1 forwards;
}
.show1 .d2 {
animation: From02 0.35s ease 1 forwards;
}
.show1 .d3 {
top: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
.show1 .d4 {
bottom: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
.show1 .d5 {
animation: From05 0.35s ease 1 forwards;
}
.show1 .d6 {
animation: From06 0.35s ease 1 forwards;
}
.show1 .d7 {
opacity: 0;
}
.show2 .d1 {
top: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
.show2 .d2 {
animation: From12 0.35s ease 1 forwards;
}
.show2 .d3 {
top: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
.show2 .d4 {
animation: From16 0.35s ease 1 forwards;
}
.show2 .d5 {
animation: From15 0.35s ease 1 forwards;
}
.show2 .d6 {
animation: From16 0.35s ease 1 forwards;
}
.show2 .d7 {
opacity: 1;
transition: opacity 0.35s ease;
}
@keyframes From12 {
from {
bottom: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
to {
bottom: 0;
left: 0;
}
}
@keyframes From15 {
from {
top: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
to {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
}
@keyframes From16 {
from {
bottom: 0;
left: calc(100% - 7px);
transform: rotate(180deg) translate(0, 0);
}
to {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
}
.show3 .d1 {
top: 0;
left: calc(100% - 7px);
transform: rotate(180deg);
}
.show3 .d2 {
animation: From22 0.35s ease 1 forwards;
}
.show3 .d3 {
top: 0;
right: 0;
transform: rotate(180deg);
}
.show3 .d4 {
animation: From24 0.35s ease 1 forwards;
}
.show3 .d5 {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
.show3 .d6 {
animation: From24 0.35s ease 1 forwards;
}
.show3 .d7 {
opacity: 1;
transition: opacity 0.35s ease;
}
@keyframes From22 {
from {
bottom: 0;
left: 0;
}
to {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
}
@keyframes From24 {
from {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
to {
bottom: 0;
right: 0;
transform: rotate(180deg) translate(0, 0);
}
}
.show4 .d1 {
animation: From31 0.35s ease 1 forwards;
}
.show4 .d2 {
top: 0;
right: 0;
transform: rotate(180deg);
}
.show4 .d3 {
top: 0;
right: 0;
transform: rotate(180deg);
}
.show4 .d4 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show4 .d5 {
animation: From31 0.35s ease 1 forwards;
}
.show4 .d6 {
animation: From36 0.35s ease 1 forwards;
}
.show4 .d7 {
opacity: 1;
transition: opacity 0.35s ease;
}
@keyframes From31 {
from {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
to {
top: 0;
left: 0;
}
}
@keyframes From32 {
from {
bottom: 0;
left: 0;
}
to {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
}
@keyframes From36 {
from {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
to {
bottom: 0;
right: 0;
transform: rotate(180deg) translate(0, 0);
}
}
.show5 .d1 {
top: 0;
left: 0;
}
.show5 .d2 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show5 .d3 {
animation: From43 0.35s ease 1 forwards;
}
.show5 .d4 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show5 .d5 {
animation: From43 0.35s ease 1 forwards;
}
.show5 .d6 {
animation: From46 0.35s ease 1 forwards;
}
.show5 .d7 {
opacity: 1;
transition: opacity 0.35s ease;
}
@keyframes From43 {
from {
top: 0;
right: 0;
transform: rotate(180deg) translate(0, 0);
}
to {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
}
@keyframes From42 {
from {
bottom: 0;
left: 0;
}
to {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
}
@keyframes From46 {
from {
bottom: 0;
right: 0;
transform: rotate(180deg) translate(0, 0);
}
to {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
}
.show6 .d1 {
top: 0;
left: 0;
}
.show6 .d2 {
animation: From52 0.35s ease 1 forwards;
}
.show6 .d3 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show6 .d4 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show6 .d5 {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
.show6 .d6 {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
.show6 .d7 {
opacity: 1;
transition: opacity 0.35s ease;
}
@keyframes From52 {
from {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
to {
bottom: 0;
left: 0;
}
}
.show7 .d1 {
animation: From61 0.35s ease 1 forwards;
}
.show7 .d2 {
animation: From62 0.35s ease 1 forwards;
}
.show7 .d3 {
animation: From63 0.35s ease 1 forwards;
}
.show7 .d4 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show7 .d5 {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
.show7 .d6 {
animation: From66 0.35s ease 1 forwards;
}
.show7 .d7 {
opacity: 0;
transition: opacity 0.35s ease;
}
@keyframes From61 {
from {
top: 0;
left: 0;
}
to {
top: 0;
right: 0;
transform: rotate(180deg);
}
}
@keyframes From63 {
from {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
to {
top: 0;
right: 0;
transform: rotate(180deg);
}
}
@keyframes From62 {
from {
bottom: 0;
left: 0;
}
to {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
}
@keyframes From66 {
from {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
to {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
}
.show8 .d1 {
animation: From71 0.35s ease 1 forwards;
}
.show8 .d2 {
animation: From72 0.35s ease 1 forwards;
}
.show8 .d3 {
top: 0;
right: 0;
transform: rotate(180deg);
}
.show8 .d4 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show8 .d5 {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
.show8 .d6 {
animation: From76 0.35s ease 1 forwards;
}
.show8 .d7 {
opacity: 1;
transition: opacity 0.35s ease;
}
@keyframes From71 {
from {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
to {
top: 0;
left: 0;
}
}
@keyframes From72 {
from {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
to {
bottom: 0;
left: 0;
}
}
@keyframes From76 {
from {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
to {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
}
.show9 .d1 {
top: 0;
left: 0;
}
.show9 .d2 {
animation: From82 0.35s ease 1 forwards;
}
.show9 .d3 {
top: 0;
right: 0;
transform: rotate(180deg);
}
.show9 .d4 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show9 .d5 {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
.show9 .d6 {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
.show9 .d7 {
opacity: 1;
transition: opacity 0.35s ease;
}
@keyframes From82 {
from {
bottom: 0;
left: 0;
}
to {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
}
.show0 .d1 {
top: 0;
left: 0;
}
.show0 .d2 {
animation: From92 0.35s ease 1 forwards;
}
.show0 .d3 {
top: 0;
right: 0;
transform: rotate(180deg);
}
.show0 .d4 {
bottom: 0;
right: 0;
transform: rotate(180deg);
}
.show0 .d5 {
top: -22px;
left: 7px;
transform: rotate(90deg) translate(-50%, -50%);
}
.show0 .d6 {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
.show0 .d7 {
opacity: 0;
transition: opacity 0.35s ease;
}
@keyframes From92 {
from {
bottom: -22px;
left: 7px;
transform: rotate(-90deg) translate(-50%, 50%);
}
to {
bottom: 0;
left: 0;
}
}
.BgAnimation {
animation: Colors 0.35s ease infinite alternate;
}
@keyframes Colors {
0% {
background-color: #7b1fa2;
}
100% {
background-color: red;
}
}
var Format = 1,
TimeHolder = 0,
StopChecker = 0;
function resetTimer() {
$(".S1").removeClass().addClass("NumberHolder S1 show0");
$(".S2").removeClass().addClass("NumberHolder S2 show0");
$(".M1").removeClass().addClass("NumberHolder M1 show0");
$(".M2").removeClass().addClass("NumberHolder M2 show0");
$(".H1").removeClass().addClass("NumberHolder H1 show0");
$(".H2").removeClass().addClass("NumberHolder H2 show0");
}
function SetDay(DD) {
$(".WeekDays span:nth-child(" + ((DD + 2) % 7) + ")").addClass("active");
}
function Run24hr(S1, S2, M1, M2, H1, H2) {
$(".S1")
.removeClass()
.addClass("NumberHolder S1 show" + S1);
$(".S2")
.removeClass()
.addClass("NumberHolder S2 show" + S2);
$(".M1")
.removeClass()
.addClass("NumberHolder M1 show" + M1);
$(".M2")
.removeClass()
.addClass("NumberHolder M2 show" + M2);
$(".H1")
.removeClass()
.addClass("NumberHolder H1 show" + H1);
$(".H2")
.removeClass()
.addClass("NumberHolder H2 show" + H2);
}
function Run12hr(S1, S2, M1, M2, HH) {
if (HH > 12) {
HH = HH - 12;
$(".Formats span:nth-child(2)").addClass("active");
} else {
$(".Formats span:nth-child(1)").addClass("active");
}
var H1 = Math.floor(HH / 10),
H2 = HH % 10;
$(".S1")
.removeClass()
.addClass("NumberHolder S1 show" + S1);
$(".S2")
.removeClass()
.addClass("NumberHolder S2 show" + S2);
$(".M1")
.removeClass()
.addClass("NumberHolder M1 show" + M1);
$(".M2")
.removeClass()
.addClass("NumberHolder M2 show" + M2);
if (H1 === 0) {
$(".H1").fadeOut(0);
} else {
$(".H1")
.fadeIn()
.removeClass()
.addClass("NumberHolder H1 show" + H1);
}
$(".H2")
.removeClass()
.addClass("NumberHolder H2 show" + H2);
}
function Stopwatch(TimeHolder) {
var HH = Math.floor(TimeHolder / 3600),
MM = Math.floor((TimeHolder - HH * 3600) / 60),
SS = Math.floor(TimeHolder - HH * 3600 - MM * 60);
var S1 = Math.floor(SS / 10),
S2 = SS % 10,
M1 = Math.floor(MM / 10),
M2 = MM % 10,
H1 = Math.floor(HH / 10),
H2 = HH % 10;
Run24hr(S1, S2, M1, M2, H1, H2);
}
function update_time() {
var dt = new Date(),
HH = dt.getHours(),
MM = dt.getMinutes(),
SS = dt.getSeconds(),
DD = dt.getDay();
SetDay(DD);
var S1 = Math.floor(SS / 10),
S2 = SS % 10,
M1 = Math.floor(MM / 10),
M2 = MM % 10,
H1 = Math.floor(HH / 10),
H2 = HH % 10;
if (Format === 1) {
Run24hr(S1, S2, M1, M2, H1, H2);
} else if (Format === 2) {
Run12hr(S1, S2, M1, M2, HH);
} else if (Format === 3 && StopChecker === 0) {
TimeHolder++;
Stopwatch(TimeHolder);
} else if (Format === 4 && StopChecker === 0) {
TimeHolder--;
if (TimeHolder === 0) {
AlarmOut();
} else {
Stopwatch(TimeHolder);
}
}
setTimeout(update_time, 1000);
}
$(".Type span").on("click", function () {
$(".Type .active").removeClass("active");
$(this).addClass("active");
var T = $(this).html();
if (T === "24hr") {
Format = 1;
$(".H1").fadeIn();
$(".Formats span").removeClass("active");
} else {
Format = 2;
}
});
$(".fa-stopwatch").on("click", function () {
$("body").removeClass("BgAnimation");
$(".H1").fadeIn();
if (!$(".TimeHolder").hasClass("StopWatch")) {
Format = 3;
resetTimer();
StopChecker = 1;
$(".TimeHolder").removeClass().addClass("TimeHolder StopWatch");
$(".Numbers").fadeIn(0);
$(".Pause").removeClass("active");
$(".Start").addClass("active");
TimeHolder = 0;
}
});
$(".Start").on("click", function () {
$("body").removeClass("BgAnimation");
if (Format === 3) {
StopChecker = 0;
$(this).removeClass("active");
$(".Pause").addClass("active");
} else if (Format === 4) {
TimeHolder = $(".AlarmInput input").val();
if (TimeHolder > 0) {
StopChecker = 0;
resetTimer();
$(this).removeClass("active");
$(".Pause").addClass("active");
$(".AlarmInput").addClass("DisNone");
$(".Numbers").fadeIn(0);
}
}
});
$(".Pause").on("click", function () {
StopChecker = 1;
$(this).removeClass("active");
$(".Start").addClass("active");
});
$(".Stop").on("click", function () {
$("body").removeClass("BgAnimation");
if (Format === 3) {
StopChecker = 1;
TimeHolder = 0;
resetTimer();
$(".Pause").removeClass("active");
$(".Start").addClass("active");
} else if (Format === 4) {
resetTimer();
StopChecker = 1;
$(".AlarmInput").removeClass("DisNone");
$(".Numbers").fadeOut(0);
$(".AlarmInput input").val("");
$(".Pause").removeClass("active");
$(".Start").addClass("active");
}
});
$(".fas.fa-clock").on("click", function () {
$("body").removeClass("BgAnimation");
if ($(".Type .active").html() === "12hr") {
Format = 2;
} else {
Format = 1;
}
StopChecker = 0;
$(".TimeHolder").removeClass().addClass("TimeHolder");
$(".Numbers").fadeIn(0);
});
$(".far.fa-clock").on("click", function () {
$("body").removeClass("BgAnimation");
$(".H1").fadeIn();
if (!$(".TimeHolder").hasClass("Alarm")) {
$(".TimeHolder").removeClass().addClass("TimeHolder Alarm");
Format = 4;
resetTimer();
StopChecker = 1;
$(".AlarmInput").removeClass("DisNone");
$(".TimeHolder").addClass("Alarm");
$(".Numbers").fadeOut(0);
$(".Pause").removeClass("active");
$(".Start").addClass("active");
}
});
// Alarm Out
function AlarmOut() {
$("body").addClass("BgAnimation");
resetTimer();
StopChecker = 1;
}
update_time();
Also see: Tab Triggers