integ/js/iri-creation-cinecard.js
changeset 25 cc54acb734fb
parent 23 3c2416e4daf6
child 26 12d37f113973
equal deleted inserted replaced
24:feb0342a166f 25:cc54acb734fb
   121 					'<img src="'+ urlThumb +'" alt="'+title+'" />'+
   121 					'<img src="'+ urlThumb +'" alt="'+title+'" />'+
   122 				'</a>'+
   122 				'</a>'+
   123 			'</li>';
   123 			'</li>';
   124 		$('#images-more').append(itemImagess);
   124 		$('#images-more').append(itemImagess);
   125 	});
   125 	});
   126 	//redimensionnement images
   126 	resizeImg('#images-more');
   127 	$("#images-more img").each(function() {
   127 });//get
       
   128 
       
   129 //-- trailer
       
   130 var urlTrailers = 'http://api.allocine.fr/rest/v3/videolist?partner='+partnerCode+'&mediafmt=flv&subject=movie:'+ idMovie;
       
   131 $.getJSON(urlTrailers, function(data) {
       
   132 	var media = data.feed.media;
       
   133 	$.each(media, function(k, v){
       
   134 		console.log(v)
       
   135 		var urlThumbnail = v.thumbnail.href;
       
   136 		var title = v.title;
       
   137 		var code = v.code;
       
   138 		var url = 'http://www.allocine.fr/video/player_gen_cmedia='+code+'&cfilm='+idMovie+'.html';
       
   139 		var itemVideo = 
       
   140 			'<li class="cinecard-draggable" draggable="true">'+
       
   141 				'<a class="tool-info" target="_blank" href="'+ url +'" title="'+title+'">'+
       
   142 					'<img src="'+ urlThumbnail +'" alt="'+title+'" />'+
       
   143 				'</a>'+
       
   144 			'</li>';
       
   145 		$('#videos-more').append(itemVideo);
       
   146 		resizeImg('#videos-more');
       
   147 	});
       
   148 });
       
   149 
       
   150 
       
   151 function resizeImg(parentId){
       
   152 	$(parentId+" img").each(function() {
   128 	    var img = $(this),
   153 	    var img = $(this),
   129 	        div = $(this).parent();
   154 	        div = $(this).parent();
   130 	    img.load(function() {
   155 	    img.load(function() {
   131 	        var iw = img.width(),
   156 	        var iw = img.width(),
   132 	            ih = img.height(),
   157 	            ih = img.height(),
   141 	            "margin-left": (dw - niw) / 2,
   166 	            "margin-left": (dw - niw) / 2,
   142 	            "margin-top": (dh - nih) / 3
   167 	            "margin-top": (dh - nih) / 3
   143 	        });
   168 	        });
   144 	    });
   169 	    });
   145 	});
   170 	});
   146 });//get
   171 }
   147 
       
   148 //-- trailer
       
   149 var urlTrailers = 'http://api.allocine.fr/rest/v3/videolist?partner='+partnerCode+'&mediafmt=flv&subject=movie:'+ idMovie;
       
   150 $.getJSON(urlTrailers, function(data) {
       
   151 	var media = data.feed.media;
       
   152 	$.each(media, function(k, v){
       
   153 		console.log(v)
       
   154 		var urlThumbnail = v.thumbnail.href;
       
   155 		var title = v.title;
       
   156 		var code = v.code;
       
   157 		var url = 'http://www.allocine.fr/video/player_gen_cmedia='+code+'&cfilm='+idMovie+'.html';
       
   158 		var itemVideo = 
       
   159 			'<li class="cinecard-draggable" draggable="true">'+
       
   160 				'<a class="tool-info" target="_blank" href="'+ url +'" title="'+title+'">'+
       
   161 					'<img src="'+ urlThumbnail +'" alt="'+title+'" />'+
       
   162 				'</a>'+
       
   163 			'</li>';
       
   164 		$('#videos-more').append(itemVideo);
       
   165 		//redimensionnement images
       
   166 		$("#videos-more img").each(function() {
       
   167 		    var img = $(this),
       
   168 		        div = $(this).parent();
       
   169 		    img.load(function() {
       
   170 		        var iw = img.width(),
       
   171 		            ih = img.height(),
       
   172 		            dw = div.width(),
       
   173 		            dh = div.height(),
       
   174 		            scale = Math.max(dw/iw, dh/ih),
       
   175 		            niw = iw * scale,
       
   176 		            nih = ih * scale;
       
   177 		        img.css({
       
   178 		            width: niw,
       
   179 		            height: nih,
       
   180 		            "margin-left": (dw - niw) / 2,
       
   181 		            "margin-top": (dh - nih) / 3
       
   182 		        });
       
   183 		    });
       
   184 		});
       
   185 	});
       
   186 });
       
   187 
   172 
   188 //TOOLTIP
   173 //TOOLTIP
   189 var show_tooltip_info_iri = function(elem){
   174 var show_tooltip_info_iri = function(elem){
   190 	var tooltip = $('.rate_tooltip'),
   175 	var tooltip = $('.rate_tooltip'),
   191 		name = elem.attr('title'),
   176 		name = elem.attr('title'),