You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.1 KiB
27 lines
1.1 KiB
3 years ago
|
const ctxl = require('../../json/ctx.json');
|
||
|
|
||
|
module.exports = () => {
|
||
|
document.getElementById('ctx').style.display = 'none';
|
||
|
const ctx = document.getElementById('ctx');
|
||
|
try {
|
||
|
for (let i = 0; i < ctxl.length; i++) {
|
||
|
let k = ctxl[i];
|
||
|
let ctxg = document.createElement('div');
|
||
|
ctxg.className = 'ctx-group';
|
||
|
ctx.appendChild(ctxg);
|
||
|
for (let x = 0; x < k.length; x++) {
|
||
|
let item = k[x];
|
||
|
let ctxi = document.createElement('div');
|
||
|
ctxi.className = 'ctx-item';
|
||
|
ctxi.id = item.id;
|
||
|
try {ctxi.onclick = require(`../contextmenu/${item.onclick}`);} catch {}
|
||
|
ctxg.appendChild(ctxi);
|
||
|
let name = document.createElement('p');
|
||
|
name.classList.add('ctx-name', 'nosel');
|
||
|
name.innerHTML = item.name;
|
||
|
ctxi.appendChild(name);
|
||
|
}
|
||
|
if (i + 1 < ctxl.length) {ctx.appendChild(document.createElement('hr'));}
|
||
|
}
|
||
|
} catch (e) {console.error(e);}
|
||
|
};
|