Total Complexity | 9 |
Complexity/F | 3 |
Lines of Code | 44 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | $(document).ready(function() { |
||
2 | $(document).on('mousedown', '.confirmable', function(e) { |
||
3 | var button = $(e.target); |
||
4 | |||
5 | e.preventDefault(); |
||
6 | e.stopPropagation(); |
||
7 | e.stopImmediatePropagation(); |
||
8 | |||
9 | var title = typeof button.attr('data-confirm-text') == !'undefined' ? button.attr('data-confirm-text') : "Confirmez-vous l'action ?"; |
||
10 | |||
11 | bootbox.confirm({ |
||
|
|||
12 | message: title, |
||
13 | buttons: { |
||
14 | confirm: { |
||
15 | label: 'Oui', |
||
16 | className: 'btn-success' |
||
17 | }, |
||
18 | cancel: { |
||
19 | label: 'Non', |
||
20 | className: 'btn-danger' |
||
21 | } |
||
22 | }, |
||
23 | callback: function(result) { |
||
24 | if (result === true) { |
||
25 | var action = button.attr('data-confirm-action'); |
||
26 | |||
27 | switch (action) { |
||
28 | case 'followHref': |
||
29 | default: |
||
30 | window.location.href = button.attr('href'); |
||
31 | break; |
||
32 | case 'callAction': |
||
33 | var functionName = button.attr('data-confirm-function'); |
||
34 | functionName(button); |
||
35 | break; |
||
36 | case 'triggerClick': |
||
37 | button[0].click(); |
||
38 | break; |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 | }); |
||
43 | }); |
||
44 | }); |
||
45 |
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.