|
28 | 28 | document.getElementById("time").innerHTML = h + ":" + m; |
29 | 29 | setTimeout(function () { |
30 | 30 | startTime(); |
31 | | - }, 500); |
| 31 | + }, 1000); |
32 | 32 | } |
33 | | - |
34 | 33 | startTime(); |
35 | 34 | })(); |
36 | 35 |
|
@@ -62,18 +61,18 @@ function insertDom() { |
62 | 61 | } |
63 | 62 |
|
64 | 63 | 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. |
75 | 64 | $.ajax({ |
76 | 65 | 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 | + }, |
77 | 76 | error: function (data) { |
78 | 77 | let template = |
79 | 78 | '<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