aboutsummaryrefslogtreecommitdiff
path: root/scripts/src/util.js
blob: dfaeeea81d3e2aa6928094c90c434ff590ed307a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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();
}

function get_login_form() {
    getJSON('GET', '/login/', function(e){
        console.log(e); 
    });
}

//Global init for Quill 
function initQuill(el) {
    window.quill = new Quill(el, {
        modules: {
            syntax: true,              // Include syntax module
            toolbar: [
                [{ header: [1, 2, 3, 4, false] }],
                ['bold', 'italic', 'underline', 'blockquote'],
                [{ 'list': 'bullet'}, { 'list': 'ordered'},{ 'list': 'check'} ],
                ['link', 'code-block', 'image', 'video', 'formula',],
                [{ 'color': [] }, { 'background': [] }],          // dropdown with defaults from theme
                [{ 'font': [] }],
            ] 
        },
        theme: 'snow',
        enable: false
    });
    window.quill.on('text-change', function() {
        window.quillchange = true;
    });
}