1.started removal of CDNs.\n 2. Improved modular structure for all parts of project including database.
This commit is contained in:
33
static/js/dom.js
Normal file
33
static/js/dom.js
Normal file
@@ -0,0 +1,33 @@
|
||||
// Module for DOM manipulation
|
||||
export default class DOM {
|
||||
static updateElement(id, data) {
|
||||
const element = document.getElementById(id);
|
||||
if (element) {
|
||||
element.textContent = data;
|
||||
}
|
||||
}
|
||||
|
||||
// Add more DOM manipulation methods as needed
|
||||
|
||||
static convertForm2JSON(elementForm) {
|
||||
formData = {}
|
||||
formDataTmp = elementForm.serializeArray();
|
||||
formDataTmp.forEach((value, key) => {
|
||||
formData[key] = value;
|
||||
/*
|
||||
console.log('key: ' + key);
|
||||
console.log('value: ' + value);
|
||||
*/
|
||||
});
|
||||
return formData;
|
||||
}
|
||||
|
||||
static loadPageBody(contentNew) {
|
||||
let pageBody = document.querySelector(idPageBody);
|
||||
pageBody.innerHTML = contentNew;
|
||||
}
|
||||
|
||||
static getHashPageCurrent() {
|
||||
return document.body.dataset.page;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user