-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch2.js
More file actions
32 lines (28 loc) · 1.08 KB
/
patch2.js
File metadata and controls
32 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const fs = require('fs');
let js = fs.readFileSync('g:\\Il mio Drive\\STORAGE\\ANTIMO\\GestioneAttivitaWeb\\app.js', 'utf8');
const settingsLogic = `
// GET THE SETTINGS UI ELEMENTS
document.addEventListener('DOMContentLoaded', () => {
const btnSettings = document.getElementById('btnSettings');
const settingsModal = document.getElementById('settingsModal');
const btnCloseSettings = document.getElementById('btnCloseSettings');
if (btnSettings && settingsModal) {
btnSettings.addEventListener('click', (e) => {
e.preventDefault();
settingsModal.classList.remove('hidden');
});
}
if (btnCloseSettings && settingsModal) {
btnCloseSettings.addEventListener('click', () => {
settingsModal.classList.add('hidden');
});
}
});
`;
if (!js.includes('btnSettings.addEventListener')) {
js += '\n' + settingsLogic;
fs.writeFileSync('g:\\Il mio Drive\\STORAGE\\ANTIMO\\GestioneAttivitaWeb\\app.js', js, 'utf8');
console.log('App.js patched successfully');
} else {
console.log('App.js already patched');
}