dpt-admin.js
7 years ago
dpt.js
7 years ago
load-monthly-table.js
8 years ago
wp-color-picker.js
9 years ago
load-monthly-table.js
78 lines
| 1 | |
| 2 | jQuery(document).ready(function() { |
| 3 | |
| 4 | //hover states on the static widgets |
| 5 | jQuery('#dialog_link, ul#icons li').hover( |
| 6 | function() { jQuery(this).addClass('ui-state-hover'); }, |
| 7 | function() { jQuery(this).removeClass('ui-state-hover'); } |
| 8 | ); |
| 9 | |
| 10 | jQuery('#monthAjax').on('change', '#month', function() { |
| 11 | jQuery.blockUI({ |
| 12 | timeout: 1000, |
| 13 | }); |
| 14 | var display = jQuery('#display').val(); |
| 15 | var month = this.value; |
| 16 | jQuery.ajax({ |
| 17 | url: timetable_params.ajaxurl, |
| 18 | data: { |
| 19 | 'action':'get_monthly_timetable', |
| 20 | 'month' : month, |
| 21 | 'display': display |
| 22 | }, |
| 23 | success: function(response){ |
| 24 | jQuery('#monthlyTimetable').html(response); |
| 25 | }, |
| 26 | error: function(errorThrown){ |
| 27 | alert(JSON.stringify(errorThrown)); |
| 28 | } |
| 29 | }); |
| 30 | }); |
| 31 | |
| 32 | jQuery('#month').trigger('change'); |
| 33 | |
| 34 | jQuery("input").on('change', function() { |
| 35 | jQuery(this).css("background-color","#F6F8CE"); |
| 36 | }); |
| 37 | }); |
| 38 | |
| 39 | |
| 40 | function printDiv(divName) { |
| 41 | var printContents = document.getElementById(divName).innerHTML; |
| 42 | var originalContents = document.body.innerHTML; |
| 43 | |
| 44 | document.body.innerHTML = printContents; |
| 45 | |
| 46 | window.print(); |
| 47 | |
| 48 | document.body.innerHTML = originalContents; |
| 49 | } |
| 50 | |
| 51 | function startTimer() { |
| 52 | var presentTime = ''; |
| 53 | if (document.getElementsByClassName('timeLeftCountDown')[0]) { |
| 54 | presentTime = document.getElementsByClassName('timeLeftCountDown')[0].innerHTML.trim(); |
| 55 | presentTime = presentTime.split(' ')[0]; |
| 56 | var timeArray = presentTime.split(/[:]+/); |
| 57 | if (timeArray && timeArray.length === 2) { |
| 58 | var m = timeArray[0]; |
| 59 | var s = checkSecond((timeArray[1] - 1)); |
| 60 | if(s==59){m=m-1} |
| 61 | document.getElementsByClassName('timeLeftCountDown')[0].innerHTML = |
| 62 | m + ":" + s; |
| 63 | setTimeout(startTimer, 1000); |
| 64 | if(m == 0 && s == 0) { |
| 65 | document.getElementsByClassName('timeLeftCountDown')[0].innerHTML = ""; |
| 66 | location.reload(); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | function checkSecond(sec) { |
| 73 | if (sec < 10 && sec >= 0) {sec = "0" + sec}; // add zero in front of numbers < 10 |
| 74 | if (sec < 0) {sec = "59"}; |
| 75 | return sec; |
| 76 | } |
| 77 | |
| 78 | startTimer(); |