function buildComponent(tag, id, html){
var el = document.createElement(tag.toLowerCase());
if(id) el.id = id;
if(typeof html === 'string') el.innerHTML = html;
if(typeof html === 'object') el.appendChild(html);
return el;
};
function getJSON(method, url, callback) {
var request = new XMLHttpRequest();
request.addEventListener('load', callback);
request.open(method, url, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
//console.log(request.responseText);
} else {
console.log('server error');
}
};
request.onerror = function() {
console.log('error on request');
};
request.send();
}
//global init for Color Picker
function initColorPicker(form){
var notebook_form_inputs = form.getElementsByTagName('input');
var p = notebook_form.getElementsByTagName('fieldset')['color-picker'];
//document.getElementById('js-novi-backdrop').removeEventListener("click", handleMouseDown, true);
p.classList.add('top');
p.popup = p.popup || new Picker({
parent: p,
color: 'blue',
alpha: false,
//editor: false,
editorFormat: 'hex',
onDone: function(color) {
this.settings['parent'].style.backgroundColor = color.rgbString;
notebook_form_inputs['color_rgb'].value = color.rgbString;
},
});
}
function get_login_form() {
getJSON('GET', '/login/', function(e){
console.log(e);
});
}
//first define your getCookie function
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i