diff options
Diffstat (limited to 'scripts/src/note-list.js')
-rw-r--r-- | scripts/src/note-list.js | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/scripts/src/note-list.js b/scripts/src/note-list.js index 2b82da1..cd5b58d 100644 --- a/scripts/src/note-list.js +++ b/scripts/src/note-list.js @@ -21,19 +21,23 @@ function initChoicesMenu(obj) { choices_holder.addEventListener('choice', choicePageChanger); } -if (typeof(document.getElementById('choices-container')) != 'undefined' && document.getElementById('choices-container') != null) { - initChoicesMenu({ - data: window.nbdata, - wrapper_classes: ['choices-wrapper', 'choices-wrapper-notebooks'], - replace_el: document.getElementById('notebook-list'), - choices_name: "choices-notebooks", - choices_id: "choices-notebooks" - }); - initChoicesMenu({ - data: window.tagdata, - wrapper_classes: ['choices-wrapper', 'choices-wrapper-tags'], - replace_el: document.getElementById('tags-list'), - choices_name: "choices-tags", - choices_id: "choices-tags" - }); -} +document.addEventListener("DOMContentLoaded", function () { + if (typeof(document.getElementById('body-notebook')) != 'undefined' && document.getElementById('body-notebook') != null) { + if (typeof(document.getElementById('choices-container')) != 'undefined' && document.getElementById('choices-container') != null) { + initChoicesMenu({ + data: window.nbdata, + wrapper_classes: ['choices-wrapper', 'choices-wrapper-notebooks'], + replace_el: document.getElementById('notebook-list'), + choices_name: "choices-notebooks", + choices_id: "choices-notebooks" + }); + initChoicesMenu({ + data: window.tagdata, + wrapper_classes: ['choices-wrapper', 'choices-wrapper-tags'], + replace_el: document.getElementById('tags-list'), + choices_name: "choices-tags", + choices_id: "choices-tags" + }); + } + } +}); |