1(function($) { 2 3 $(document).ready(function() { 4 //start listener for cookie bar open 5 UMGGR_Cookie_Positioner_Module.init(); 6 }); 7 8 /** 9 * ID of the cookie bar element 10 * @type {string} 11 */ 12 UMGGR_Cookie_Positioner_Module.cookie_bar_id = "_evidon_banner"; 13 14 /** 15 * Counter for JS interval (Cookie Open waiter) 16 * @type {number} 17 */ 18 UMGGR_Cookie_Positioner_Module.interval_cookie_open_count = 0; 19 20 /** 21 * Check if cookie bar is currently visible and hasn't yet been closed by user 22 * 23 * @return bool 24 */ 25 UMGGR_Cookie_Positioner_Module.is_cookie_bar_visible = function() { 26 var cookie_bar = $('#' + UMGGR_Cookie_Positioner_Module.cookie_bar_id); 27 28 return cookie_bar.length; 29 }; 30 31 /** 32 * Init cookie bar positioner module 33 */ 34 UMGGR_Cookie_Positioner_Module.init = function() { 35 //check if style functions exist from layouts before starting 36 if(typeof UMGGR_Cookie_Positioner_Module.action_cookie_open !== 'undefined') { 37 UMGGR_Cookie_Positioner_Module.listen_for_cookie_bar_open(); 38 39 //listen out for window resize and update style accordingly 40 $(window).resize(function () { 41 if(UMGGR_Cookie_Positioner_Module.is_cookie_bar_visible()) { 42 UMGGR_Cookie_Positioner_Module.action_cookie_open(); 43 } 44 }); 45 } 46 }; 47 48 /** 49 * Listen when cookie bar opens up 50 */ 51 UMGGR_Cookie_Positioner_Module.listen_for_cookie_bar_open = function() { 52 53 /** 54 * create and run interval that checks when the cookie bar has opened 55 * give up after 25 seconds of trying 56 */ 57 UMGGR_Cookie_Positioner_Module.interval_cookie_open = setInterval(function() { 58 59 //check if cookie bar is visible 60 if(UMGGR_Cookie_Positioner_Module.is_cookie_bar_visible()) { 61 clearInterval(UMGGR_Cookie_Positioner_Module.interval_cookie_open); 62 63 UMGGR_Cookie_Positioner_Module.action_cookie_open(); 64 65 //start listener for cookie bar close 66 UMGGR_Cookie_Positioner_Module.listen_for_cookie_bar_close(); 67 return; 68 } 69 70 //count and clear interval if we have looped 50 times or more 71 UMGGR_Cookie_Positioner_Module.interval_cookie_open_count++; 72 if(UMGGR_Cookie_Positioner_Module.interval_cookie_open_count >= 50) { 73 clearInterval(UMGGR_Cookie_Positioner_Module.interval_cookie_open); 74 } 75 }, 500); 76 }; 77 78 /** 79 * Listen when cookie bar is closed 80 */ 81 UMGGR_Cookie_Positioner_Module.listen_for_cookie_bar_close = function() { 82 83 //check if style functions exist from layouts before starting 84 if(typeof UMGGR_Cookie_Positioner_Module.action_cookie_close !== 'undefined') { 85 86 /** 87 * create and run interval that checks when the cookie bar has closed 88 */ 89 UMGGR_Cookie_Positioner_Module.interval_cookie_close = setInterval(function () { 90 91 //check if cookie bar is visible 92 if (!UMGGR_Cookie_Positioner_Module.is_cookie_bar_visible()) { 93 94 clearInterval(UMGGR_Cookie_Positioner_Module.interval_cookie_close); 95 96 UMGGR_Cookie_Positioner_Module.action_cookie_close(); 97 98 return; 99 } 100 }, 500); 101 } 102 }; 103 104})(jQuery); 105 106
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.