From 06f2835551fcffba8db216d7936f9f162eb2d12f Mon Sep 17 00:00:00 2001 From: Thiago Lucas Date: Mon, 20 Jun 2022 19:57:34 -0300 Subject: [PATCH 1/3] Lidando com Tabelas --- tables/index.html | 37 +++++++++++++++++++++++++++++++++++++ tables/script.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tables/index.html create mode 100644 tables/script.js diff --git a/tables/index.html b/tables/index.html new file mode 100644 index 0000000..7c04ae9 --- /dev/null +++ b/tables/index.html @@ -0,0 +1,37 @@ + + + + + + + Converta CSV para HTML!! + + + + + +
+ +

Converter CSV para HTML!!


+ +
+
+
+
+ +
+

Dados da tabela:

+ +
+ +
+ +
+ +

+
+ +
+ + + \ No newline at end of file diff --git a/tables/script.js b/tables/script.js new file mode 100644 index 0000000..aad1c6f --- /dev/null +++ b/tables/script.js @@ -0,0 +1,34 @@ +function CSVparaHTML(){ + + let titulo_input = document.getElementById("titulo-input").value; + let csv_input = document.getElementById("csv-input").value; + + let titulo = document.createTextNode(titulo_input); + + let titulo_tabela = document.getElementById("titulo_tabela"); + let conteudo = document.getElementById("conteudo"); + + titulo_tabela.appendChild(titulo); + + let tabela = document.createElement("tabela"); + let tabelaCSV = csv_input.split("\n"); + + tabelaCSV.forEach(function(linhas) { + + let colunas = linhas.toString().split(","); + let linha = document.createElement("tr"); + + colunas.forEach(function(celulas){ + let celula = document.createElement("td"); + celula.style.border = "1px solid black"; + let valor = document.createTextNode(celulas); + celula.appendChild(valor); + linha.appendChild(celula); + + }) + tabela.appendChild(linha); + + }); + + conteudo.appendChild(tabela); +} \ No newline at end of file From 4ea6468a1d61192124185b7af9212fd4ccb6f438 Mon Sep 17 00:00:00 2001 From: Thiago Lucas Date: Mon, 20 Jun 2022 20:10:07 -0300 Subject: [PATCH 2/3] Um texto vale mais que mil imagens... --- imgParaTexto/index.html | 24 ++++++++++++++++++++++++ imgParaTexto/pfp.jpg | Bin 0 -> 966 bytes imgParaTexto/script.js | 12 ++++++++++++ {tables => tabelas}/index.html | 0 {tables => tabelas}/script.js | 0 5 files changed, 36 insertions(+) create mode 100644 imgParaTexto/index.html create mode 100644 imgParaTexto/pfp.jpg create mode 100644 imgParaTexto/script.js rename {tables => tabelas}/index.html (100%) rename {tables => tabelas}/script.js (100%) diff --git a/imgParaTexto/index.html b/imgParaTexto/index.html new file mode 100644 index 0000000..e8797d3 --- /dev/null +++ b/imgParaTexto/index.html @@ -0,0 +1,24 @@ + + + + + + + Um texto vale mais que mil imagens... + + + + + +
+ +

Aperte para transformar em texto


+ + fotinha

+
+ +
+
+ + + \ No newline at end of file diff --git a/imgParaTexto/pfp.jpg b/imgParaTexto/pfp.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e312a9df6410ae825d2da522d8e6838527099a49 GIT binary patch literal 966 zcmex=6kE^cmKJ|O{KK0!WiZUHd? zL17V5QBfX#aS1UI2_X?t5k_X9dRA6WAQIu_<`os-7XbrN5uieTegOdxPe4RaM1+@D zKo~>=WrRh63{hcTVL>6${|6WZIT#ce6qp$W8JGkanFSgDA7PLII-Hpm;$8^J#>~pW zz{JAN36wPz0Ln5mf*cA}!pH=4Jewc`yO6M=m}AnEOCm}}#!i7@iIXpKh$^cXh9m>E zNi#A4y$TE^1YlxhVP<1z1xjiFZ3i04#0s|+7;MZef{KQLLXNC#N{Nj|PKA>e{=db* z12lq3kXewyp5bX&hx=^5wyQ-eT(*ZCHPX(SYWhTQPg`)$yXUt8HNC36q$VhBJkS^Z zCc}8CX~D$>i{`qonyTTH>gv(<<7*F-r-h`~lJewjFwbN6fW>95PH0Jl6%1OMFOW{Y$x5icHiyk)%EULlS1z7 zT+dY!u|h5{D)UI;+{mhHIwJ6dcYR8vpzlv{|wLEy^At`;jZ0ogq zo9=`!(pvRg!&CCY_n;**4|)sFO>*D;L;l9!H;?BE+)BPEm#uhW({1mg>=uW*Q&TMz z`V#78KCV@L_4D3Y?rR?o7Bs(G^y=qx?y2>CbN;1o`j_}=Lg>mz+swrhzF)cg_f)9! z$1vyBd_DW`-tj*ebE;OmWa&Q1Ao)q_gD(C|5na8h$?DiHiD%jG3YQyB%F){Dmi%eS z(P>}WuPv7;^wri1v{d=@{gr7CS7W2#pIHn4O4_@|=SobzV%fS~*;K1nO83U;phZ48 z%R~c@EcLJnu=jmbe^Hrz%dO5YZJV@r3B2&IySO5}N`ID4$Tx)t{}~kSn!Q;UxKK;h zZgW60uV0~0#iePtQ!AJ&mIxR(u+>E!pRt5_NB5UcPk(f+z90KB<7D@RJzg)Lp8hBr zzHj%Vi<9|UA4TeY*^wm>->S7ccrx$bdphOIEVkV_$da!zM@E3-e8k1cDjL$9|8D{S Dg)3ME literal 0 HcmV?d00001 diff --git a/imgParaTexto/script.js b/imgParaTexto/script.js new file mode 100644 index 0000000..d6ad753 --- /dev/null +++ b/imgParaTexto/script.js @@ -0,0 +1,12 @@ +function imgParaTexto() { + var imgs = document.getElementsByTagName("img"); + + for (let i = 0; i < imgs.length; i++) { + + var pai = imgs[i].parentElement; + var texto = imgs[i].alt; + var textNode = document.createTextNode(texto); + pai.replaceChild(textNode, imgs[i]); + + } +} \ No newline at end of file diff --git a/tables/index.html b/tabelas/index.html similarity index 100% rename from tables/index.html rename to tabelas/index.html diff --git a/tables/script.js b/tabelas/script.js similarity index 100% rename from tables/script.js rename to tabelas/script.js From 65fdf0847110979acd755105c9d7195775c3efc1 Mon Sep 17 00:00:00 2001 From: Thiago Lucas Date: Mon, 20 Jun 2022 20:31:41 -0300 Subject: [PATCH 3/3] getByName(elem) --- getByName/index.html | 20 ++++++++++++++++++++ getByName/script.js | 13 +++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 getByName/index.html create mode 100644 getByName/script.js diff --git a/getByName/index.html b/getByName/index.html new file mode 100644 index 0000000..a16a20a --- /dev/null +++ b/getByName/index.html @@ -0,0 +1,20 @@ + + + + + + + getByName(elem) + + + + + + +

TESTE QUANTOS ELEMENTOS POSSUEM CERTA TAG


+

Escreva a função no console e coloque como atributos onde começa e o nome da tag


+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis, nulla enim? Iure minus numquam ipsum quis voluptas? Ipsam, accusamus minima! Quas dignissimos nam, blanditiis nesciunt voluptatum non rem illum amet?


+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod, debitis. Animi eum aliquam asperiores necessitatibus voluptatibus earum laudantium? Consequatur fuga laborum reiciendis expedita voluptates vero commodi excepturi provident voluptatem omnis.

+ + + \ No newline at end of file diff --git a/getByName/script.js b/getByName/script.js new file mode 100644 index 0000000..5cd506a --- /dev/null +++ b/getByName/script.js @@ -0,0 +1,13 @@ +function getByName(node, string) { + string.toUpperCase() + var listaElementos = []; + + for (var i = 0; i < node.childNodes.length; i++) { + var childNode = node.childNodes[i]; + if(childNode.childNodes.length > 0) getByName(childNode, string); + if(childNode.tagName == string && childNode.tagName !== null) listaElementos.push(childNode); + } + console.log(listaElementos); + return listaElementos; + } +