Browse Source

tab functions

master
RENOX 1 month ago
parent
commit
988f4d24e2
1 changed files with 13 additions and 4 deletions
  1. +13
    -4
      src/main/resources/static/js/main.js

+ 13
- 4
src/main/resources/static/js/main.js View File

@@ -68,7 +68,7 @@ function initValidateSave() { //TODO what if name is taken
if (values !== "" && values != null){
tabCount++;
empty = false;
text += "|textdungeon-tab" + tabCount + "|" + values + "|textdungeon-end|";
text += values + "|textdungeon-tab|";
}
}
if (document.getElementById("password-form").value === "") // logged in user
@@ -237,7 +237,9 @@ function loginResponseLocalEvent(response) {
label_password.textContent = "Incorrect.";
label_password.style.display = "initial";
} else if (responseJson.DOCUMENT_TYPE === "NEW_USER") {
let futureName = document.getElementById("name").value;
initEmptyForm();
document.getElementById("name-form").value = futureName;
} else if (responseJson.DOCUMENT_TYPE === "DECRYPT_SUCCESS") {
sessionStorage.setItem(responseJson.DUNGEON.name, document.getElementById("password").value);
initEmptyForm();
@@ -245,15 +247,22 @@ function loginResponseLocalEvent(response) {
}
}

function populateFormLocalEvent(responseJson) {
function populateFormLocalEvent(responseJson) { //wtf?
// TODO 10 charlength title

document.getElementById("name-form").value = responseJson.DUNGEON.name;
document.getElementById("name-form").disabled = "true";
document.getElementById("password-form").style.display = "none";
document.getElementById("btn-logout").style.display = "inherit";
document.getElementById("btn-settings").style.display = "inherit";
document.getElementById("textarea").value = responseJson.DUNGEON.cleartext;
// TODO Tab Information
let entireTextArray = responseJson.DUNGEON.cleartext.split("|textdungeon-tab|");
for (let i = 0; i<responseJson.DUNGEON.meta.TAB_COUNT; i++){
if (i !== 0) {initAddTab();}
tabContent.set(document.getElementById("tab" + i+1).id, entireTextArray[i]);

}
console.log(document.getElementById("tab" + 1).id);
document.getElementById("textarea").value = entireTextArray[0];
}

/* END LOCAL EVENTS */


Loading…
Cancel
Save