diff --git a/css/general.css b/css/general.css index c1af710..83a97b6 100644 --- a/css/general.css +++ b/css/general.css @@ -379,3 +379,29 @@ p.info-resultados{ #ficha-pelicula p,h3{ font-family: sans-serif; } + +#youtube-related{ + position: relative; + margin: 100px 20px; + float: left; + display: flex; +} + +#youtube-related .video{ + border: 1px solid white; + width: 180px; + background: rgb(42, 123, 197); + color: white; +} + +#youtube-related .video img{ + border-radius: 0px; + margin-bottom: 5px; + width: 100%; + float: none; + border: none; +} + +#youtube-related .video p{ + margin: 5px 10px; +} \ No newline at end of file diff --git a/ficha.xsl b/ficha.xsl index 225fe1b..34369fb 100644 --- a/ficha.xsl +++ b/ficha.xsl @@ -31,6 +31,7 @@ + diff --git a/js/own.js b/js/own.js index 6385ea8..5826b9f 100644 --- a/js/own.js +++ b/js/own.js @@ -166,9 +166,9 @@ var serieslyAPI = { $("#main .contenido").html(data); var titulo = $(".titulo-pelicula").text(); var dataYoutube={ - "q": "trailer "+titulo + "q": "trailer "+titulo, + "type": "video" }; - console.log(dataYoutube); searchYoutube(dataYoutube); }).always(function(){ init(); @@ -223,8 +223,6 @@ function initForms(){ var formName = $(this).attr("name"); if (formName == "search-youtube"){ searchYoutube(data); - }else if(formName == "search-persons"){ - requestCustomerInfo(data); }else if(formName == "search-series"){ searchSeries(data); }else{ @@ -350,6 +348,16 @@ function searchYoutube(data) { var x2js = new X2JS(); var xml = ""+x2js.json2xml_str($.parseJSON(str))+""; console.log(xml); + $.ajax({ + url: "relatedYoutube.php", //solicita la vista de los resultados + data: xml, + type: 'POST', + processData: false //para pasar 'data' como un objeto (sin pre-procesarlo) + }).done(function(data){ + $("#youtube-related").html(data); + }).always(function(){ + init(); //refresca los elementos + }) // $('#resultados').html(str); //carga el resultado de la búsqueda en #resultados }); } @@ -368,7 +376,6 @@ function setCookie(cname,cvalue,expDate) function getCookie(cname) { - return "041890c7a7a1cc0b3343d686083135cf"; //TODO: borrar token PROVISIONAL var name = cname + "="; var ca = document.cookie.split(';'); diff --git a/relatedYoutube.php b/relatedYoutube.php new file mode 100644 index 0000000..0de72b1 --- /dev/null +++ b/relatedYoutube.php @@ -0,0 +1,12 @@ +load($xsl_filename); +$xsl->importStyleSheet($doc); + +echo $xsl->transformToXML($xml); +?> \ No newline at end of file diff --git a/youtube.xsl b/youtube.xsl new file mode 100644 index 0000000..4bcfaff --- /dev/null +++ b/youtube.xsl @@ -0,0 +1,173 @@ + + + +

Trailers

+ +
+ + + +
+ +

+
+
+ +
+ + \ No newline at end of file