forked from projects/fipamo
ro
1e37580869
dropped in js from the old site to begin the process of wiring up the API, but this time around, scripts will be served directly in browswer rather than being transpiled through NPM/Babel, eliminating the need for NPM. also scripting will new modularized and served specifically for the requirements of the page loading it. no more front loading everything. only script that is needed for that page will be retrieved. if no scripting is needed, none will be loaded. The only casualty so far has been syntax highlighting due to prismjs still being a common js module, but either this will be replaced with another library or a custom syntax enginge will be created at a later date
36 lines
922 B
JavaScript
36 lines
922 B
JavaScript
export default class NavActions {
|
|
//--------------------------
|
|
// constructor
|
|
//--------------------------
|
|
constructor() {}
|
|
//--------------------------
|
|
// methods
|
|
//--------------------------
|
|
syncMenu() {
|
|
let navData = [];
|
|
let items = document.getElementById('nav-items').children;
|
|
for (let index = 0; index < items.length; index++) {
|
|
navData.push({
|
|
title: items[index].getElementsByTagName('label')[0].innerHTML,
|
|
id: items[index].id,
|
|
slug: items[index].getAttribute('data-slug'),
|
|
uuid: items[index].getAttribute('data-uuid'),
|
|
path: items[index].getAttribute('data-path')
|
|
});
|
|
}
|
|
|
|
let data = { menu: navData, remove: null };
|
|
return new Promise(function (resolve) {
|
|
resolve(data);
|
|
});
|
|
}
|
|
|
|
removeItem(id) {
|
|
document.getElementById('nav-items').removeChild(document.getElementById(id));
|
|
}
|
|
|
|
//--------------------------
|
|
// event handlers
|
|
//--------------------------
|
|
}
|