|
1 | 1 | <script> |
2 | 2 | $(function(){ |
3 | | - // Ticket List: Change ticket agent |
| 3 | +
|
| 4 | +
|
| 5 | + // Ticket List: Change ticket agent |
4 | 6 | $('#tickets-table').on('draw.dt', function(e){ |
| 7 | + @if ($ticketList == 'newest' && $setting->grab('newest_list_reload_seconds')) |
| 8 | +
|
| 9 | + var modal_countdown = ({{ $setting->grab('newest_list_reload_seconds') }} - 5)*1000; |
| 10 | +
|
| 11 | + setTimeout(function(){ $('#modal-page-reload').modal('show'); }, modal_countdown); |
| 12 | + var reload_secs = 6; |
| 13 | + var page_reload = ""; |
| 14 | +
|
| 15 | + $('#modal-page-reload').on('show.bs.modal', function () { |
| 16 | +
|
| 17 | + $('#modal-page-reload #text_countdown').show(); |
| 18 | + $('#modal-page-reload #text_reloading').hide(); |
| 19 | +
|
| 20 | + $('#modal-page-reload #counter').text(reload_secs-1); |
| 21 | +
|
| 22 | + // Update the count down every 1 second |
| 23 | + page_reload = setInterval(function() { |
| 24 | + reload_secs = reload_secs - 1; |
| 25 | +
|
| 26 | + // Output the result in an element with id="demo" |
| 27 | + $('#modal-page-reload #counter').text(reload_secs); |
| 28 | +
|
| 29 | + // If the count down is over, write some text |
| 30 | + if (reload_secs == 0) { |
| 31 | + $('#modal-page-reload #text_countdown').hide(); |
| 32 | + $('#modal-page-reload #text_reloading').show(); |
| 33 | + clearInterval(page_reload); |
| 34 | + window.location.reload(false); |
| 35 | + } |
| 36 | + }, 1000); |
| 37 | + }); |
| 38 | +
|
| 39 | + $('#modal-page-reload').on('hidden.bs.modal', function () { |
| 40 | + clearInterval(page_reload); |
| 41 | +
|
| 42 | + setTimeout(function(){ $('#modal-page-reload').modal('show'); }, modal_countdown); |
| 43 | + page_reload = ""; |
| 44 | + reload_secs = 6; |
| 45 | + }); |
| 46 | +
|
| 47 | + $('#modal-page-reload #confirm').click(function(e){ |
| 48 | + $('#modal-page-reload #text_countdown').hide(); |
| 49 | + $('#modal-page-reload #text_reloading').show(); |
| 50 | + window.location.reload(false); |
| 51 | + }); |
| 52 | + @endif |
5 | 53 |
|
6 | 54 | // Plus / less buttons for text fields |
7 | 55 | $('.jquery_ticket_text_toggle').click(function(e){ |
|
0 commit comments