Add profile data

This commit is contained in:
Ryan Prather 2024-06-23 22:40:50 -04:00
parent 87fb461c26
commit 752b2a291e
3 changed files with 24 additions and 23 deletions

View File

@ -4,11 +4,9 @@ var references = {};
var tabs = [];
let saved = false;
let textDirty = false;
let saveTimeout = 15000;
var to = null;
let controller;
var BOOKS = {};
let saveFailCounter = 0;
$(function () {
setHeight();
@ -105,7 +103,7 @@ function setHeight() {
});
}
if (!to) {
to = setTimeout(saveNote, saveTimeout);
to = setTimeout(saveNote, saveInterval);
}
}
@ -181,7 +179,7 @@ function saveNote(event) {
if (!textDirty || !validateNote()) {
clearTimeout(to);
to = setTimeout(saveNote, saveTimeout);
to = setTimeout(saveNote, saveInterval);
return;
}
@ -207,11 +205,12 @@ function saveNote(event) {
contentType: 'application/json',
data: JSON.stringify(note),
dataType: 'json',
timeout: 5000
timeout: saveTimeout
})
.done(function (data) {
if (data.msg == 'saved' && !saved) {
saveCheck.classList.remove('saving', 'error', 'fa-times', 'fa-check');
saveFailureCount = SAVE_FAILURE_LIMIT;
saveCheck.classList.remove('saving', 'error', 'fa-times-circle', 'fa-save');
showSave();
if (noteText == document.querySelector('#notes').value) {
saved = true;
@ -225,21 +224,21 @@ function saveNote(event) {
}
})
.fail(function (xhr, status, error) {
saveFailCounter++;
saveCheck.classList.remove('saving', 'fa-check');
saveCheck.classList.add('fa-times', 'error');
saveFailureCount--;
saveCheck.classList.remove('saving', 'fa-save');
saveCheck.classList.add('fa-times-circle', 'error');
console.error(error);
})
.always(function (xhr, status) {
if (status == 'timeout') {
saveCheck.classList.remove('saving', 'fa-check');
saveCheck.classList.add('error', 'fa-times');
saveCheck.classList.remove('saving', 'fa-save');
saveCheck.classList.add('error', 'fa-times-circle');
}
clearTimeout(to);
if (saveFailCounter < 5) {
to = setTimeout(saveNote, saveTimeout);
if (saveFailureCount > 0) {
to = setTimeout(saveNote, saveInterval);
} else {
saveFailCounter = 0;
saveFailureCount = SAVE_FAILURE_LIMIT;
}
});
}
@ -268,8 +267,8 @@ function isUuidValid(uuid) {
}
function startSave() {
document.querySelector('#save-check').classList.remove('error', 'fa-times', 'fa-check');
document.querySelector('#save-check').classList.add('saving', 'fa-check');
document.querySelector('#save-check').classList.remove('error', 'fa-times-circle', 'fa-save');
document.querySelector('#save-check').classList.add('saving', 'fa-save');
document.querySelector('#save-check').style.opacity = 1;
}
@ -283,7 +282,7 @@ function showSave() {
if (saved) { return; }
var checkmark = document.getElementById("save-check");
checkmark.classList.add('fa-check');
checkmark.classList.add('fa-save');
// Schedule the animation to run every 1 second (which is equivalent to a 1-second delay between each iteration)
var si = setInterval(function () {

File diff suppressed because one or more lines are too long

View File

@ -3227,9 +3227,9 @@ button:disabled,
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
border: 0;
display: block;
height: 7.5em;
height: 4.5em;
left: 26em;
line-height: 7.5em;
line-height: 4.5em;
outline: 0;
overflow: hidden;
position: absolute;
@ -3287,11 +3287,13 @@ button:disabled,
}
#sidebar .toggle {
height: 6.25em;
height: 4.5em;
left: 24em;
line-height: 6.25em;
line-height: 4.5em;
text-indent: 5em;
width: 5em;
background-color: #fff;
margin-left: 1em;
}
#sidebar .toggle:before {
@ -3336,7 +3338,7 @@ button:disabled,
#sidebar .toggle {
text-indent: 6em;
width: 6em;
width: 4.5em;
}
#sidebar .toggle:before {