| author | Anthony Ly <anthonyly.com@gmail.com> |
| Tue, 09 Apr 2013 11:11:13 +0200 | |
| changeset 12 | de84cbea1248 |
| parent 10 | bdfc6ff39081 |
| child 14 | 6f60170b9674 |
| permissions | -rw-r--r-- |
|
1
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1 |
$(function(){ |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2 |
|
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
3 |
$(window).bind('resize', function(){ |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
4 |
setSidebarContentHeight(); |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
5 |
}); |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
6 |
setSidebarContentHeight(); |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
7 |
function setSidebarContentHeight(){ |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
8 |
var newHeight = $(window).height() - $('header').height() - $('footer').height(); |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
9 |
$(".sidebar .content").css('height', newHeight); |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
10 |
} |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
11 |
|
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
12 |
$(".sidebar .content").mCustomScrollbar({ |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
13 |
advanced:{ |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
14 |
updateOnContentResize: true |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
15 |
} |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
16 |
}); |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
17 |
|
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
18 |
$('a.more').bind('click', function(e){ |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
19 |
e.preventDefault(); |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
20 |
var target = $(this).attr('href'); |
| 2 | 21 |
if($(target).hasClass('less')){ |
22 |
$(target).removeClass('less'); |
|
23 |
$(this).addClass('less'); |
|
|
1
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
24 |
}else{ |
| 2 | 25 |
$(target).addClass('less'); |
26 |
$(this).removeClass('less'); |
|
|
1
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
27 |
} |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
28 |
});// a.more |
|
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
29 |
|
|
10
bdfc6ff39081
Lien autour des stickers
Anthony Ly <anthonyly.com@gmail.com>
parents:
9
diff
changeset
|
30 |
$('.stickers a').bind('click', function(e){ |
|
bdfc6ff39081
Lien autour des stickers
Anthony Ly <anthonyly.com@gmail.com>
parents:
9
diff
changeset
|
31 |
e.preventDefault(); |
|
bdfc6ff39081
Lien autour des stickers
Anthony Ly <anthonyly.com@gmail.com>
parents:
9
diff
changeset
|
32 |
}); |
| 2 | 33 |
|
34 |
//-- API allocine |
|
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
35 |
|
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
36 |
//-- movie |
| 9 | 37 |
var urlMovie = 'http://api.allocine.fr/rest/v3/movie?partner='+partnerCode+'&code='+ idMovie; |
| 2 | 38 |
$.getJSON(urlMovie, function(data) { |
39 |
var movie = data.movie; |
|
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
40 |
|
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
41 |
//-- title |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
42 |
var titleMovie = movie.title; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
43 |
$('.renkan .wrap-top h2').text(titleMovie); |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
44 |
|
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
45 |
//-- stars |
| 2 | 46 |
var castMember = movie.castMember; |
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
47 |
|
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
48 |
$.each(castMember, function(k, v){ |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
49 |
var name = v.person.name; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
50 |
var codeActor = v.person.code; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
51 |
var urlPicture; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
52 |
if(v.picture !== undefined) { |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
53 |
urlPicture = v.picture.href; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
54 |
}else{ |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
55 |
urlPicture = 'http://fr.web.img3.acsta.net/c_160_213/b_1_d6d6d6/commons/emptymedia/empty_star.jpg'; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
56 |
} |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
57 |
var urlFichePersonne = 'http://www.allocine.fr/personne/fichepersonne_gen_cpersonne='+codeActor+'.html'; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
58 |
var itemStar = |
| 9 | 59 |
'<li>'+ |
60 |
||
61 |
'<a class="tool-info" target="_blank" href="'+ urlFichePersonne +'" title="'+ name +'">'+ |
|
62 |
'<img src="'+ urlPicture +'" alt="'+ name +'" />'+ |
|
63 |
'</a>'+ |
|
64 |
'</li>'; |
|
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
65 |
$('#stars-more').append(itemStar); |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
66 |
}); |
| 2 | 67 |
|
| 6 | 68 |
/* Initializing Renkan */ |
69 |
|
|
70 |
setRenkanPoster({ |
|
71 |
title: movie.title, |
|
72 |
image: movie.poster.href, |
|
73 |
uri: _(movie.link).find(function(l) { return l.rel === "aco:web" }).href |
|
74 |
}); |
|
| 2 | 75 |
|
76 |
||
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
77 |
}); |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
78 |
|
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
79 |
//-- picture |
| 9 | 80 |
var urlPicture = 'http://api.allocine.fr/rest/v3/picturelist?partner='+partnerCode+'&subject=movie:'+ idMovie; |
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
81 |
$.getJSON(urlPicture, function(data) { |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
82 |
var media = data.feed.media; |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
83 |
$.each(media, function(k, v){ |
|
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
84 |
var urlThumb = v.thumbnail.href; |
| 9 | 85 |
var rcode = v.rcode; |
86 |
var title = v.title; |
|
87 |
var urlAllocine = 'http://www.allocine.fr/film/fichefilm-'+ idMovie +'/photos/detail/?cmediafile='+ rcode; |
|
| 7 | 88 |
var itemImagess = |
89 |
'<li>'+ |
|
| 9 | 90 |
'<a target="_blank" href="'+ urlAllocine +'">'+ |
91 |
'<img src="'+ urlThumb +'" alt="'+title+'" />'+ |
|
92 |
'</a>'+ |
|
| 7 | 93 |
'</li>'; |
94 |
$('#images-more').append(itemImagess); |
|
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
95 |
}); |
| 9 | 96 |
//redimensionnement images |
97 |
$("#images-more img").each(function() { |
|
98 |
var img = $(this), |
|
99 |
div = $(this).parent(); |
|
100 |
img.load(function() { |
|
101 |
var iw = img.width(), |
|
102 |
ih = img.height(), |
|
103 |
dw = div.width(), |
|
104 |
dh = div.height(), |
|
105 |
scale = Math.max(dw/iw, dh/ih), |
|
106 |
niw = iw * scale, |
|
107 |
nih = ih * scale; |
|
108 |
img.css({ |
|
109 |
width: niw, |
|
110 |
height: nih, |
|
111 |
"margin-left": (dw - niw) / 2, |
|
112 |
"margin-top": (dh - nih) / 3 |
|
113 |
}); |
|
114 |
}); |
|
115 |
}); |
|
116 |
});//get |
|
117 |
||
118 |
//-- trailer |
|
119 |
var urlTrailers = 'http://api.allocine.fr/rest/v3/videolist?partner='+partnerCode+'&mediafmt=flv&subject=movie:'+ idMovie; |
|
120 |
$.getJSON(urlTrailers, function(data) { |
|
121 |
var media = data.feed.media; |
|
122 |
$.each(media, function(k, v){ |
|
123 |
console.log(v) |
|
124 |
var urlThumbnail = v.thumbnail.href; |
|
125 |
var title = v.title; |
|
126 |
var code = v.code; |
|
127 |
var url = 'http://www.allocine.fr/video/player_gen_cmedia='+code+'&cfilm='+idMovie+'.html'; |
|
128 |
var itemVideo = |
|
129 |
'<li>'+ |
|
130 |
'<a target="_blank" href="'+ url +'">'+ |
|
131 |
'<img src="'+ urlThumbnail +'" alt="'+title+'" />'+ |
|
132 |
'</a>'+ |
|
133 |
'</li>'; |
|
134 |
$('#videos-more').append(itemVideo); |
|
135 |
}); |
|
|
3
046d617a7d6e
Début api, chargement des images stars
Anthony Ly <anthonyly.com@gmail.com>
parents:
2
diff
changeset
|
136 |
}); |
| 2 | 137 |
|
| 9 | 138 |
//TOOLTIP |
139 |
var show_tooltip_info_iri = function(elem){ |
|
140 |
var tooltip = $('.tooltip-iri'), |
|
141 |
name = elem.attr('title'), |
|
142 |
arrow = tooltip.find('.arrow_tooltip'), |
|
143 |
top = elem.offset().top, |
|
144 |
right = elem.offset().left + elem.width() + arrow.width(); |
|
145 |
tooltip.find('p').text(name) |
|
146 |
tooltip.show(); |
|
147 |
tooltip.css({ |
|
148 |
top : top, |
|
149 |
left : right |
|
150 |
}); |
|
151 |
} |
|
152 |
var hide_tooltip_info_iri = function(elem){ |
|
153 |
var tooltip = $('.tooltip-iri'); |
|
154 |
tooltip.hide(); |
|
155 |
} |
|
156 |
$(document).on({ |
|
157 |
mouseenter: function() { |
|
158 |
show_tooltip_info_iri($(this)); |
|
159 |
}, |
|
160 |
mouseleave: function() { |
|
161 |
hide_tooltip_info_iri($(this)); |
|
162 |
} |
|
163 |
}, 'a.tool-info'); |
|
164 |
||
165 |
||
166 |
||
|
1
4aec3f00ea87
intégration création cinecard v1
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
167 |
}); |