1function enableLocalTime() { 2 if(document.querySelectorAll('.session_times').length > 0) { 3 const time_containers = document.querySelectorAll('.session_times') 4 const date_containers = document.querySelectorAll('.session_date') 5 const timezone_label = document.getElementById('timezone-label') 6 7 function getValidOffset(time_container) { 8 const offset = time_container.getAttribute('data-gmt-offset') 9 10 if (offset && /^([+-])\d{2}:\d{2}$/.test(offset)) { 11 return offset 12 } 13 14 return '+00:00' 15 } 16 17 time_containers.forEach((time_container, i) => { 18 const end_time = time_container.getAttribute('data-end-time') 19 const start_time = time_container.getAttribute('data-start-time') 20 21 if(start_time != null && start_time.split('T')[1] != '') { 22 let offset = getValidOffset(time_container) 23 24 let formatted_start = moment(`${start_time}${offset}`).local().format('HH:mm') 25 let formatted_end = moment(`${end_time}${offset}`).local().format('HH:mm') 26 27 time_container.innerText = `${formatted_start}-${formatted_end}` 28 29 if (date_containers[i]) { 30 date_containers[i].innerHTML = moment(`${start_time}${offset}`).local().format('ddd MMM D') 31 } 32 } 33 }) 34 35 my_time_btn = window.document.getElementsByClassName('tab-1')[0] 36 local_time_btn = window.document.getElementsByClassName('tab-2')[0] 37 38 if(my_time_btn && local_time_btn) { 39 clearInterval(localTimeInterval) 40 } else { 41 return 42 } 43 44 my_time_btn.addEventListener('click', () => { 45 time_containers.forEach((time_container, i) => { 46 const end_time = time_container.getAttribute('data-end-time') 47 const start_time = time_container.getAttribute('data-start-time') 48 49 if(start_time != null && start_time.split('T')[1] != '') { 50 let offset = getValidOffset(time_container) 51 52 let formatted_start = moment(`${start_time}${offset}`).local().format('HH:mm') 53 let formatted_end = moment(`${end_time}${offset}`).local().format('HH:mm') 54 55 time_container.innerText = `${formatted_start}-${formatted_end}` 56 57 if (date_containers[i]) { 58 date_containers[i].innerHTML = moment(`${start_time}${offset}`).local().format('ddd MMM D') 59 } 60 } 61 }) 62 63 local_time_btn.classList.remove('active') 64 my_time_btn.classList.add('active') 65 66 if (timezone_label) { 67 timezone_label.innerText = 'your time' 68 } 69 }) 70 71 local_time_btn.addEventListener('click', () => { 72 time_containers.forEach((time_container, i) => { 73 const end_time = time_container.getAttribute('data-end-time') 74 const start_time = time_container.getAttribute('data-start-time') 75 76 if(start_time != null && start_time.split('T')[1] != '') { 77 let formatted_start = moment(start_time).format('HH:mm') 78 let formatted_end = moment(end_time).format('HH:mm') 79 80 time_container.innerText = `${formatted_start}-${formatted_end}` 81 82 if (date_containers[i]) { 83 date_containers[i].innerHTML = moment(`${start_time}`).format('ddd MMM D') 84 } 85 } 86 }) 87 88 my_time_btn.classList.remove('active') 89 local_time_btn.classList.add('active') 90 91 if (timezone_label) { 92 timezone_label.innerText = 'local time' 93 } 94 }) 95 } 96} 97 98const localTimeInterval = setInterval(enableLocalTime, 1000)
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.