From 60c3e90b0cd5c309d664443678a536c0a363ece4 Mon Sep 17 00:00:00 2001 From: Spatterjaaay Date: Fri, 19 May 2017 14:12:07 -0700 Subject: [PATCH 1/6] added a script tag with jsvascript file link in the body of the html --- index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 191d3cc..0dbff96 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,11 @@
+ + - - From 0ef81b3223d1375651c289ffa84281b902332c8b Mon Sep 17 00:00:00 2001 From: Spatterjaaay Date: Sun, 21 May 2017 15:19:25 -0700 Subject: [PATCH 2/6] added showTime function, addZerofunction and setInterval --- index.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 877a3aa..899622f 100644 --- a/index.js +++ b/index.js @@ -1 +1,30 @@ -// Your code here +$(document).ready(function() { + + var addZero = function(digit) { + if (digit < 10) { + digit = "0" + digit; + } + return digit; + }; + + var showTime = function() { + var today = new Date(), + hours = today.getHours(), + minutes = addZero(today.getMinutes()), + seconds = addZero(today.getSeconds()), + ampm = hours > 11 ? ' PM' : ' AM', + americanHours; + + if (hours === 0) { + americanHours = 12; + } else if (hours < 13) { + americanHours = hours; + } else { + americanHours = addZero(hours % 12); + } + + $("#clock").html(americanHours + ":" + minutes + ":" + seconds + ampm); + }; + + setInterval(showTime, 1000); +}); From 6cce1d17d219e7f25e05f8beceaf414b7bd0a40c Mon Sep 17 00:00:00 2001 From: Spatterjaaay Date: Sun, 21 May 2017 22:32:33 -0700 Subject: [PATCH 3/6] added day, month and year --- index.css | 4 ++-- index.html | 3 +++ index.js | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/index.css b/index.css index ec4a909..ecae92f 100644 --- a/index.css +++ b/index.css @@ -2,13 +2,13 @@ body { background-color: #80d4ea; } -#clock { +#datetime { height: 100px; width: 800px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; - padding-top: 70px; + margin-top: 250px; font-family: courier, monospace; text-align: center; color: white; diff --git a/index.html b/index.html index 0dbff96..c92a582 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,10 @@ +
+
+