Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Exercicios/4. array.push()/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];
const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];
listagemDeFrutas.push("laranja");
console.log(listagemDeFrutas);

4 changes: 4 additions & 0 deletions Exercicios/5. array.pop()/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];
const ultimoElementoListagem = listagemDeFrutas.pop();

console.log(listagemDeFrutas);


const usuarios = [
{user:234, name: 'Marcia', idade:40 },
Expand Down
5 changes: 3 additions & 2 deletions Exercicios/8. array.slice()/script.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];
//const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];
const usuarios = [
{user:234, name: 'Marcia', idade:40 },
{user:235, name: 'Lorena', idade:20 },
{user:236, name: 'Patricia', idade:24 },
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
]
const selectedItens = usuarios.slace(0,3)
Binary file added Exercício de Casa/img/icone-lixo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Exercício de Casa/img/img.estante-livros.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions Exercício de Casa/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./style/style.css">
<title>My Audible Books</title>
</head>
<body>
<header class="header">
<h1>
My Audible Books
</h1>

</header>
<main>
<section class="section-formulario">

<form action="enviar-dados-para-tabela" onsubmit="exibirDadosTabela(event)">
<div class="div-formulario">
<label class="legenda-do-formulario"><strong>Titulo</strong></label>
<input class="caixaDeTextoDoFormulario" type="text" id="tituloDoLivro">

<label class="legenda-do-formulario" ><strong> Autor</strong></label>
<input class="caixaDeTextoDoFormulario" type="text" id="nomeDoAutor">

<label class="legenda-do-formulario" ><strong> ISBN</strong></label>
<input class="caixaDeTextoDoFormulario" type="number" id="isbnDoLivro">

<label class="legenda-do-formulario" ><strong>Data de publicação</strong> </label>
<input class="caixaDeTextoDoFormulario" type="date" id="dataDePublicacaoDoLivro">

<label class="legenda-do-formulario" ><strong> Páginas</strong></label>
<input class="caixaDeTextoDoFormulario" type="number" id="numeroDePaginasDoLivro">

<div class="div-botao-formulario">
<button class="botaoFormulario" type="submit" id="botaoDeAdicionarLivro"><strong>Adicionar Livro</strong> </button>
</div>

</div>




</section>
<section class="section-tabela">
<table class="tabela">
<thead class="cabecalhoDaTabela">
<div class="div-tabela"><th>Título</th></div>
<div class="div-tabela"><th>Autor</th></div>
<div class="div-tabela"><th>ISBN</th></div>
<div class="div-tabela"><th>Data de Publicação</th></div>
<div class="div-tabela"><th>Páginas</th></div>
<div class="div-tabela"><th>Data de Inserção</th></div>
<div class="div-tabela"></div><th>Horário de Inserção</th></div>
</thead>
<tbody id="corpo-tabela" class="corpo-tabela">

</tbody>
</table>

</section>


</main>
<script src="./script/script.js"></script>

</body>
</html>
82 changes: 75 additions & 7 deletions Exercício de Casa/script/script.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@

let books = [
{
isbn: "9781593275846",
title: "Eloquent JavaScript, Second Edition",
subtitle: "A Modern Introduction to Programming",
author: "Marijn Haverbeke",
published: "2014-12-14T00:00:00.000Z",
},
{
isbn: "9781449331818",
title: "Learning JavaScript Design Patterns",
subtitle: "A JavaScript and jQuery Developer's Guide",
author: "Addy Osmani",
published: "2012-07-01T00:00:00.000Z",
},
{
isbn: "9781449365035",
title: "Speaking JavaScript",
subtitle: "An In-Depth Guide for Programmers",
title: "Speaking JavaScript";
author: "Axel Rauschmayer",
published: "2014-02-01T00:00:00.000Z",
},
{
isbn: "9781491950296",
title: "Programming JavaScript Applications",
subtitle: "Robust Web Architecture with Node, HTML5, and Modern JS Libraries",
author: "Eric Elliott",
published: "2014-07-01T00:00:00.000Z",
},
{
isbn: "9781593277574",
title: "Understanding ECMAScript 6",
subtitle: "The Definitive Guide for JavaScript Developers",
author: "Nicholas C. Zakas",
published: "2016-09-03T00:00:00.000Z",
},
Expand All @@ -52,4 +48,76 @@ let books = [
author: "Glenn Block, et al.",
published: "2014-04-07T00:00:00.000Z",
}
]
]

function addLivros() {

books.map((book) => {
const parsePagina = !book.pagina ? " - " : book.pagina;
const parseData = new Date(book.published);
const data = parseData.setDate(parseData.getDate() +1);
const dataFormatada - parseData.toLocaleDateString('pt-br');

document.getElementById('corpo-tabela').innerHTML += `

<tr>
<td>${book.title}</td>
<td>${book.author}</td>
<td>${book.isbn}</td>
<td>${dataFormatada}</td>
<td>${parsePagina}</td>
<td>${dataFormatada}</td>
<td><button class="delete">Remover</button></td>
</tr>
`

})
}

addLivros();

function exibirDados(event) {
event.preventDefault();

let pegaTitulo = document.getElementById('title').value;
let pegaAuthor = document.getElementById('author').value;
let pegaIsbn = document.getElementById('isbn').value;
let pegaPagina = document.getElementById('pagina').value;
let pegadate = document.getElementById('date').value;

if (pegaTitulo ==="" || pegaAuthor ==="" || pegaIsbn ==="" || pegaPagina ==="" || pegadate ===""){
alert("Campo obrigatório não preenchido")

}else {
books.push({
title: pegaTitulo,
author: pegaAuthor,
isbn: pegaIsbn,
pagina: pegaPagina,
published: pegadate,


});
limpaCampo();
addLivros()

}
}


function limparCampo() {

document.getElementById('title').value = "";
document.getElementById('author').value = "";
document.getElementById('pagina').value = "";
document.getElementById('date').value = "";
document.getElementById('isbn').value = "";

}

document.getElementById('corpo-tabela').addEventListener('click', function removerLinha(event) {
if (event.target.className === "delete") {
let botao = event.target.parentElement;
botao.parentElement.remove();
}
})
Loading