assets/js/src/notifier.js   A
last analyzed

Complexity

Total Complexity 10
Complexity/F 1.11

Size

Lines of Code 44
Function Count 9

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 44
rs 10
wmc 10
mnd 1
bc 10
fnc 9
bpm 1.1111
cpm 1.1111
noi 8

8 Functions

Rating   Name   Duplication   Size   Complexity  
A Amarkal.settings.notifier.notify 0 15 2
A Amarkal.settings.notifier.error 0 3 1
A Amarkal.settings.notifier.info 0 3 1
A Amarkal.settings.notifier.success 0 3 1
A Amarkal.settings.notifier.notice 0 3 1
A Amarkal.settings.notifier.init 0 3 1
A Amarkal.settings.notifier.clearNotifications 0 4 1
A $(document).ready 0 3 1
1
/**
2
 * The settings notifier class is used to display notifications in admin settings
3
 * pages. 
4
 */
5
Amarkal.settings.notifier = {
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
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);
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
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();
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
22
            },delay);
23
        }
24
    },
25
    error: function(message, delay) {
26
        Amarkal.settings.notifier.notify('error', message, delay);
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
27
    },
28
    success: function(message, delay) {
29
        Amarkal.settings.notifier.notify('success', message, delay);
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
30
    },
31
    notice: function(message, delay) {
32
        Amarkal.settings.notifier.notify('notice', message, delay);
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
33
    },
34
    info: function(message, delay) {
35
        Amarkal.settings.notifier.notify('info', message, delay);
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
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();
0 ignored issues
show
Bug introduced by
The variable Amarkal seems to be never declared. If this is a global, consider adding a /** global: Amarkal */ comment.

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.

Loading history...
48
});