diff options
author | luxagraf <sng@luxagraf.net> | 2018-12-31 20:06:26 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-12-31 20:06:26 -0600 |
commit | 23b4b185e3f3f8b9f17eebc49110cb4696acdb39 (patch) | |
tree | 3ac73213b091054e93819f6293c3297439dd0c34 /scripts/src/note-edit.js | |
parent | 219ac9b26feec3e2c5cd68cf530485d0dbaa943c (diff) |
refactored JS
Diffstat (limited to 'scripts/src/note-edit.js')
-rw-r--r-- | scripts/src/note-edit.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/scripts/src/note-edit.js b/scripts/src/note-edit.js index c8f3caa..5abbab7 100644 --- a/scripts/src/note-edit.js +++ b/scripts/src/note-edit.js @@ -82,13 +82,6 @@ function edit_note(btn, form, title, quill, qcontainer, url){ } return false; } -function ajaxHijack(form, func) { - form.onsubmit = function(e) { - e.preventDefault(); - func(e.target); - return false; - } -} function notebookCreate(form) { var request = new XMLHttpRequest(); var url = form.action @@ -107,7 +100,9 @@ function notebookCreate(form) { var select = document.getElementById('id_notebook'); var parentForm = document.getElementById('note-edit-form'); select.options.add(new Option(data['name'], data['id'], false, true)); - parentForm.formchange = true; + if (parentForm !== null) { + parentForm.formchange = true; + } } else { var data = JSON.parse(request.responseText); console.log(data); @@ -146,7 +141,7 @@ if (typeof(document.getElementById('note-edit-form')) != 'undefined' && document form.addEventListener('input', function (e) { form.formchange = true; }); - //document.getElementById('btn-js-hide').classList.add('hide'); + document.getElementById('btn-js-hide').classList.add('hide'); btn.classList.remove('hide'); btn.editing = false; btn.addEventListener('click', function(e){ |