';
- var currentType;
+ let currentType;
- for (var i = 0, length = profiles.length; i < length; i++) {
- var profile = profiles[i];
+ for (let i = 0, length = profiles.length; i < length; i++) {
+ const profile = profiles[i];
if (profile.Type !== currentType) {
html += '
';
- var elem = $('.directPlayProfiles', page).html(html).trigger('create');
+ const elem = $('.directPlayProfiles', page).html(html).trigger('create');
$('.btnDeleteProfile', elem).on('click', function () {
- var index = this.getAttribute('data-profileindex');
+ const index = this.getAttribute('data-profileindex');
deleteDirectPlayProfile(page, index);
});
$('.lnkEditSubProfile', elem).on('click', function () {
- var index = parseInt(this.getAttribute('data-profileindex'));
+ const index = parseInt(this.getAttribute('data-profileindex'));
editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]);
});
}
@@ -295,7 +303,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
isSubProfileNew = null == directPlayProfile;
directPlayProfile = directPlayProfile || {};
currentSubProfile = directPlayProfile;
- var popup = $('#popupEditDirectPlayProfile', page);
+ const popup = $('#popupEditDirectPlayProfile', page);
$('#selectDirectPlayProfileType', popup).val(directPlayProfile.Type || 'Video').trigger('change');
$('#txtDirectPlayContainer', popup).val(directPlayProfile.Container || '');
$('#txtDirectPlayAudioCodec', popup).val(directPlayProfile.AudioCodec || '');
@@ -304,12 +312,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
}
function renderTranscodingProfiles(page, profiles) {
- var html = '';
+ let html = '';
html += '
';
- var currentType;
+ let currentType;
- for (var i = 0, length = profiles.length; i < length; i++) {
- var profile = profiles[i];
+ for (let i = 0, length = profiles.length; i < length; i++) {
+ let profile = profiles[i];
if (profile.Type !== currentType) {
html += '
';
- var elem = $('.transcodingProfiles', page).html(html).trigger('create');
+ const elem = $('.transcodingProfiles', page).html(html).trigger('create');
$('.btnDeleteProfile', elem).on('click', function () {
- var index = this.getAttribute('data-profileindex');
+ const index = this.getAttribute('data-profileindex');
deleteTranscodingProfile(page, index);
});
$('.lnkEditSubProfile', elem).on('click', function () {
- var index = parseInt(this.getAttribute('data-profileindex'));
+ const index = parseInt(this.getAttribute('data-profileindex'));
editTranscodingProfile(page, currentProfile.TranscodingProfiles[index]);
});
}
@@ -351,7 +359,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
isSubProfileNew = null == transcodingProfile;
transcodingProfile = transcodingProfile || {};
currentSubProfile = transcodingProfile;
- var popup = $('#transcodingProfilePopup', page);
+ const popup = $('#transcodingProfilePopup', page);
$('#selectTranscodingProfileType', popup).val(transcodingProfile.Type || 'Video').trigger('change');
$('#txtTranscodingContainer', popup).val(transcodingProfile.Container || '');
$('#txtTranscodingAudioCodec', popup).val(transcodingProfile.AudioCodec || '');
@@ -390,12 +398,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
}
function renderContainerProfiles(page, profiles) {
- var html = '';
+ let html = '';
html += '
';
- var currentType;
+ let currentType;
- for (var i = 0, length = profiles.length; i < length; i++) {
- var profile = profiles[i];
+ for (let i = 0, length = profiles.length; i < length; i++) {
+ let profile = profiles[i];
if (profile.Type !== currentType) {
html += '
';
- var elem = $('.containerProfiles', page).html(html).trigger('create');
+ const elem = $('.containerProfiles', page).html(html).trigger('create');
$('.btnDeleteProfile', elem).on('click', function () {
- var index = this.getAttribute('data-profileindex');
+ const index = this.getAttribute('data-profileindex');
deleteContainerProfile(page, index);
});
$('.lnkEditSubProfile', elem).on('click', function () {
- var index = parseInt(this.getAttribute('data-profileindex'));
+ const index = parseInt(this.getAttribute('data-profileindex'));
editContainerProfile(page, currentProfile.ContainerProfiles[index]);
});
}
@@ -440,7 +448,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
isSubProfileNew = null == containerProfile;
containerProfile = containerProfile || {};
currentSubProfile = containerProfile;
- var popup = $('#containerProfilePopup', page);
+ const popup = $('#containerProfilePopup', page);
$('#selectContainerProfileType', popup).val(containerProfile.Type || 'Video').trigger('change');
$('#txtContainerProfileContainer', popup).val(containerProfile.Container || '');
$('.radioTabButton:first', popup).trigger('click');
@@ -461,13 +469,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
}
function renderCodecProfiles(page, profiles) {
- var html = '';
+ let html = '';
html += '
';
- var currentType;
+ let currentType;
- for (var i = 0, length = profiles.length; i < length; i++) {
- var profile = profiles[i];
- var type = profile.Type.replace('VideoAudio', 'Video Audio');
+ for (let i = 0, length = profiles.length; i < length; i++) {
+ let profile = profiles[i];
+ const type = profile.Type.replace('VideoAudio', 'Video Audio');
if (type !== currentType) {
html += '
';
- var elem = $('.codecProfiles', page).html(html).trigger('create');
+ const elem = $('.codecProfiles', page).html(html).trigger('create');
$('.btnDeleteProfile', elem).on('click', function () {
- var index = this.getAttribute('data-profileindex');
+ const index = this.getAttribute('data-profileindex');
deleteCodecProfile(page, index);
});
$('.lnkEditSubProfile', elem).on('click', function () {
- var index = parseInt(this.getAttribute('data-profileindex'));
+ const index = parseInt(this.getAttribute('data-profileindex'));
editCodecProfile(page, currentProfile.CodecProfiles[index]);
});
}
@@ -512,7 +520,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
isSubProfileNew = null == codecProfile;
codecProfile = codecProfile || {};
currentSubProfile = codecProfile;
- var popup = $('#codecProfilePopup', page);
+ const popup = $('#codecProfilePopup', page);
$('#selectCodecProfileType', popup).val(codecProfile.Type || 'Video').trigger('change');
$('#txtCodecProfileCodec', popup).val(codecProfile.Codec || '');
$('.radioTabButton:first', popup).trigger('click');
@@ -533,12 +541,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
}
function renderResponseProfiles(page, profiles) {
- var html = '';
+ let html = '';
html += '
';
- var currentType;
+ let currentType;
- for (var i = 0, length = profiles.length; i < length; i++) {
- var profile = profiles[i];
+ for (let i = 0, length = profiles.length; i < length; i++) {
+ const profile = profiles[i];
if (profile.Type !== currentType) {
html += '
';
- var elem = $('.mediaProfiles', page).html(html).trigger('create');
+ const elem = $('.mediaProfiles', page).html(html).trigger('create');
$('.btnDeleteProfile', elem).on('click', function () {
- var index = this.getAttribute('data-profileindex');
+ const index = this.getAttribute('data-profileindex');
deleteResponseProfile(page, index);
});
$('.lnkEditSubProfile', elem).on('click', function () {
- var index = parseInt(this.getAttribute('data-profileindex'));
+ const index = parseInt(this.getAttribute('data-profileindex'));
editResponseProfile(page, currentProfile.ResponseProfiles[index]);
});
}
@@ -592,7 +600,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
isSubProfileNew = null == responseProfile;
responseProfile = responseProfile || {};
currentSubProfile = responseProfile;
- var popup = $('#responseProfilePopup', page);
+ const popup = $('#responseProfilePopup', page);
$('#selectResponseProfileType', popup).val(responseProfile.Type || 'Video').trigger('change');
$('#txtResponseProfileContainer', popup).val(responseProfile.Container || '');
$('#txtResponseProfileAudioCodec', popup).val(responseProfile.AudioCodec || '');
@@ -618,7 +626,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
function saveProfile(page, profile) {
updateProfile(page, profile);
- var id = getParameterByName('id');
+ const id = getParameterByName('id');
if (id) {
ApiClient.ajax({
@@ -627,7 +635,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
data: JSON.stringify(profile),
contentType: 'application/json'
}).then(function () {
- require(['toast'], function (toast) {
+ import('toast').then(({default: toast}) => {
toast('Settings saved.');
});
}, Dashboard.processErrorResponse);
@@ -687,18 +695,18 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
profile.UserId = $('#selectUser', page).val();
}
- var currentProfile;
- var currentSubProfile;
- var isSubProfileNew;
- var allText = globalize.translate('LabelAll');
+ let currentProfile;
+ let currentSubProfile;
+ let isSubProfileNew;
+ const allText = globalize.translate('LabelAll');
$(document).on('pageinit', '#dlnaProfilePage', function () {
- var page = this;
+ const page = this;
$('.radioTabButton', page).on('click', function () {
$(this).siblings().removeClass('ui-btn-active');
$(this).addClass('ui-btn-active');
- var value = 'A' == this.tagName ? this.getAttribute('data-value') : this.value;
- var elem = $('.' + value, page);
+ const value = 'A' == this.tagName ? this.getAttribute('data-value') : this.value;
+ const elem = $('.' + value, page);
elem.siblings('.tabContent').hide();
elem.show();
});
@@ -783,7 +791,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
$('.xmlAttributeForm').off('submit', DlnaProfilePage.onXmlAttributeFormSubmit).on('submit', DlnaProfilePage.onXmlAttributeFormSubmit);
$('.subtitleProfileForm').off('submit', DlnaProfilePage.onSubtitleProfileFormSubmit).on('submit', DlnaProfilePage.onSubtitleProfileFormSubmit);
}).on('pageshow', '#dlnaProfilePage', function () {
- var page = this;
+ const page = this;
$('#radioInfo', page).trigger('click');
loadProfile(page);
});
@@ -826,4 +834,5 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
return false;
}
};
-});
+
+/* eslint-enable indent */
diff --git a/src/controllers/dashboard/dlna/profiles.js b/src/controllers/dashboard/dlna/profiles.js
index fb4caadeb..510128be4 100644
--- a/src/controllers/dashboard/dlna/profiles.js
+++ b/src/controllers/dashboard/dlna/profiles.js
@@ -1,5 +1,11 @@
-define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-button'], function ($, globalize, loading, libraryMenu) {
- 'use strict';
+import $ from 'jQuery';
+import globalize from 'globalize';
+import loading from 'loading';
+import libraryMenu from 'libraryMenu';
+import 'listViewStyle';
+import 'emby-button';
+
+/* eslint-disable indent */
function loadProfiles(page) {
loading.show();
@@ -23,14 +29,14 @@ define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-
}
function renderProfiles(page, element, profiles) {
- var html = '';
+ let html = '';
if (profiles.length) {
html += '
';
}
- for (var i = 0, length = profiles.length; i < length; i++) {
- var profile = profiles[i];
+ for (let i = 0, length = profiles.length; i < length; i++) {
+ let profile = profiles[i];
html += '