aboutsummaryrefslogtreecommitdiff
path: root/scripts/src
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/src')
-rw-r--r--scripts/src/account-edit.js8
-rw-r--r--scripts/src/forum-categories.js15
-rw-r--r--scripts/src/note-list.js36
-rw-r--r--scripts/src/notebook-edit.js34
4 files changed, 63 insertions, 30 deletions
diff --git a/scripts/src/account-edit.js b/scripts/src/account-edit.js
index c9d3e9a..b592666 100644
--- a/scripts/src/account-edit.js
+++ b/scripts/src/account-edit.js
@@ -1 +1,7 @@
-getElementById('FileField').value = getElementById('file-upload-wrapper').value;
+if (typeof(document.getElementById('id_photo')) != 'undefined' && document.getElementById('id_photo') != null) {
+ var input = document.getElementById('id_photo');
+ input.fname = document.getElementById('filename');
+ input.addEventListener('change', function(e){
+ e.target.fname.innerHTML = e.target.value.split("\\")[2];
+ });
+}
diff --git a/scripts/src/forum-categories.js b/scripts/src/forum-categories.js
new file mode 100644
index 0000000..b389d43
--- /dev/null
+++ b/scripts/src/forum-categories.js
@@ -0,0 +1,15 @@
+document.addEventListener("DOMContentLoaded", function () {
+ if (typeof(document.getElementById('body-forum')) != 'undefined' && document.getElementById('body-forum') != null) {
+ if (typeof(document.getElementById('choices-container')) != 'undefined' && document.getElementById('choices-container') != null) {
+ console.log(document.getElementById('category-list'));
+ console.log('firing');
+ initChoicesMenu({
+ data: window.nbdata,
+ wrapper_classes: ['choices-wrapper', 'choices-wrapper-notebooks'],
+ replace_el: document.getElementById('category-list'),
+ choices_name: "choices-category",
+ choices_id: "choices-category"
+ });
+ }
+ }
+});
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"
+ });
+ }
+ }
+});
diff --git a/scripts/src/notebook-edit.js b/scripts/src/notebook-edit.js
index 7d0aa8f..a6ba689 100644
--- a/scripts/src/notebook-edit.js
+++ b/scripts/src/notebook-edit.js
@@ -17,8 +17,12 @@ function initNotebookEditor() {
document.getElementById('btn-js-hide').classList.add('hide');
btn.classList.remove('hide');
+ btn.isHidden = true;
btn.addEventListener('click', function(e){
e.preventDefault();
+ e.target.textContent = e.target.isHidden ? 'Save' : 'Edit';
+ e.target.isHidden = !e.target.isHidden;
+ e.target.classList.toggle('save');
edit_notebook(title, form, picker, fname, window.url);
}, false);
}
@@ -68,6 +72,7 @@ function initMultiNotebookEditor(notebooks){
btn.isHidden = true;
function clickHandler(e) {
e.preventDefault();
+ console.log(e.target.textContent);
e.target.textContent = e.target.isHidden ? 'Save' : 'Edit';
e.target.isHidden = !e.target.isHidden;
e.target.classList.toggle('save');
@@ -131,16 +136,19 @@ function notebookCallback(title, request) {
console.log('server error');
}
}
-if (typeof(document.getElementById('nb-edit-form')) != 'undefined' && document.getElementById('nb-edit-form') != null) {
- initNotebookEditor();
-}
-if (typeof(document.getElementById('nb-create-form')) != 'undefined' && document.getElementById('nb-create-form') != null && document.getElementById('nb-list-home') !== null) {
- var newnotebook = document.getElementById('notebook-wrapper');
- newnotebook.classList.add('hide');
- var notebookAddForm = document.getElementById('nb-create-form');
- var btn = document.getElementById('add_id_notebook');
- addNotebookModal(notebookAddForm, btn);
- var create_form = document.getElementById('nb-create-form');
- activatePicker(create_form, create_form.getElementsByTagName('fieldset')['color-picker']);
- initMultiNotebookEditor(document.getElementsByClassName('nb-list-item'));
-}
+
+document.addEventListener("DOMContentLoaded", function () {
+ if (typeof(document.getElementById('nb-edit-form')) != 'undefined' && document.getElementById('nb-edit-form') != null) {
+ initNotebookEditor();
+ }
+ if (typeof(document.getElementById('nb-create-form')) != 'undefined' && document.getElementById('nb-create-form') != null && document.getElementById('nb-list-home') !== null) {
+ var newnotebook = document.getElementById('notebook-wrapper');
+ newnotebook.classList.add('hide');
+ var notebookAddForm = document.getElementById('nb-create-form');
+ var btn = document.getElementById('add_id_notebook');
+ addNotebookModal(notebookAddForm, btn);
+ var create_form = document.getElementById('nb-create-form');
+ activatePicker(create_form, create_form.getElementsByTagName('fieldset')['color-picker']);
+ initMultiNotebookEditor(document.getElementsByClassName('nb-list-item'));
+ }
+});