Total Complexity | 6 |
Complexity/F | 1.5 |
Lines of Code | 36 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | (function ($, app) { |
||
2 | 'use strict'; |
||
3 | |||
4 | $(document) |
||
5 | .on('pjax:send', showLoadingIndicators) |
||
6 | .on('pjax:error', hideLoadingIndicators) |
||
7 | .on('pjax:complete', hideLoadingIndicators) |
||
8 | .on('submit', showSubmitIndicators); |
||
9 | |||
10 | function showLoadingIndicators(event) { |
||
11 | if (event.isDefaultPrevented()) { |
||
12 | return; |
||
13 | } |
||
14 | var target = $(event.target).data('pjax-container'); |
||
15 | |||
16 | if (target == app.ROOT_CONTAINER_NAME) { |
||
17 | $('#ajax-loading').fadeIn(1000); |
||
18 | } else { |
||
19 | var loading = $('<div class="contentLoading"><div class="img"></div></div>'); |
||
20 | loading.hide(); |
||
21 | $(event.target).css('position', 'relative'); |
||
22 | $(event.target).append(loading); |
||
23 | loading.fadeIn(500); |
||
24 | } |
||
25 | } |
||
26 | |||
27 | function hideLoadingIndicators(event) { |
||
|
|||
28 | $('#ajax-loading').fadeOut(100); |
||
29 | $('.contentLoading').fadeOut(100); |
||
30 | $(document).find('button[data-loading-text]').button('reset'); |
||
31 | } |
||
32 | |||
33 | function showSubmitIndicators(event) { |
||
34 | $form.find('button[data-loading-text]').button('loading'); |
||
35 | } |
||
36 | })(jQuery, application); |
||
37 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.