Skip to content

Commit 882a12b

Browse files
Reformating and using quotable API again!
1 parent 9130b0c commit 882a12b

1 file changed

Lines changed: 16 additions & 35 deletions

File tree

index.js

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,6 @@
1919
});
2020
}
2121

22-
//function fetchVideo() {
23-
//fetch("https://randomvideo.vercel.app/randomvideo")
24-
//.then((resp) => resp.json())
25-
//.then((res) => {
26-
//insertVideo(res?.src?.video_files[0].link);
27-
//})
28-
//.catch(() => {
29-
//error();
30-
//});
31-
//}
32-
//function insertVideo(src) {
33-
//var video = document.getElementById("myVideo");
34-
//var source = document.createElement("source");
35-
//source.setAttribute("src", src);
36-
//video.appendChild(source);
37-
//video.play();
38-
//}
3922
function error() {
4023
let dom = document.getElementById("bgimg");
4124
dom.style.backgroundColor = "grey";
@@ -47,12 +30,11 @@
4730
}
4831

4932
function startTime() {
50-
var today = new Date(),
33+
const today = new Date(),
5134
h = checkTime(today.getHours()),
5235
m = checkTime(today.getMinutes()),
53-
s = checkTime(today.getSeconds());
54-
let time = h + ":" + m;
55-
document.getElementById("time").innerHTML = time;
36+
s = checkTime(today.getSeconds()); // Not used, but can be used to show seconds. TODO : Add seconds to the clock as an setting.
37+
document.getElementById("time").innerHTML = h + ":" + m;
5638
setTimeout(function () {
5739
startTime();
5840
}, 500);
@@ -80,33 +62,33 @@ class TabAction extends Init {
8062
let tab = new TabAction();
8163
getQuote();
8264
tab.setDateDetails();
83-
insertinDom();
65+
insertDom();
8466

85-
function insertinDom() {
67+
function insertDom() {
8668
document.getElementById(
8769
"date"
8870
).innerHTML = `${tab.dateDetails.day}, ${tab.dateDetails.month} ${tab.dateDetails.date}`;
8971
}
9072

9173
function getQuote() {
92-
$.getJSON('https://simonrijntjes.nl/quote.php', function (data) {
74+
$.getJSON('https://api.quotable.io/random', function (data) {
9375
let template =
9476
'<span style="font-size: 2vh;padding: 8px;;text-shadow: 2px 2px 4px #000000;"><strong style="font-style: italic;font-size: 2vh;text-shadow: 0 0 2px gray;">"QUOTE"</strong><a target="_blank" rel="noopenner" style="color:white;text-decoration: none;">- AUTHOR</a><span></span></span>';
95-
var quote = `${data.quote}`;
96-
var author = `${data.author}`;
77+
const quote = `${data.content}`;
78+
const author = `${data.author}`;
9779
template = template.replace("QUOTE", quote);
9880
template = template.replace("AUTHOR", author);
9981
$("#quote").html(template);
10082
});
10183
}
10284

10385
function getdateDetails() {
104-
var today = new Date();
105-
var day = today.getDay();
106-
var dd = today.getDate();
107-
var mm = today.getMonth();
108-
var yyyy = today.getFullYear();
109-
var dL = [
86+
const today = new Date();
87+
const day = today.getDay();
88+
const dd = today.getDate();
89+
const mm = today.getMonth();
90+
const yyyy = today.getFullYear();
91+
const dL = [
11092
"Sunday",
11193
"Monday",
11294
"Tuesday",
@@ -115,7 +97,7 @@ function getdateDetails() {
11597
"Friday",
11698
"Saturday",
11799
];
118-
var mL = [
100+
const mL = [
119101
"January",
120102
"February",
121103
"March",
@@ -146,6 +128,5 @@ function timeTo12HrFormat(time) {
146128
if (time_part_array[0] > 12) {
147129
time_part_array[0] = time_part_array[0] - 12;
148130
}
149-
let formatted_time = `${time_part_array[0]}:${time_part_array[1]} <span class="am_pm">${ampm}<span>`;
150-
return formatted_time;
131+
return `${time_part_array[0]}:${time_part_array[1]} <span class="am_pm">${ampm}<span>`;
151132
}

0 commit comments

Comments
 (0)