1$(window).on('load', function uil_init_notice() { 2 if (window.INOVA_NOTICE_DATA !== undefined) { 3 4 var DATA = INOVA_NOTICE_DATA, 5 DATA_LOCAL = localStorage.getItem('inova_notice'), 6 HOLD_LIMIT = 5 * 60 * 1000, 7 current_notice = '', 8 sorted_keys = [], 9 sorted_ind = 0; 10 11 DATA_LOCAL = DATA_LOCAL ? JSON.parse(DATA_LOCAL) : {}; 12 13 14 $.each(DATA, function (index, value) { 15 value.status = 'ready'; 16 sorted_keys[sorted_ind] = index; 17 if (DATA_LOCAL[index]) { 18 value.status = DATA_LOCAL[index].status; 19 value.date = DATA_LOCAL[index].date; 20 } 21 sorted_ind++; // += 1; 22 }); 23 24 $.each(sorted_keys, function (sort, index) { 25 var is_page_fits = false, 26 address_list = DATA[index]['address_list']; 27 for (var i = 0; i < address_list.length; i++) { 28 var page = address_list[i]; 29 if (location.href.indexOf(page) > -1) { 30 is_page_fits = true; 31 break; 32 } 33 } 34 if (is_page_fits && (DATA[index].status === 'ready' || (DATA[index].status === 'closed' && Date.now() > DATA[index].date))) { 35 current_notice = index; 36 set_show_handlers(index); 37 return false; 38 } 39 }); 40 41 $(document).one('inova_popup.hide:after', function () { 42 set_notice_status(current_notice, 'closed'); 43 }); 44 45 $(document).on('inova_popup.set_html:after', function () { 46 var $notice = inova_popup.content.find('.uil-notice'); 47 if ($notice.length) { 48 $notice.find('.uil-form-controls-v2_name_link').click(function () { 49 inova_popup.hide(); 50 set_notice_status(current_notice, 'completed'); 51 }); 52 $notice.find('.uil-form-controls-v2_name_notshow').click(function () { 53 inova_popup.hide(); 54 set_notice_status(current_notice, 'notshow'); 55 }); 56 } 57 }); 58 59 function sync() { 60 localStorage.setItem('inova_notice', JSON.stringify(DATA)); 61 } 62 63 function show_notice(key) { 64 if (DATA[key].status === 'ready') { 65 inova_popup.set_url(DATA[key].url, ''); 66 set_notice_status(key, 'closed'); 67 } else if (DATA[key].status === 'closed' && Date.now() > DATA[key].date) { 68 inova_popup.set_url(DATA[key].url, ''); 69 set_notice_status(key, 'closed'); 70 } 71 } 72 73 function set_notice_status(key, status) { 74 DATA[key].status = status; 75 if (status === 'closed') 76 DATA[key].date = Date.now() + HOLD_LIMIT; 77 sync(); 78 } 79 80 function set_show_handlers(key) { 81 if (DATA[key].hold_to_scroll) { 82 $(window).on('scroll', $.debounce(500, scroll_handler)); 83 } 84 setTimeout(function () { 85 show_notice(key); 86 }, DATA[key].hold_limit * 1000); 87 } 88 89 function scroll_handler() { 90 if ($(window).scrollTop() + $(window).height() >= $(document).height() / 2) { 91 show_notice(current_notice); 92 $(window).off('scroll', scroll_handler); 93 } 94 } 95 96 sync(); 97 98 } 99});
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.