Skip to content

Commit

Permalink
simplificación paginación
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredoUcar committed May 6, 2014
1 parent 622dfcc commit 94c0b77
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ div.pagination a{
padding: 2px 6px;
}

div.pagination a.page.current{
div.pagination a.page.current, a.page.collapse{
pointer-events: none;
opacity: 0.6;
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h1>Top 10</h1>

<footer>
<hr>
Tecnología Multimédia - 2014 | Alfredo Ucendo & Carlos Lucas | Datos recogidos de Series.ly y YouTube
Tecnología Multimedia - 2014 | Alfredo Ucendo & Carlos Lucas | Datos recogidos de Series.ly y YouTube
</footer>


Expand Down
27 changes: 26 additions & 1 deletion js/own.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var serieslyAPI = {
type: 'POST',
processData: false //para pasar 'data' como un objeto (sin pre-procesarlo)
}).done(function(data){
dest.html(data);console.log(data);
dest.html(data);
}).always(function(){
init(); //refresca los elementos
})
Expand Down Expand Up @@ -245,6 +245,31 @@ function initLinks(){
searchSeries(data,page); //realiza la búsqueda de la página indicada
})

var paginas = $(".pagination a.page").not(".next").not(".prev"); //paginas 1..actual..n
var current = paginas.filter(".current");

var anteriores = paginas.filter(function(){
return parseInt($(this).attr("data-page-index")) < parseInt(current.attr("data-page-index"));
});
if (anteriores.length > 5){
for(var i=2;i<anteriores.length-2;i++){
anteriores.filter(":eq("+i+")").hide();
}
$("<a href='#' class='page collapse'>...</a>").insertAfter(anteriores.filter(":eq(1)"));
}


var siguientes = paginas.filter(function(){
return parseInt($(this).attr("data-page-index")) > parseInt(current.attr("data-page-index"));
});
if (siguientes.length > 5){
for(var i=2;i<siguientes.length-2;i++){
siguientes.filter(":eq("+i+")").hide();
}
$("<a href='#' class='page collapse'>...</a>").insertAfter(siguientes.filter(":eq(1)"));
}


/**
* Navega a la ficha completa de la película
*/
Expand Down
5 changes: 4 additions & 1 deletion peliculas.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
</xsl:choose>
<xsl:choose>
<xsl:when test="maingenre != ''">
<span>Género: <xsl:value-of select="maingenre"/></span>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name="maingenre" select="translate(maingenre, $uppercase, $lowercase)"/>
<span>Género: <xsl:value-of select="document('generos.xml')/lista_generos/genero[@id=$maingenre]"/></span>
</xsl:when>
<xsl:otherwise>
<span>Género: (Desconocido)</span>
Expand Down

0 comments on commit 94c0b77

Please sign in to comment.