Issues (79)

templates/jalert/alert.js (2 issues)

1
jaxon.dialogs.jalert = {
0 ignored issues
show
The variable jaxon seems to be never declared. If this is a global, consider adding a /** global: jaxon */ 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...
2
    success: function(content, title = 'Success') {
3
        $.jAlert({content: content, title: title, theme: 'green'});
4
    },
5
    info: function(content, title = 'Information') {
6
        $.jAlert({content: content, title: title, theme: 'blue'});
7
    },
8
    warning: function(content, title = 'Warning') {
9
        $.jAlert({content: content, title: title, theme: 'yellow'});
10
    },
11
    error: function(content, title = 'Error') {
12
        $.jAlert({content: content, title: title, theme: 'red'});
13
    },
14
    confirm: function(question, title, yesCallback, noCallback) {
15
        if(noCallback === undefined)
16
            noCallback = function(){};
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
17
        $.jAlert({
18
            title: title,
19
            type: "confirm",
20
            confirmQuestion: question,
21
            confirmBtnText: "<?php echo $this->yes ?>",
22
            denyBtnText: "<?php echo $this->no ?>",
23
            onConfirm: yesCallback,
24
            onDeny: noCallback
25
        });
26
    }
27
};
28