Notes/src/public/app/share.js

24 lines
683 B
JavaScript
Raw Normal View History

/**
* Fetch note with given ID from backend
*
* @param noteId of the given note to be fetched. If falsy, fetches current note.
*/
async function fetchNote(noteId = null) {
if (!noteId) {
2022-01-01 22:32:38 +01:00
noteId = document.body.getAttribute("data-note-id");
}
2022-01-01 22:32:38 +01:00
const resp = await fetch(`api/notes/${noteId}`);
return await resp.json();
}
document.addEventListener('DOMContentLoaded', () => {
const toggleMenuButton = document.getElementById('toggleMenuButton');
const layout = document.getElementById('layout');
2022-08-27 21:34:21 +02:00
if (toggleMenuButton && layout) {
toggleMenuButton.addEventListener('click', () => layout.classList.toggle('showMenu'));
}
}, false);