Skip to content

Commit

Permalink
fix(back-end): corrigido problema de acrescentar codigos e descrições…
Browse files Browse the repository at this point in the history
… e não aparecer no textarea.

fix(front-end): corrigido o problema de responsividade dos campos Codgio e Descrição.
  • Loading branch information
michael.oliveira committed Sep 14, 2023
1 parent a48516b commit 2d39dea
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 75 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</button>
</div>

<div id="cheat" class="mb-3" style="width: 394px; height: 150px; overflow-y: scroll; border: yellow">
<div id="cheat" class="mb-3">
<div class="form-floating mb-3">
<input type="text" class="form-control" id="codeCheat" placeholder="ls">
<label for="codeCheat">Código</label>
Expand Down
108 changes: 34 additions & 74 deletions js/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,97 +65,57 @@ function getAxeet() {
axeet.topic = [topic];
return axeet;
}

function updateAxeet(AxeetDTO, codeCheat, description, topicName) {

var axeet = new Axeet();
var topic = new Topics();
var cheat = new Cheats();

axeet.titleCheat = AxeetDTO.titleCheat;
axeet.theme = AxeetDTO.theme;
axeet.author = AxeetDTO.author;
axeet.cheatSheet = AxeetDTO.cheatSheet;
axeet.topic = topic;

if (topicName === ""){
topic.topicName = AxeetDTO.topic.topicName;
topic.cheat = cheat;
}else {
axeet.addTopic(topicName);
}
if ((codeCheat || description) === ""){
cheat.codeCheat = AxeetDTO.topic.cheat.codeCheat;
cheat.description = AxeetDTO.topic.cheat.description;
}else{
cheat.codeCheat = AxeetDTO.topic.cheat.codeCheat;
cheat.description = AxeetDTO.topic.cheat.description;
topic.addCheat(codeCheat, description);
}
console.log(axeet);
// return axeet;
}


function createCheat() {

let text = document.querySelector("#axeetScript").value;
var axeet = JSON.parse(text);

var countTopic = axeet.topic.length;

if (countTopic > 1){
for (i = 0; countTopic > i; i++){
console.log("Teste")
for (var cheat in axeet.topic[countTopic-1].cheat.value){
axeet.topic[countTopic-1].cheat[i+1] = new Cheats("", "")
console.log(axeet);
function percorreCheatList(countTopic, axeet) {
if (countTopic > 1) {
for (i = 0; countTopic > i; i++) {
for (var cheat in axeet.topic[countTopic - 1].cheat.value) {
axeet.topic[countTopic - 1].cheat[i + 1] = new Cheats("", "")
}
axeet.topic[i].cheat[i+1] = new Cheats("", "")
axeet.topic[i].cheat[i + 1] = new Cheats("", "")
}
}else {
for (i = 0; countTopic > i; i++){
} else {
for (i = 0; countTopic > i; i++) {
var countCheat = axeet.topic[i].cheat.length;
console.log("inicio do for")
for (j = 0; j < countCheat; j++){
console.log(axeet.topic[i].cheat[j]);
if(axeet.topic[i].cheat[j+1] === undefined){
axeet.topic[i].cheat[j+1] = new Cheats("", "")
for (j = 0; j < countCheat; j++) {
if (axeet.topic[i].cheat[j + 1] === undefined) {
axeet.topic[i].cheat[j + 1] = new Cheats("", "")
}
}
console.log(j);
console.log("fim do for")
// axeet.topic[i].cheat[j] = new Cheats(codeCheat, description)
console.log(axeet);
}
}
}

function novoAddEventListenerPosCreateCheat(axeet, countTopic) {
form.removeEventListener('input', form.fn)

form.addEventListener('input', form.novo_fn=function novo_fn(){
console.log(axeet)
for (i = 0; countTopic > i; i++){
console.log("Teste2")
form.addEventListener('input', form.novo_fn = function novo_fn() {
for (i = 0; countTopic > i; i++) {
var countCheat = axeet.topic[i].cheat.length;
for (j = 0; j < countCheat; j++){
console.log(Object.entries(axeet.topic[i].cheat[j])
// if(Object.entries(axeet.topic[i].cheat[j]) === undefined){
// console.log("este é vazio")
// var cheatX = new Cheats
// cheatX.codeCheat = document.getElementById("codeCheat").value;
// cheatX.description = document.getElementById("description").value;

// axeet.topic[i].cheat[j+1] = cheatX;

// document.getElementById("axeetScript").innerHTML = JSON.stringify(axeet, undefined, 8);
//}
for (j = 0; j < countCheat; j++) {
var auxCheat = axeet.topic[i].cheat[j];
if (axeet.topic[i].cheat[j + 1] === undefined) {
var cheatX = new Cheats
cheatX.codeCheat = document.getElementById("codeCheat").value;
cheatX.description = document.getElementById("description").value;
axeet.topic[i].cheat[j] = cheatX;
document.getElementById("axeetScript").innerHTML = JSON.stringify(axeet, undefined, 8);
}
}
}
});
}

function createCheat() {

let text = document.querySelector("#axeetScript").value;
var axeet = JSON.parse(text);
var countTopic = axeet.topic.length;

percorreCheatList(countTopic, axeet);
novoAddEventListenerPosCreateCheat(axeet, countTopic);

document.getElementById("codeCheat").value = ""
document.getElementById("description").value = ""

document.getElementById("axeetScript").innerHTML = JSON.stringify(axeet, undefined, 8);

}
Expand Down

0 comments on commit 2d39dea

Please sign in to comment.