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
function showInfo(message) {
33
	show_notification("info", message);
34
}
35

    
36
function showError(message) {
37
	show_notification("error", message);
38
}
39

    
40
// Show/hide Pnotify permanent notification ~ Andrea Mannocci
41
var permanotice;
42

    
43
function showPermanotice(message) {
44
	if (permanotice == null) {
45
		permanotice = $.pnotify({
46
			title : 'Warning!',
47
			text : message,
48
			nonblock : true,
49
			hide : false,
50
			closer : false,
51
			sticker : false,
52
			history: false
53
		});
54
	}
55
}
56

    
57
function hidePermanotice() {
58
	if (permanotice) {
59
		permanotice.pnotify_remove();
60
		permanotice = null;
61
	}
62
}
63

    
64
function probePermanotice() {
65
	return (permanotice)?true:false;
66
}
67

    
68
// Spinner show/hide methods ~ Andrea Mannocci
69
var spinnerOpts;
70
var spinnerTarget;
71
var spinner;
72

    
73
function initSpinner() {
74
	spinnerOpts = {
75
			lines: 15,
76
			length: 16,
77
			width: 5,
78
			radius: 25,
79
			color: '#eeeeee',
80
			className: 'spinner',
81
			top: '40%'
82
		};
83
	spinnerTarget = document.getElementById('spinnerdiv');
84
}
85

    
86
function showSpinner() {
87
	spinner = new Spinner(spinnerOpts).spin(spinnerTarget);
88
	spinnerTarget.style.visibility = 'visible';
89
}
90

    
91
function hideSpinner()  {
92
	spinnerTarget.style.visibility = 'hidden';
93
	spinner.stop();
94
}
(11-11/34)