1$(function uil_init_mo_calendar() { 2 3 function parse_date(str) { 4 var t = str.match(/^(\d{2})\.(\d{2})\.(\d{4})$/); 5 if (t !== null) { 6 var d = +t[1], m = +t[2], y = +t[3]; 7 var date = new Date(y, m - 1, d); 8 if (date.getFullYear() === y && date.getMonth() === m - 1) { 9 return true; 10 } 11 } 12 return false; 13 } 14 15 function action_manual($form) { 16 var val = $form.find('input[type="text"]').val(); 17 var tmpl = decodeURI($form.attr('data-action')); 18 if (tmpl && val && parse_date(val)) 19 location.href = tmpl.replace('<date>', val); 20 return false; 21 } 22 23 function init($cal_parent) { 24 $cal_parent 25 .on('click', '.uil-mo-calendar__navigation__date__item_year a', function () { 26 var $this = $(this); 27 var $cal = $this.closest('.uil-mo-calendar'); 28 $cal.find('.uil-mo-calendar__year-list').addClass('show'); 29 return false; 30 }) 31 .on('click', '.uil-mo-calendar__navigation__date__item_month a', function () { 32 var $this = $(this); 33 var $cal = $this.closest('.uil-mo-calendar'); 34 $cal.find('.uil-mo-calendar__month-list').addClass('show'); 35 return false; 36 }) 37 .on('mouseleave', '.uil-mo-calendar__year-list, .uil-mo-calendar__month-list', function () { 38 $(this) 39 .closest('.uil-mo-calendar') 40 .find('.uil-mo-calendar__year-list, .uil-mo-calendar__month-list') 41 .removeClass('show'); 42 }) 43 .on('click', '.uil-mo-calendar__year-list__close, .uil-mo-calendar__month-list__close', function () { 44 $(this) 45 .closest('.uil-mo-calendar') 46 .find('.uil-mo-calendar__year-list, .uil-mo-calendar__month-list') 47 .removeClass('show'); 48 }) 49 .on('click', '.uil-mo-calendar td.is-active', function () { 50 $(this).find('a')[0].click(); 51 }) 52 .on('click', '.uil-mo-calendar__manual__submit', function () { 53 return action_manual($(this).closest('.uil-mo-calendar__manual').find('.uil-mo-calendar__manual__form')); 54 }) 55 .on('submit', '.uil-mo-calendar__manual__form', function () { 56 return action_manual($(this).closest('.uil-mo-calendar__manual__form')); 57 }); 58 } 59 60 $('.uil-mo-calendar').each(function () { 61 init($(this).parent()); 62 }); 63 64 $('*[data-mo-calendar]').each(function () { 65 init($(this)); 66 }); 67 68});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.