Just sharing a simple upgrade. (Vq2) For the previous version, when a file is up...
tankPad @tankpad@infosec.exchange
Just sharing a simple upgrade. (Vq2)
For the previous version, when a file is uploaded to the remote server, there is a notification, 201, or 207 depending...
But, when a file is saved locally, there was no notification.
Sometimes I get distracted and, when I come back to work, forget if I just saved the current file or not.
To fix this, I added a similar notification to the local save button.
statusDiv.innerHTML = 'Saved';
Full function...
// 💾 Local Save
document.getElementById('savebtn').addEventListener('click', function()
{
const fname = fileInput.value.trim() || 'untitled.html';
const ext = fname.split('.').pop().toLowerCase();
const mimeTypes = {
html: 'text/html',
htm: 'text/html',
txt: 'text/plain',
css: 'text/css',
js: 'text/javascript',
json: 'application/json',
md: 'text/markdown',
svg: 'image/svg+xml',
xml: 'application/xml',
csv: 'text/csv'
};
const type = mimeTypes[ext] || 'text/plain';
const blob = new Blob([textInput.value], { type: type });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = fname;
a.click();
URL.revokeObjectURL(a.href);
statusDiv.innerHTML = 'Saved'; // Simply added this HTML change to the end of the function.
});
The same ...
statusDiv.innerHTML = 'Ready';
changes the "Saved" back to "Ready" after the text is altered.