diff --git a/src/components/tvproviders/schedulesdirect.js b/src/components/tvproviders/schedulesdirect.js index 9d60310e98..de469e1845 100644 --- a/src/components/tvproviders/schedulesdirect.js +++ b/src/components/tvproviders/schedulesdirect.js @@ -13,7 +13,7 @@ export default function (page, providerId, options) { function reload() { loading.show(); ApiClient.getNamedConfiguration('livetv').then(function (config) { - var info = config.ListingProviders.filter(function (i) { + const info = config.ListingProviders.filter(function (i) { return i.Id === providerId; })[0] || {}; listingsId = info.ListingsId; @@ -43,12 +43,12 @@ export default function (page, providerId, options) { function setCountry(info) { ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).then(function (result) { - var i; - var length; - var countryList = []; + let i; + let length; + const countryList = []; - for (var region in result) { - var countries = result[region]; + for (const region in result) { + const countries = result[region]; if (countries.length && region !== 'ZZZ') { for (i = 0, length = countries.length; i < length; i++) { @@ -88,20 +88,20 @@ export default function (page, providerId, options) { return Promise.resolve(''); } - var buffer = new TextEncoder('utf-8').encode(str); + const buffer = new TextEncoder('utf-8').encode(str); return crypto.subtle.digest('SHA-256', buffer).then(function (hash) { return hex(hash); }); } function hex(buffer) { - var hexCodes = []; - var view = new DataView(buffer); + const hexCodes = []; + const view = new DataView(buffer); - for (var i = 0; i < view.byteLength; i += 4) { - var value = view.getUint32(i); - var stringValue = value.toString(16); - var paddedValue = ('00000000' + stringValue).slice(-'00000000'.length); + for (let i = 0; i < view.byteLength; i += 4) { + const value = view.getUint32(i); + const stringValue = value.toString(16); + const paddedValue = ('00000000' + stringValue).slice(-'00000000'.length); hexCodes.push(paddedValue); } @@ -111,14 +111,14 @@ export default function (page, providerId, options) { function submitLoginForm() { loading.show(); sha256(page.querySelector('.txtPass').value).then(function (passwordHash) { - var info = { + const info = { Type: 'SchedulesDirect', Username: page.querySelector('.txtUser').value, EnableAllTuners: true, Password: passwordHash, Pw: page.querySelector('.txtPass').value }; - var id = providerId; + const id = providerId; if (id) { info.Id = id; @@ -145,7 +145,7 @@ export default function (page, providerId, options) { } function submitListingsForm() { - var selectedListingsId = $('#selectListing', page).val(); + const selectedListingsId = $('#selectListing', page).val(); if (!selectedListingsId) { return void Dashboard.alert({ @@ -154,9 +154,9 @@ export default function (page, providerId, options) { } loading.show(); - var id = providerId; + const id = providerId; ApiClient.getNamedConfiguration('livetv').then(function (config) { - var info = config.ListingProviders.filter(function (i) { + const info = config.ListingProviders.filter(function (i) { return i.Id === id; })[0]; info.ZipCode = page.querySelector('.txtZipCode').value; @@ -239,14 +239,14 @@ export default function (page, providerId, options) { } function refreshTunerDevices(page, providerInfo, devices) { - var html = ''; + let html = ''; - for (var i = 0, length = devices.length; i < length; i++) { - var device = devices[i]; + for (let i = 0, length = devices.length; i < length; i++) { + const device = devices[i]; html += '