Commit c8db8b573ea08f8e783c7da26354da23326bbbd2
1 parent
39118c58
zmienione wiatrakowanie
Showing
5 changed files
with
31 additions
and
31 deletions
media/js/common.js
... | ... | @@ -326,26 +326,6 @@ function interpret_hash(hash) { |
326 | 326 | old_hash = hash; |
327 | 327 | } |
328 | 328 | |
329 | -// busy | |
330 | - | |
331 | -var ctrl; | |
332 | - | |
333 | -common.busy_on = function() { | |
334 | - "use strict"; | |
335 | - if (!ctrl) { | |
336 | - ctrl = getBusyOverlay( | |
337 | - 'viewport', | |
338 | - {color: 'black', opacity: 0.5}, | |
339 | - {size: 100}); | |
340 | - } | |
341 | -}; | |
342 | - | |
343 | -common.busy_off = function() { | |
344 | - "use strict"; | |
345 | - if (ctrl) ctrl.remove(); | |
346 | - ctrl = null; | |
347 | -}; | |
348 | - | |
349 | 329 | |
350 | 330 | // skopiowane z http://jsfiddle.net/DkHyd/ |
351 | 331 | $.fn.togglepanels = function () { |
... | ... |
media/js/edit.js
... | ... | @@ -33,6 +33,26 @@ var edit = { |
33 | 33 | get_id: function get_id() { |
34 | 34 | "use strict"; |
35 | 35 | return parseInt($('#' + edit.form_id).find('[name="id"]').val(), 10); |
36 | + }, | |
37 | + | |
38 | + // busy | |
39 | + | |
40 | + busy_ctrl: null, | |
41 | + | |
42 | + busy_on: function() { | |
43 | + "use strict"; | |
44 | + if (!edit.busy_ctrl) { | |
45 | + edit.busy_ctrl = getBusyOverlay( | |
46 | + $('#right')[0], | |
47 | + {color: 'black', opacity: 0.2}, | |
48 | + {size: 30}); | |
49 | + } | |
50 | + }, | |
51 | + | |
52 | + busy_off: function() { | |
53 | + "use strict"; | |
54 | + if (edit.busy_ctrl) edit.busy_ctrl.remove(); | |
55 | + edit.busy_ctrl = null; | |
36 | 56 | } |
37 | 57 | }; |
38 | 58 | |
... | ... |
media/js/lexeme-edit.js
... | ... | @@ -385,7 +385,7 @@ edit.form_init = function() { |
385 | 385 | init_selection($('.inflection-characteristic')); |
386 | 386 | init_selection(new_owner_elem); |
387 | 387 | edit.hide_changed(); |
388 | - common.busy_off(); | |
388 | + edit.busy_off(); | |
389 | 389 | }; |
390 | 390 | |
391 | 391 | edit.form_submit = function () { |
... | ... | @@ -428,7 +428,7 @@ edit.form_submit = function () { |
428 | 428 | form_data.push({name: name, value: value}); |
429 | 429 | }); |
430 | 430 | form_data.push({name: 'classification_values', value: cvs}); |
431 | - common.busy_on(); | |
431 | + edit.busy_on(); | |
432 | 432 | var result = $.ajaxJSON({ |
433 | 433 | method: 'post', |
434 | 434 | url: $dj.ajax_update_lexeme, |
... | ... | @@ -444,15 +444,15 @@ edit.form_submit = function () { |
444 | 444 | }, |
445 | 445 | error_callback: function (xhr, status, error) { |
446 | 446 | common.error_alert(status + ': ' + error); |
447 | - common.busy_off(); | |
447 | + edit.busy_off(); | |
448 | 448 | }, |
449 | 449 | bad_data_callback: function () { |
450 | - common.busy_off(); | |
450 | + edit.busy_off(); | |
451 | 451 | return true; |
452 | 452 | } |
453 | 453 | }); |
454 | 454 | if (result === false) { |
455 | - common.busy_off(); | |
455 | + edit.busy_off(); | |
456 | 456 | } |
457 | 457 | return false; |
458 | 458 | }; |
... | ... |
media/js/pattern-edit.js
... | ... | @@ -66,7 +66,7 @@ $.extend(edit, { |
66 | 66 | edit.qualifier_select($('#ending-list').find('.qualifiers')); |
67 | 67 | deleted = []; |
68 | 68 | edit.hide_changed(); |
69 | - common.busy_off(); | |
69 | + edit.busy_off(); | |
70 | 70 | }, |
71 | 71 | |
72 | 72 | form_submit: function () { |
... | ... | @@ -96,7 +96,7 @@ $.extend(edit, { |
96 | 96 | ending_list.push({base_form_label: label, endings: endings}); |
97 | 97 | }); |
98 | 98 | form_data.push({name: 'ending_list', value: ending_list}); |
99 | - common.busy_on(); | |
99 | + edit.busy_on(); | |
100 | 100 | $.ajaxJSON({ |
101 | 101 | method: 'post', |
102 | 102 | url: $dj.ajax_update_pattern, |
... | ... | @@ -111,10 +111,10 @@ $.extend(edit, { |
111 | 111 | }, |
112 | 112 | error_callback: function (xhr, status, error) { |
113 | 113 | common.error_alert(status + ': ' + error); |
114 | - common.busy_off(); | |
114 | + edit.busy_off(); | |
115 | 115 | }, |
116 | 116 | bad_data_callback: function () { |
117 | - common.busy_off(); | |
117 | + edit.busy_off(); | |
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | }); |
... | ... |
media/js/slickgrid.js
... | ... | @@ -285,7 +285,7 @@ $(function() { |
285 | 285 | if (cell.row !== undefined) { |
286 | 286 | clearTimeout(timeout_handler); |
287 | 287 | timeout_handler = setTimeout(function() { |
288 | - common.busy_on(); | |
288 | + edit.busy_on(); | |
289 | 289 | slickgrid.load_content(slickgrid.active_id()); |
290 | 290 | }, 500); |
291 | 291 | } |
... | ... | @@ -336,7 +336,7 @@ $(function() { |
336 | 336 | if (row_to_set !== null) { |
337 | 337 | slickgrid.grid.setActiveCell(row_to_set, 0); |
338 | 338 | } else if (slickgrid.active_id() !== edit.get_id()) { |
339 | - common.busy_on(); | |
339 | + edit.busy_on(); | |
340 | 340 | slickgrid.load_content(slickgrid.active_id()); |
341 | 341 | } |
342 | 342 | }); |
... | ... |