-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
135 additions
and
71 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="lib/style.css"/> | ||
<link rel="stylesheet" href="styles/style.css"/> | ||
<link rel="icon" href="imagenes/logo.png"> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
|
@@ -27,9 +28,9 @@ | |
</header> | ||
|
||
|
||
<div class="container"> | ||
<div class="container" id="Cuerpo"> | ||
<div class="row"> | ||
<div class="col-lg-7 col-12"> | ||
<div class="col-lg-8 col-8 col-sm-12"> | ||
<table class="table table-striped table-dark" id="tablaSeries"> | ||
<thead> | ||
<tr> | ||
|
@@ -44,15 +45,14 @@ | |
</table> | ||
<p id="average">Average seasons: 0</p> | ||
</div> | ||
<div class="col-lg-6 col-12" id="contenido"> | ||
<div class="col-lg-4 col-4 col-sm-12" id="cartaContenido"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script>var exports = {}</script> | ||
<script type="module" src = "ejemplos/index.js"></script> | ||
<script type="module" src = "ejemplos/data.js"></script> | ||
<script type="module" src = "ejemplos/Serie.js"></script> | ||
<script type="module" src = "scripts/index.js"></script> | ||
<script type="module" src = "scripts/data.js"></script> | ||
<script type="module" src = "scripts/Serie.js"></script> | ||
</body> | ||
</html> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { series } from './data.js'; | ||
import { Serie } from './Serie.js'; | ||
|
||
export const tabla: HTMLElement | null = document.getElementById('cuerpo-Series'); | ||
const espacioCarta: HTMLElement | null = document.getElementById('cartaContenido'); | ||
var sumatoria: number = 0; | ||
|
||
|
||
function cargarTabla():void{ | ||
if (tabla) { | ||
series.forEach((serie) => { | ||
const row = document.createElement('tr'); | ||
row.innerHTML = ` | ||
<td scope="row">${serie.id}</td> | ||
<td scope="row" id="nombreSerie">${serie.nombre}</td> | ||
<td scope="row">${serie.canal}</td> | ||
<td scope="row">${serie.temporadas}</td>` | ||
|
||
tabla.appendChild(row); | ||
|
||
row.addEventListener('click', () => {cargarCarta(serie)}); | ||
}); | ||
|
||
} else { | ||
console.error("No se encontró el elemento con el id \"cuerpo-Series\""); | ||
} | ||
} | ||
|
||
|
||
function cargarCarta(serie: Serie):void{ | ||
if(espacioCarta){ | ||
espacioCarta.innerHTML = `<div class="card text-white bg-dark border-primary mb-5" style="width: 18rem;"> | ||
<img class="card-img-top" src="${serie.imagen}" alt="Card image cap"> | ||
<div class="card-body"> | ||
<h3>${serie.nombre}</h3> | ||
<p class="card-text">${serie.descripcion}</p> | ||
<a href="${serie.link}">Clic aca para visitar la serie</a> | ||
</div> | ||
</div>` | ||
} | ||
} | ||
|
||
|
||
function promedioTemporadas():void{ | ||
if (tabla) { | ||
series.forEach((serie) => { | ||
sumatoria += serie.temporadas; | ||
}); | ||
} | ||
const parrafo = document.getElementById('average'); | ||
var promedio = sumatoria / series.length; | ||
if (parrafo != null){ | ||
parrafo.innerHTML = `Average seasons: ${promedio}` | ||
} else { | ||
console.error("No se encontró el elemento con el id \"average\""); | ||
} | ||
|
||
} | ||
|
||
|
||
cargarTabla(); | ||
promedioTemporadas() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { series } from './data.js'; | ||
export var tabla = document.getElementById('cuerpo-Series'); | ||
var espacioCarta = document.getElementById('cartaContenido'); | ||
var sumatoria = 0; | ||
function cargarTabla() { | ||
if (tabla) { | ||
series.forEach(function (serie) { | ||
var row = document.createElement('tr'); | ||
row.innerHTML = "\n <td scope=\"row\">".concat(serie.id, "</td>\n <td scope=\"row\" id=\"nombreSerie\">").concat(serie.nombre, "</td>\n <td scope=\"row\">").concat(serie.canal, "</td>\n <td scope=\"row\">").concat(serie.temporadas, "</td>"); | ||
tabla.appendChild(row); | ||
row.addEventListener('click', function () { cargarCarta(serie); }); | ||
}); | ||
} | ||
else { | ||
console.error("No se encontró el elemento con el id \"cuerpo-Series\""); | ||
} | ||
} | ||
function cargarCarta(serie) { | ||
if (espacioCarta) { | ||
espacioCarta.innerHTML = "<div class=\"card text-white bg-dark border-primary mb-5\" style=\"width: 18rem;\">\n <img class=\"card-img-top\" src=\"".concat(serie.imagen, "\" alt=\"Card image cap\">\n <div class=\"card-body\">\n <h3>").concat(serie.nombre, "</h3>\n <p class=\"card-text\">").concat(serie.descripcion, "</p>\n <a href=\"").concat(serie.link, "\">Clic aca para visitar la serie</a>\n </div>\n </div>"); | ||
} | ||
} | ||
function promedioTemporadas() { | ||
if (tabla) { | ||
series.forEach(function (serie) { | ||
sumatoria += serie.temporadas; | ||
}); | ||
} | ||
var parrafo = document.getElementById('average'); | ||
var promedio = sumatoria / series.length; | ||
if (parrafo != null) { | ||
parrafo.innerHTML = "Average seasons: ".concat(promedio); | ||
} | ||
else { | ||
console.error("No se encontró el elemento con el id \"average\""); | ||
} | ||
} | ||
cargarTabla(); | ||
promedioTemporadas(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters