Project

General

Profile

1
// Pnotify notifications ~ Andrea Mannocci
2
$.pnotify.defaults.history = false; //disable top-right history menu
3
$.pnotify.defaults.styling = "bootstrap3";
4

    
5
function show_notification(type, message) {
6
    var opts = {
7
        title: "Over Here",
8
        text: "Check me out.",
9
        addclass: "stack-bar-bottom",
10
        cornerclass: "",
11
//        width: "70%",
12
    };
13
    switch (type) {
14
    case 'error':
15
        opts.title = "Error";
16
        opts.type = "error";
17
        break;
18
    case 'info':
19
        opts.title = "Info";
20
        opts.type = "info";
21
        break;
22
    case 'success':
23
        opts.title = "Success";
24
        opts.type = "success";
25
        break;
26
    }
27
    opts.text = message;
28

    
29
    $.pnotify(opts);
30
}
31

    
32
// Show/hide Pnotify permanent notification ~ Andrea Mannocci
33
var permanotice;
34

    
35
function showPermanotice(message) {
36
	if (permanotice == null) {
37
		permanotice = $.pnotify({
38
			title : 'Warning!',
39
			text : message,
40
			nonblock : true,
41
			hide : false,
42
			closer : false,
43
			sticker : false,
44
			history: false
45
		});
46
	}
47
}
48

    
49
function hidePermanotice() {
50
	if (permanotice) {
51
		permanotice.pnotify_remove();
52
		permanotice = null;
53
	}
54
}
55

    
56
function probePermanotice() {
57
	return (permanotice)?true:false;
58
}
59

    
60
// Spinner show/hide methods ~ Andrea Mannocci
61
var spinnerOpts;
62
var spinnerTarget;
63
var spinner;
64

    
65
function initSpinner() {
66
	spinnerOpts = {
67
			lines: 15,
68
			length: 16,
69
			width: 5,
70
			radius: 25,
71
			color: '#eeeeee',
72
			className: 'spinner',
73
			top: '40%'
74
		};
75
	spinnerTarget = document.getElementById('spinnerdiv');
76
}
77

    
78
function showSpinner() {
79
	spinner = new Spinner(spinnerOpts).spin(spinnerTarget);
80
	spinnerTarget.style.visibility = 'visible';
81
}
82

    
83
function hideSpinner()  {
84
	spinnerTarget.style.visibility = 'hidden';
85
	spinner.stop();
86
}
(10-10/31)