Skip to content

Commit

Permalink
update javascript (luizhenrique055#41)
Browse files Browse the repository at this point in the history
* update javascript

-retenção dados alarmes

* Update alarme.js

-mudança variavel alarme.js

* Update criarPasta.js

-troca de variavel em alarme.js

* update javascript

alarme tocando

* update javascript

-correção onload predefinido

Co-authored-by: Luiz Henrique Oliveira de Assis <51269270+luizhenrique01@users.noreply.github.com>
  • Loading branch information
firzek and luizhenrique055 committed Jun 24, 2021
1 parent cdfb929 commit a08451c
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 36 deletions.
66 changes: 42 additions & 24 deletions javascript/pastas.js
@@ -1,10 +1,33 @@
function click1(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","1")

}
function click2(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","2")

}
function click3(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","3")
}
function click4(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","4")
}
function click5(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","5")
}
onload = () =>{

let pastaNumero=localStorage.getItem("pastaNumero");

if (pastaNumero==1){
let h3 = document.createElement("h3");
h3.setAttribute('id','1pasta');
h3.onclick = new Function('click1()');
let alarmeData1=JSON.parse(localStorage.getItem('1'));
let nome=alarmeData1;
h3.innerHTML = nome;
Expand All @@ -17,6 +40,8 @@ onload = () =>{
let h3 = document.createElement("h3");
let alarmeData1=JSON.parse(localStorage.getItem('1'));
h3.setAttribute('id','1pasta');
h3.onclick = new Function('click1()');

let nome=alarmeData1;
h3.innerHTML = nome;

Expand All @@ -27,6 +52,7 @@ onload = () =>{
nome=alarmeData2;
h3.innerHTML = nome;
h3.setAttribute('id','2pasta');
h3.onclick = new Function('click2()');

document.getElementById("pasta2").append(h3);

Expand All @@ -35,6 +61,8 @@ onload = () =>{
let h3 = document.createElement("h3");
let alarmeData1=JSON.parse(localStorage.getItem('1'));
h3.setAttribute('id','1pasta');
h3.onclick = new Function('click1()');

let nome=alarmeData1;
h3.innerHTML = nome;

Expand All @@ -46,6 +74,7 @@ onload = () =>{
nome=alarmeData2;
h3.innerHTML = nome;
h3.setAttribute('id','2pasta');
h3.onclick = new Function('click2()');
document.getElementById("pasta2").append(h3);


Expand All @@ -54,6 +83,7 @@ onload = () =>{
nome=alarmeData3;
h3.innerHTML = nome;
h3.setAttribute('id','3pasta');
h3.onclick = new Function('click3()');

document.getElementById("pasta3").append(h3);

Expand All @@ -64,6 +94,8 @@ onload = () =>{
let h3 = document.createElement("h3");
let alarmeData1=JSON.parse(localStorage.getItem('1'));
h3.setAttribute('id','1pasta');
h3.onclick = new Function('click1()');

let nome=alarmeData1;
h3.innerHTML = nome;

Expand All @@ -74,29 +106,32 @@ onload = () =>{
nome=alarmeData2;
h3.innerHTML = nome;
h3.setAttribute('id','2pasta');
h3.onclick = new Function('click2()');

document.getElementById("pasta2").append(h3);
h3 = document.createElement("h3");
let alarmeData3=JSON.parse(localStorage.getItem('3'));
nome=alarmeData3;
h3.innerHTML = nome;
h3.setAttribute('id','3pasta');
h3.onclick = new Function('click3()');

document.getElementById("pasta3").append(h3);
h3 = document.createElement("h3");
let alarmeData4=JSON.parse(localStorage.getItem('4'));
nome=alarmeData4;
h3.innerHTML = nome;
h3.setAttribute('id','4pasta');
h3.onclick = new Function('click4()');

document.getElementById("pasta4").append(h3);


document.getElementById("pasta4").append(h3);
}
else if(pastaNumero==5){
let h3 = document.createElement("h3");
let alarmeData1=JSON.parse(localStorage.getItem('1'));
h3.setAttribute('id','1pasta');
h3.onclick = new Function('click1()');

let nome=alarmeData1;
h3.innerHTML = nome;

Expand All @@ -107,27 +142,31 @@ onload = () =>{
nome=alarmeData2;
h3.innerHTML = nome;
h3.setAttribute('id','2pasta');
h3.onclick = new Function('click2()');

document.getElementById("pasta2").append(h3);
h3 = document.createElement("h3");
let alarmeData3=JSON.parse(localStorage.getItem('3'));
nome=alarmeData3;
h3.innerHTML = nome;
h3.setAttribute('id','3pasta');
h3.onclick = new Function('click3()');

document.getElementById("pasta3").append(h3);
h3 = document.createElement("h3");
let alarmeData4=JSON.parse(localStorage.getItem('4'));
nome=alarmeData4;
h3.innerHTML = nome;
h3.setAttribute('id','4pasta');
h3.onclick = new Function('click4()');

document.getElementById("pasta4").append(h3);
h3 = document.createElement("h3");
let alarmeData5=JSON.parse(localStorage.getItem('5'));
nome=alarmeData5;
h3.innerHTML = nome;
h3.setAttribute('id','5pasta');
h3.onclick = new Function('click5()');

document.getElementById("pasta5").append(h3);

Expand All @@ -136,26 +175,5 @@ onload = () =>{



document.getElementById('1pasta').onclick=function(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","1")

}
document.getElementById('2pasta').onclick=function(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","2")

}
document.getElementById('3pasta').onclick=function(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","3")
}
document.getElementById('4pasta').onclick=function(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","4")
}
document.getElementById('5pasta').onclick=function(){
window.location.assign("telaAlarmes.html");
localStorage.setItem("pastaAtual","5")
}
}

0 comments on commit a08451c

Please sign in to comment.