(xmlTvFile, currentXmlTvId)
| 1816 | return [container, input, datalist]; |
| 1817 | } |
| 1818 | newM3uPicker(xmlTvFile, currentXmlTvId) { |
| 1819 | const container = document.createElement('div'); |
| 1820 | const input = document.createElement('input'); |
| 1821 | input.setAttribute('type', 'text'); |
| 1822 | // Initially, set value to '-' if input is empty |
| 1823 | input.value = (currentXmlTvId) ? currentXmlTvId : '-'; |
| 1824 | // When input is focused, remove '-' from it |
| 1825 | input.addEventListener('focus', (evt) => { |
| 1826 | const target = evt.target; |
| 1827 | target.value = (target.value === '-') ? '' : target.value; |
| 1828 | }); |
| 1829 | // When input lose focus or take a value, if it's empty, set value to '-' |
| 1830 | input.addEventListener('blur', setFallbackValue); |
| 1831 | input.addEventListener('change', setFallbackValue); |
| 1832 | function setFallbackValue(evt) { |
| 1833 | const target = evt.target; |
| 1834 | target.value = (target.value) ? target.value : '-'; |
| 1835 | } |
| 1836 | container.appendChild(input); |
| 1837 | const datalist = document.createElement('datalist'); |
| 1838 | const option = document.createElement('option'); |
| 1839 | option.setAttribute('value', '-'); |
| 1840 | option.innerText = '-'; |
| 1841 | datalist.appendChild(option); |
| 1842 | const m3u = SERVER['xepg']['epgMapping']; |
| 1843 | if (m3u) { |
| 1844 | const programIds = getOwnObjProps(m3u); |
| 1845 | programIds.forEach((programId) => { |
| 1846 | const chanel = m3u[programId]; |
| 1847 | if (chanel.hasOwnProperty('tvg-name')) { |
| 1848 | const option = document.createElement('option'); |
| 1849 | option.setAttribute('value', chanel["tvg-name"]); |
| 1850 | option.innerText = programId; |
| 1851 | datalist.appendChild(option); |
| 1852 | } |
| 1853 | else { |
| 1854 | const option = document.createElement('option'); |
| 1855 | option.setAttribute('value', chanel["tvg-name"]); |
| 1856 | option.innerText = '-'; |
| 1857 | datalist.appendChild(option); |
| 1858 | } |
| 1859 | }); |
| 1860 | } |
| 1861 | container.appendChild(datalist); |
| 1862 | return [container, input, datalist]; |
| 1863 | } |
| 1864 | getPrograms(file, set, active) { |
| 1865 | //var fileIDs:string[] = getObjKeys(SERVER["xepg"]["xmltvMap"]) |
| 1866 | var values = getObjKeys(SERVER["xepg"]["xmltvMap"][file]); |
no test coverage detected