-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjingle.js
295 lines (269 loc) · 8.68 KB
/
jingle.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
var jingles = [
{
id: 1,
name: "Future Runner",
notes: "One dark morning in November 2019, Los Angeles... A police officer orders a bowl of noodles.",
src: "./jingles/1.mp3",
artist: "Brian",
created: "2021-02-11"
},
{
id: 2,
name: "Ease-Us",
notes: "Bringing you peacefully into another beautiful day on the California coast.",
src: "./jingles/2.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 3,
name: "A Great Honor",
notes: "Creating a sense of hope, ready for the future to reward it.",
src: "./jingles/3.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 4,
name: "I Love You",
notes: "An ethereal, prosperous declaration of pure love. Nothing is more powerful.",
src: "./jingles/4.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 5,
name: "Bubbly Hope",
notes: "This bubbly motif makes you wonder what's coming up next, while still staying cute and playful.",
src: "./jingles/5.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 6,
name: "Organ Fonk",
notes: "A catchy and upbeat organ groove, to introduce the most wholesome of projects.",
src: "./jingles/6.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 7,
name: "Open Sparkles",
notes: "The future is now! This sparkly riff is sure to pique interest in your latest creation.",
src: "./jingles/7.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 8,
name: "Keys in the Jar",
notes: "An exotic, mystical exploration that reaches into your soul but leaves you standing firmly on earth.",
src: "./jingles/8.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 9,
name: "Sunrise",
notes: "Let the gentle piano and string melody carry you all the way to a crisp and joyful 'ting'.",
src: "./jingles/9.mp3",
artist: "Karl",
created: "2021-02-12"
},
{
id: 10,
name: "Sentimental Boys",
notes: "Thinking of the good times behind us, looking forward to even better times ahead.",
src: "./jingles/10.mp3",
artist: "Karl",
created: "2021-02-12"
}
,
{
id: 11,
name: "Dark Jungle",
notes: "When you want your viewers on the edge of their seats, look no further than this mysterious riff with an electric ending.",
src: "./jingles/11.mp3",
artist: "Karl",
created: "2021-02-16"
},
{
id: 12,
name: "Wooded Glen",
notes: "A morning song for waking up and smelling the fresh-cut grass. This is life.",
src: "./jingles/12.mp3",
artist: "Karl",
created: "2021-02-16"
},
{
id: 13,
name: "Happy Fog",
notes: "A pensive moment wrapped in a happy fog, with a sprinkle of joy on top.",
src: "./jingles/13.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 95
},
{
id: 14,
name: "Quality Assurance",
notes: "A logical and friendly ditty, comforting as submitting an electronic report to human resources.",
src: "./jingles/14.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 84
},
{
id: 15,
name: "Back Nine",
notes: "This uplifting and swirling piano melody is guaranteed to lead your viewers to a happy day. Unless they are sad people.",
src: "./jingles/15.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 137
},
{
id: 16,
name: "Country Ride",
notes: "After a long ride in the country carriage, you finally see the town up ahead. A fanatasy awaits!",
src: "./jingles/16.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 131
},
{
id: 17,
name: "Zen Capitalism",
notes: "Even computers need a lullaby. Put yours to sleep with this friendly tune, sure to be virus-free.",
src: "./jingles/17.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 66
},
{
id: 18,
name: "Distant Success",
notes: "You're well on the way to an A+ career, but you can never forget the gaping chasm which stands between you and success.",
src: "./jingles/18.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 138
},
{
id: 19,
name: "Blip Blop",
notes: "Someone's got a leaky pipe! This pointy motif bounces around and evokes feelings of underwater exploration.",
src: "./jingles/19.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 144
},
{
id: 20,
name: "Irish Fields",
notes: "A little Irish jig to inspire the feeling of wind blowing through fields of four-leaf clovers. A must-dance.",
src: "./jingles/20.mp3",
artist: "Karl",
created: "2021-02-16"
}
,
{
id: 21,
name: "Being Ethical",
notes: "Sometimes you need to go off the rails and be an upside-down maverick. This cacophonous track would complement any mal-intended deed!",
src: "./jingles/21.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 111
},
{
id: 22,
name: "Closing the Deal",
notes: "After that final flick of the pen, you picture yourself enjoying the great reward of a deal well done - relaxing by a beautiful sunset.",
src: "./jingles/22.mp3",
artist: "Karl",
created: "2021-02-16",
bpm: 75
},
{
id: 23,
name: "Coffee Break",
notes: "It's your safe, happy world. Take a moment to enjoy a sip of java and snap along with this fresh roasted jam.",
src: "./jingles/23.mp3",
artist: "Karl",
created: "2021-02-16"
},
{
id: 24,
name: "Today is",
notes: "Let the day wash over you, the good parts and the bad. In the end it's all about the various times you had.",
src: "./jingles/24.mp3",
artist: "Karl",
created: "2021-02-16"
}
];
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
var paginateBy = 9;
var index = 0;
var page = 1;
var pages = 1;
function fireUpYourPotatoCannonDoctorJones() {
$("#jingleCount").text(String(jingles.length));
jingles.sort(function(a, b) {
return b.id - a.id;
});
if (jingles.length > paginateBy) {
pages = Math.ceil(jingles.length / paginateBy);
displayJingles(0, paginateBy);
$(".pageMsg").text(`page ${page} of ${pages}`);
$(".nextPage").on("click", () => {
if (page == pages) {
$("#moo").removeClass("no").addClass("no");
setTimeout(() => { $($("#moo").removeClass("no")) }, 500);
return false;
} else {
$("#jingles").hide().html("");
page++;
index += paginateBy;
$(".prevPage").show();
$(".pageMsg").html(`page ${page} of ${pages}`);
displayJingles(index, paginateBy);
}
});
$(".prevPage").on("click", () => {
if (page == 1) {
$("#moo").removeClass("no").addClass("no");
setTimeout(() => { $($("#moo").removeClass("no")) }, 500);
return false;
} else {
$("#jingles").hide().html("");
index -= paginateBy;
page--;
$(".nextPage").show();
$(".pageMsg").html(`Page ${page} of ${pages}`);
displayJingles(index, paginateBy);
}
});
} else { $(".jinglePageController").hide(); displayJingles(0, paginateBy); }
}
function displayJingles(index, num) {
var jinglesToShow = jingles.slice(index, index + num);
jinglesToShow.forEach((jingle) => {
$("#jingles").append(
`<div class='col-md-4 jingle'>
<h4>${jingle.name}</h4>
<small style="vertical-align:80%">by <b>${jingle.artist}</b> on ${jingle.created}</small>
<p>${jingle.notes} <a href=${jingle.src} download>Download</a></p>
<p><audio controls preload='none'><source src=${jingle.src} type="audio/mpeg"></audio></p>
</div>`);
});
$("#jingles").fadeIn();
}