diff options
Diffstat (limited to 'scripts/src/util.js')
-rw-r--r-- | scripts/src/util.js | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/src/util.js b/scripts/src/util.js index daad7e1..144deae 100644 --- a/scripts/src/util.js +++ b/scripts/src/util.js @@ -35,7 +35,7 @@ function ajaxHijack(form, func) { //global init for Color Picker function initColorPicker(form){ var notebook_form_inputs = form.getElementsByTagName('input'); - var p = notebook_form.getElementsByTagName('fieldset')['color-picker']; + var p = form.getElementsByTagName('fieldset')['color-picker']; //document.getElementById('js-novi-backdrop').removeEventListener("click", handleMouseDown, true); p.classList.add('top'); p.popup = p.popup || new Picker({ @@ -100,23 +100,32 @@ function initQuill(el) { } //global modal function, give a DOM element, puts it in a model box. -function modalBox(el, content){ +function modalBox(content, btn){ + // if passed a btn object get data from that, otherwise check the content object + if (btn) { + var type = btn.dataset.modalHedClass; + var headline = btn.dataset.modalHed; + } else { + var type = content.hedClass || ''; + var headline = content.modalHed || ''; + } if (window.elemsRemoved !== undefined) { content = window.elemsRemoved; } - var headlines = ['Prompt']; var options = { - type : el.dataset.modalHedClass, - headline : el.dataset.modalHed, + type : type, + headline : headline, content : content, cancelText : 'X', confirmText : 'OK', cancelAction : function(){}, confirmAction : function(){}, reject : false, + class : content.wrapperClass }; //build the modal - var overlay = buildComponent('div', 'overlay'); + console.log(options.class); + var overlay = buildComponent('div', options.class); var outermodal = buildComponent('div', 'overlay-wrapper'); var innermodal = buildComponent('div', 'modal'); var headline = buildComponent('header', false, options.headline); |