-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
303 lines (252 loc) · 8.38 KB
/
index.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
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
296
297
298
299
300
301
302
303
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/jquery.fullPage.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.fullPage.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/js/materialize.min.js"></script>
<!-- favicon -->
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" >
<link rel="icon" href="favicon.ico" type="image/x-icon" >
<style>
body{
color: #FFF;
font-family: sans-serif, Helvetica, Verdana;
font-size: 1.6em;
line-height: 150%;
}
h6{
margin: 0;
padding: 0;
}
p {
max-width: 800px;
text-align: center;
margin-left: auto;
margin-right: auto;
}
.section{
text-align: center;
align: center;
padding: 0 8% 0 8%;
}
#section1{
}
#section2{
}
#section3{
}
#section4{
}
#section5{
background-size: cover;
background-position: center center;
background-attachment: fixed;
}
#section5 p{
background-color: #F44336; /* red */
padding: 10px;
border-radius: 4px;
}
#section6{
}
#section7{
background-size: cover;
background-position: center center;
background-attachment: fixed;
}
#section7 p{
background-color: #FFA000;
padding: 10px;
border-radius: 4px;
}
</style>
<script>
var audioElement = document.createElement('audio');
var audioObject;
var currentPlayer = 'demoAudioTag';
var mAutoplay = false;
$(document).ready(function() {
$('#fullpage').fullpage({
afterLoad: function(anchorLink, index){afterLoadHandle(anchorLink, index)},
css3:false,
sectionsColor: ['#1A237E', '#E65100', '#64DD17', '#F44336', '', '#FFA000', ''],
scrollingSpeed: 300
});
});
function afterLoadHandle(anchorLink, index){
console.log("afterLoadHandle() index = " + index);
switch(index){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
mAutoplay = true;
if(currentPlayer == 'audioTag'){
cloneCurrentAudioInfo('demoAudioTag');
currentPlayer = 'demoAudioTag';
}
break;
case 5:
break;
case 6:
break;
case 7:
if(currentPlayer == 'demoAudioTag'){
cloneCurrentAudioInfo('audioTag');
currentPlayer = 'audioTag';
}
break;
default:
break;
}
}
function getFormattedTextFromAudioObject(audioObj){
return '<p>'
+ '[ <a target="new" href="' + audioObj.track_url + '">' + audioObj.track_name + '</a> ]'
+ ' by '
+ '[ <a target="new" href="' + audioObj.artist_url + '">' + audioObj.artist_name + '</a> ]'
+ '</p>'
;
}
function randomizeMusic(){
var urlR = "http://api.jamendo.com/br/?m=get2&m_params=track_id+track_stream+track_name+artist_name+artist_url+track_url/track/json/track_album+album_artist&n=1&order=ratingweek_desc&nshuffle=1000&streamencoding=ogg2";
$.ajax({
url: urlR,
dataType: 'json',
async: true,
success: function(res){
audioObject = res[0];
audioElement.controls = 'controls';
audioElement.src = audioObject.track_stream;
audioElement.autoplay = mAutoplay;
audioElement.load();
console.log("mAutoplay = " + mAutoplay);
audioElement.addEventListener(
"canplay", function(){
if(mAutoplay){
audioElement.play();
}
}
);
audioElement.addEventListener("ended", function(){
randomizeMusic();
randomizeImage();
});
var audioText = getFormattedTextFromAudioObject(audioObject);
$('#'+currentPlayer).html(audioText);
$('#'+currentPlayer).append(audioElement);
}
});
}
function cloneCurrentAudioInfo(audioTag){
var audioText = getFormattedTextFromAudioObject(audioObject);
currentTime = audioElement.currentTime;
var isPlaying = ( audioElement.duration > 0 && !audioElement.paused );
$('#'+audioTag).html(audioText);
$('#'+audioTag).append(audioElement);
audioElement.currentTime = currentTime;
if(isPlaying){
audioElement.play();
}
}
function randomizeImage(){
$.ajax({
url: "http://commons.wikimedia.org/w/api.php?action=query&generator=random&grnnamespace=6&prop=imageinfo&iiprop=url&format=json&callback=?",
dataType: 'json',
async: true,
success: function(res){
console.log(res);
var o = (res["query"])["pages"];
for (var p in o) {
o = o[p];
break;
}
var imageinfo = ((o["imageinfo"])["0"]);
var hotlink = imageinfo["url"];
$('#section5').css('background-image', 'url(' + hotlink + ')');
$('#section7').css('background-image', 'url(' + hotlink + ')');
var descriptionurl = imageinfo["descriptionurl"];
var title = o["title"];
title = title.substring(5, title.length - 4);
console.log("descriptionurl = " + descriptionurl);
console.log("title = " + title);
}
});
}
</script>
</head>
<body>
<div id="fullpage">
<div class="section" id="section1">
<p>
<h1>
HeyHye Get Inspired!
</h1>
by musics and images you probably <b>never</b> listened and saw before!
</p>
<a class="waves-effect waves-light btn" href="javascript:$.fn.fullpage.moveSectionDown()">NEXT</a>
</div>
<div class="section" id="section2">
<p>
<b>Creativity</b> is about everything you <b>know</b> and how you can <b>connect</b> your knowledge to create new insights.
<br/><br/>
<img src="img/connect.gif" width="200px"></img>
<br/><br/>
HeyHye Get Inspired aims to help you by showing music and images that you probably never saw or listened to before*.
<br/>
<h6><i>*Thanks to <a href="http://www.jamendo.com/" alt=new>Jamendo</a> and <a href="http://www.wikimedia.org/" alt=new>Wikimedia</a> ♥</i></h6>
<p>
<a class="waves-effect waves-light btn" href="javascript:$.fn.fullpage.moveSectionDown()">NEXT</a>
</div>
<div class="section" id="section3">
<p>
Each pair of music and image works like an "inspirational pill".
<br/><br/>
<img src="img/brain.gif" width="200px"></img>
<br/><br/>
They are completely random, but HeyHye provokes your brain to construct some relation between them.
</p>
<a class="waves-effect waves-light btn" href="javascript:$.fn.fullpage.moveSectionDown()">NEXT</a>
</div>
<div class="section" id="section4">
<p>
The music will stimulate you to think about a correspondent amount of drama and feelings.
<br/>
<br/>
And it will be a totally-brand-new-and-probably-not-listened-before music, like this one:
<br/>
<div id="demoAudioTag"></div>
</p>
<a class="waves-effect waves-light btn" href="javascript:$.fn.fullpage.moveSectionDown()">NEXT</a>
<script>randomizeMusic()</script>
</div>
<div class="section" id="section5">
<p class="z-depth-2">
The image will provide you the physical space, the scenario where anything can happens. It can be a building, a map, a statuette, a person or anything else (like this one in background).
</p>
<a class="waves-effect waves-light btn" href="javascript:$.fn.fullpage.moveSectionDown()">NEXT</a>
<script>randomizeImage()</script>
</div>
<div class="section" id="section6">
<p>
Your brain will (almost magically) work on the rest.
<br/><br/>
<img src="img/200.gif"></img>
<br/><br/>
Just relax and let your imagination fly.
</p>
<a class="waves-effect waves-light btn" href="javascript:$.fn.fullpage.moveSectionDown()">NEXT</a>
</div>
<div class="section" id="section7">
<div id="audioTag"></div>
<a class="waves-effect waves-light btn" href="javascript:randomizeMusic();randomizeImage()"><i class="mdi-navigation-refresh"></i></a>
<a class="waves-effect waves-light btn" href="javascript:randomizeImage()"><i class="mdi-image-image"></i><i class="mdi-navigation-refresh"></i></a>
<a class="waves-effect waves-light btn" href="javascript:randomizeMusic()"><i class="mdi-image-audiotrack"></i><i class="mdi-navigation-refresh"></i></a>
</div>
</div>
</body>