aboutsummaryrefslogtreecommitdiff
path: root/src/media.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/media.js
parent5b1457835be6c00a7d108537ecc88d3d85d48d51 (diff)
downloadwcms-3183ce9dd42211b7279c7ce545c414452f5a9ef0.tar.gz
wcms-3183ce9dd42211b7279c7ce545c414452f5a9ef0.zip
refactor: clean js code with "activate" functions
Diffstat (limited to 'src/media.js')
-rw-r--r--src/media.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/media.js b/src/media.js
index 356c7c9..1073d23 100644
--- a/src/media.js
+++ b/src/media.js
@@ -1,15 +1,11 @@
-import { checkallHandler, closeSubmenus, activateSelectAll } from './fn/fn';
+import {
+ activateCheckall,
+ activateCloseSubmenus,
+ activateSelectAll,
+} from './fn/fn';
window.addEventListener('load', () => {
- let checkboxes = document.getElementsByName('id[]');
- let checkall = document.getElementById('checkall');
- let checkbox = document.createElement('input');
- checkbox.type = 'checkbox';
- checkbox.addEventListener('input', checkallHandler.bind({ checkboxes }));
- checkall.innerHTML = '';
- checkall.appendChild(checkbox);
-
+ activateCheckall('id[]', 'checkall');
activateSelectAll();
+ activateCloseSubmenus();
});
-
-window.addEventListener('click', closeSubmenus);