1
|
|
|
/** |
2
|
|
|
* The settings notifier class is used to display notifications in admin settings |
3
|
|
|
* pages. |
4
|
|
|
*/ |
5
|
|
|
Amarkal.settings.notifier = { |
|
|
|
|
6
|
|
|
classes: ['error','success','notice','info'], |
7
|
|
|
prefix: 'amarkal-', |
8
|
|
|
timeout: null, |
9
|
|
|
$el: null, |
10
|
|
|
notify: function(type, message, delay) { |
11
|
|
|
|
12
|
|
|
clearTimeout(Amarkal.settings.notifier.timeout); |
|
|
|
|
13
|
|
|
|
14
|
|
|
Amarkal.settings.notifier.$el |
15
|
|
|
.removeAttr('class') |
16
|
|
|
.addClass(Amarkal.settings.notifier.prefix+type) |
17
|
|
|
.html('<p>'+message+'</p>'); |
18
|
|
|
|
19
|
|
|
if(typeof delay !== "undefined") { |
20
|
|
|
Amarkal.settings.notifier.timeout = setTimeout(function(){ |
21
|
|
|
Amarkal.settings.notifier.clearNotifications(); |
|
|
|
|
22
|
|
|
},delay); |
23
|
|
|
} |
24
|
|
|
}, |
25
|
|
|
error: function(message, delay) { |
26
|
|
|
Amarkal.settings.notifier.notify('error', message, delay); |
|
|
|
|
27
|
|
|
}, |
28
|
|
|
success: function(message, delay) { |
29
|
|
|
Amarkal.settings.notifier.notify('success', message, delay); |
|
|
|
|
30
|
|
|
}, |
31
|
|
|
notice: function(message, delay) { |
32
|
|
|
Amarkal.settings.notifier.notify('notice', message, delay); |
|
|
|
|
33
|
|
|
}, |
34
|
|
|
info: function(message, delay) { |
35
|
|
|
Amarkal.settings.notifier.notify('info', message, delay); |
|
|
|
|
36
|
|
|
}, |
37
|
|
|
clearNotifications: function() { |
38
|
|
|
clearTimeout(this.timeout); |
39
|
|
|
this.$el.removeAttr('class').html(''); |
40
|
|
|
}, |
41
|
|
|
init: function() { |
42
|
|
|
this.$el = $('#amarkal-settings-notices'); |
43
|
|
|
} |
44
|
|
|
}; |
45
|
|
|
|
46
|
|
|
$(document).ready(function(){ |
47
|
|
|
Amarkal.settings.notifier.init(); |
|
|
|
|
48
|
|
|
}); |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.