-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts-listeners.html
62 lines (48 loc) · 1.36 KB
/
scripts-listeners.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<script>
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Thu Aug 21 12:59:01 PDT 2014
// Last Modified: Sun Oct 29 22:08:45 PDT 2023
// Filename: scripts-local.html
// Syntax: ECMAScript 6
// vim: ts=3:ft=javascript
//
// Description: Listeners for homepage.
//
let JRP = {};
//////////////////////////////
//
// DOMContentLoaded event listener --
//
document.addEventListener("DOMContentLoaded", function() {
AUDIO = document.getElementById("audio");
AUDIO.addEventListener('ended', function(e) {
AUDIO.pause();
var pauseelem = document.getElementById(AUDIOid);
pauseelem.className = "play";
}, false);
sessionStorage.removeItem('RECENTLYADDEDHTML');
let macroid = "AKfycbyeHfmyCHHgbY9X_UDMzW9xyRgqH0c7Ycp76NTW18mjZSnW_2umhgH2ZGDtxuwDot6mKw";
let url = `https://script.google.com/macros/s/${macroid}/exec`;
url += "?sheet=works";
url += "&format=json";
fetch(url)
.then(response => {
if (response.ok) {
return response.json();
} else {
throw new Error("Request failed with status " + response.status);
}
})
.then(data => {
JRP.WORKS = data;
buildComposerSelect(JRP.WORKS);
buildGenreSelect(JRP.WORKS);
displayRandomExample(JRP.WORKS);
displayRecentAdditions(7, JRP.WORKS);
})
.catch(error => {
console.error("Fetch error: " + error.message);
});
}, false);
</script>