aboutsummaryrefslogtreecommitdiff
path: root/src/home.js
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2020-04-28 18:15:46 +0200
committern-peugnet <n.peugnet@free.fr>2020-04-28 18:15:46 +0200
commit3183ce9dd42211b7279c7ce545c414452f5a9ef0 (patch)
tree445b0abaf9404a1449fa9f55d52fd42d49826642 /src/home.js
parent5b1457835be6c00a7d108537ecc88d3d85d48d51 (diff)
downloadwcms-3183ce9dd42211b7279c7ce545c414452f5a9ef0.tar.gz
wcms-3183ce9dd42211b7279c7ce545c414452f5a9ef0.zip
refactor: clean js code with "activate" functions
Diffstat (limited to 'src/home.js')
-rw-r--r--src/home.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/home.js b/src/home.js
index 0778edb..a75ba1d 100644
--- a/src/home.js
+++ b/src/home.js
@@ -1,18 +1,11 @@
-import { checkallHandler, closeSubmenus, activateSelectAll } from './fn/fn';
+import {
+ activateCheckall,
+ activateCloseSubmenus,
+ activateSelectAll,
+} from './fn/fn';
window.addEventListener('load', () => {
- let checkboxes = document.getElementsByName('pagesid[]');
- let checkall = document.getElementById('checkall');
- if (!checkall) {
- return;
- }
- let checkbox = document.createElement('input');
- checkbox.type = 'checkbox';
- checkbox.addEventListener('input', checkallHandler.bind({ checkboxes }));
- checkall.innerHTML = '';
- checkall.appendChild(checkbox);
-
+ activateCheckall('pagesid[]', 'checkall');
activateSelectAll();
+ activateCloseSubmenus();
});
-
-window.addEventListener('click', closeSubmenus);