Conditions | 1 |
Paths | 1 |
Total Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | (function ($, app) { |
||
2 | 'use strict'; |
||
3 | |||
4 | $.extend(app, { |
||
5 | PJAX_MODAL_SELECTOR: '#pjaxModal', |
||
6 | PJAX_MODAL_CONTAINER: 'modal' |
||
7 | }); |
||
8 | |||
9 | $(function () { |
||
10 | $(app.PJAX_MODAL_SELECTOR) |
||
11 | .on('pjax:send', onModalPjaxSend) |
||
12 | .on('hidden.bs.modal', function () { |
||
13 | $(this).find('.modal-content').html(''); |
||
14 | }); |
||
15 | }); |
||
16 | |||
17 | $(document).on('pjax:beforeSend', closeModalIfNeeded); |
||
18 | |||
19 | function closeModalIfNeeded(xhr, options, settings) { |
||
20 | // надо ли закрывать модальное окно после завершения запроса? |
||
21 | var $modal = $(app.PJAX_MODAL_SELECTOR), |
||
22 | closeModal; |
||
23 | |||
24 | closeModal = settings.target != app.PJAX_MODAL_CONTAINER; |
||
25 | // закрываем модальное окно |
||
26 | if (closeModal) { |
||
27 | $modal.modal('hide'); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | function onModalPjaxSend(event, xhr, options) { |
||
32 | $(app.PJAX_MODAL_SELECTOR) |
||
33 | .modal('show') |
||
34 | .find('[data-pjax-container="' + app.PJAX_MODAL_CONTAINER + '"]') |
||
35 | .data(app.PJAX_REDIRECT_TARGET_PARAMETER, options.redirectTarget); |
||
36 | } |
||
37 | |||
38 | })(jQuery, application); |
||
|
|||
39 |
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.