-
Notifications
You must be signed in to change notification settings - Fork 0
/
myscript.js
55 lines (46 loc) · 1.94 KB
/
myscript.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
function listVideos(data) {
var output ='';
for ( var i=0; i<data.feed.entry.length; i++) {
var title = data.feed.entry[i].title.$t;
var thumbnail = data.feed.entry[i].media$group.media$thumbnail[0].url;
var description = data.feed.entry[i].media$group.media$description.$t;
var id = data.feed.entry[i].id.$t.substring(38);
var blocktype = ((i % 2)===1) ? 'b': 'a';
output += '<div class="ui-block-' + blocktype + '">';
output += '<a href="#videoplayer" data-transition="fade" onclick="playVideo(\'' + id + '\',\'' + title + '\', \'' + escape(description) + '\')">';
output += '<h3 class="movietitle">' + title + '</h3>';
output += '<img src="' + thumbnail + '" alt="' + title + '" />';
output +="</a>";
output +="</div>";
}
$('#videolist').html(output);
}
function playVideo(id, title, description) {
var output ='<iframe src="http://www.youtube.com/embed/'+ id +'?wmode=transparent&HD=0&rel=0&showinfo=0&controls=1&autoplay=1" frameborder="0" allowfullscreen></iframe>';
output += '<h3>' + title + '</h3>';
output += '<p>' + unescape(description) + '</p>';
$('#myplayer').html(output);
}
function jsonFlickrFeed(data) {
console.log(data);
var output='';
for (var i=0; i<data.items.length; i++) {
var title = data.items[i].title;
var link = data.items[i].media.m.substring(0,56);
var blocktype = ((i%3)===2) ? 'c':
((i%3)===1) ? 'b':
'a';
output += '<div class="ui-block-' + blocktype + '">';
output += '<a href="#showphoto" data-transition="fade" onclick="showPhoto(\'' + link + '\', \'' + title + '\')">';
output += '<img src="' + link + '_q.jpg" alt="' + title + '"/>';
output += '</a>';
output += '</div>';
} // go through each photo
$('#photolist').html(output);
} //jsonflickerfeed
function showPhoto(link, title) {
var output='<a href="#photos" data-transition="fade">';
output += '<img src="' + link + '_b.jpg" alt="' +title + '" />';
output += '</a>';
$('#myphoto').html(output);
}