Skip to content

Commit 5eff644

Browse files
Reformat
1 parent adcb50b commit 5eff644

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

index.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
document.getElementById("time").innerHTML = h + ":" + m;
2929
setTimeout(function () {
3030
startTime();
31-
}, 500);
31+
}, 1000);
3232
}
33-
3433
startTime();
3534
})();
3635

@@ -62,18 +61,18 @@ function insertDom() {
6261
}
6362

6463
function getQuote() {
65-
$.getJSON('https://api.quotable.io/random', function (data) {
66-
let template =
67-
'<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>';
68-
const quote = `${data.content}`;
69-
const author = `${data.author}`;
70-
template = template.replace("QUOTE", quote);
71-
template = template.replace("AUTHOR", author);
72-
$("#quote").html(template);
73-
});
74-
// On error, show an error quote and author.
7564
$.ajax({
7665
url: "https://api.quotable.io/random",
66+
dataType: "json",
67+
success: function (data) {
68+
let template =
69+
'<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>';
70+
const quote = `${data.content}`;
71+
const author = `${data.author}`;
72+
template = template.replace("QUOTE", quote);
73+
template = template.replace("AUTHOR", author);
74+
$("#quote").html(template);
75+
},
7776
error: function (data) {
7877
let template =
7978
'<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>';

0 commit comments

Comments
 (0)