|
|
|
|
|
|
|
|
console.log(this) |
|
|
console.log(this) |
|
|
let buttonId = (this.id).split("saveNoteButton")[1]; |
|
|
let buttonId = (this.id).split("saveNoteButton")[1]; |
|
|
console.log(buttonId) |
|
|
console.log(buttonId) |
|
|
createProgressBar(buttonId); |
|
|
|
|
|
saveNoteObject(buttonId); |
|
|
saveNoteObject(buttonId); |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
async function saveNoteObject(id){ |
|
|
async function saveNoteObject(id){ |
|
|
|
|
|
|
|
|
console.log(id) |
|
|
console.log(id) |
|
|
|
|
|
enableLoadingSign(id); |
|
|
await sleep(10000) //sleep simulates the remote server access or similar, |
|
|
await sleep(10000) //sleep simulates the remote server access or similar, |
|
|
//so instead of sleep would be e.g. saveToRemoteServer()... |
|
|
//so instead of sleep would be e.g. saveToRemoteServer()... |
|
|
//the leftover code of the async function is executed after the delay |
|
|
//the leftover code of the async function is executed after the delay |
|
|
|
|
|
|
|
|
|
|
|
disableLoadingSign(id); |
|
|
|
|
|
|
|
|
let noteTitle = document.getElementById('inputTitle'+id).value; |
|
|
let noteTitle = document.getElementById('inputTitle'+id).value; |
|
|
let noteText = document.getElementById('noteText'+id).value; |
|
|
let noteText = document.getElementById('noteText'+id).value; |
|
|
|
|
|
|
|
|
console.log(noteObj_serialized) |
|
|
console.log(noteObj_serialized) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function enableProgressBar(id){ |
|
|
|
|
|
console.log('pBar'+id) |
|
|
|
|
|
document.getElementById('pBar'+id).value = |
|
|
|
|
|
document.getElementById('pBar'+id).value + 5; |
|
|
|
|
|
if (document.getElementById('pBar'+id).value == 100){ |
|
|
|
|
|
clearInterval(ctr); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function enableLoadingSign(id){ |
|
|
|
|
|
createLoadingSign(id) |
|
|
|
|
|
document.getElementById('loadSign'+id).style.display = "block"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function disableLoadingSign(id){ |
|
|
|
|
|
let sign = document.getElementById('loadSign'+id); |
|
|
|
|
|
sign.style.display = "none"; |
|
|
|
|
|
sign.parentNode.removeChild(sign); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function createProgressBar(id){ |
|
|
|
|
|
|
|
|
function createLoadingSign(id){ |
|
|
|
|
|
|
|
|
let progressBar = document.createElement('progress'); |
|
|
|
|
|
let progressBarWrapper = document.createElement('div'); |
|
|
|
|
|
progressBarWrapper.setAttribute('class', 'pBars') |
|
|
|
|
|
progressBar.setAttribute('value', '0'); |
|
|
|
|
|
progressBar.setAttribute('max', '100'); |
|
|
|
|
|
progressBar.setAttribute('id', 'pBar'+id); |
|
|
|
|
|
progressBarWrapper.appendChild(progressBar); |
|
|
|
|
|
document.getElementById(id).appendChild(progressBarWrapper); |
|
|
|
|
|
|
|
|
let loadingSign = document.createElement('div'); |
|
|
|
|
|
let loadingSignWrapper = document.createElement('div'); |
|
|
|
|
|
loadingSign.setAttribute('class', 'loader') |
|
|
|
|
|
loadingSign.setAttribute('id', 'loadSign'+id); |
|
|
|
|
|
loadingSignWrapper.appendChild(loadingSign); |
|
|
|
|
|
document.getElementById(id).appendChild(loadingSignWrapper); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|