summaryrefslogtreecommitdiff
path: root/js/index.js
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2018-01-17 21:20:58 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2018-01-17 21:20:58 +0530
commit8725c87380a86ab9fe416b95c4506e855052487e (patch)
tree371d3a45604a3be2f77d8ebf1bc1c8ae679505c6 /js/index.js
added files
Diffstat (limited to 'js/index.js')
-rw-r--r--js/index.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/index.js b/js/index.js
new file mode 100644
index 0000000..1c28fcc
--- /dev/null
+++ b/js/index.js
@@ -0,0 +1,27 @@
+d = new Date();
+days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
+months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
+day = d.getDate();
+w = days[d.getDay()];
+month = months[d.getMonth()];
+h = d.getHours();
+y = d.getFullYear();
+m = d.getMinutes();
+ampm = h >= 12 ? 'pm' : 'am';
+h = h % 12;
+h = h ? h : 12; // the hour '0' should be '12'
+m = m < 10 ? '0' + m : m;
+var strTime = h + ':' + m + ' ' + ampm;
+document.getElementsByClassName('time')[0].innerHTML = day + ' ' + month + ' ' + y + '<br />' + w + ' ' + strTime;
+
+var body = document.body;
+setTimeout(function(){
+ body.classList.add('active');
+}, 200);
+
+document.getElementsByClassName('reload')[0].onclick = function() {
+ body.classList.remove('active');
+ setTimeout(function() {
+ body.classList.add('active');
+ }, 1500);
+} \ No newline at end of file