1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

implement direct play profile edit

This commit is contained in:
Luke Pulverenti 2014-03-28 22:28:02 -04:00
parent 9c7cf7b686
commit f560b29837
2 changed files with 133 additions and 11 deletions

View file

@ -2,6 +2,9 @@
var currentProfile;
var currentSubProfile;
var isSubProfileNew;
function loadProfile(page) {
Dashboard.showLoadingMsg();
@ -60,6 +63,11 @@
profile.CodecProfiles = (profile.CodecProfiles || []);
profile.MediaProfiles = (profile.MediaProfiles || []);
renderSubProfiles(page, profile);
}
function renderSubProfiles(page, profile) {
renderDirectPlayProfiles(page, profile.DirectPlayProfiles);
renderTranscodingProfiles(page, profile.TranscodingProfiles);
renderContainerProfiles(page, profile.ContainerProfiles);
@ -67,6 +75,38 @@
renderMediaProfiles(page, profile.MediaProfiles);
}
function editDirectPlayProfile(page, directPlayProfile, isNew) {
currentSubProfile = directPlayProfile;
isSubProfileNew = isNew;
var popup = $('#popupEditDirectPlayProfile', page).popup('open');
$('#selectDirectPlayProfileType', popup).val(directPlayProfile.Type || 'Video').selectmenu('refresh').trigger('change');
$('#txtDirectPlayContainer', popup).val(directPlayProfile.Container || '');
$('#txtDirectPlayAudioCodec', popup).val(directPlayProfile.AudioCodec || '');
$('#txtDirectPlayVideoCodec', popup).val(directPlayProfile.VideoCodec || '');
}
function saveDirectPlayProfile(page) {
currentSubProfile.Type = $('#selectDirectPlayProfileType', page).val();
currentSubProfile.Container = $('#txtDirectPlayContainer', page).val();
currentSubProfile.AudioCodec = $('#txtDirectPlayAudioCodec', page).val();
currentSubProfile.VideoCodec = $('#txtDirectPlayVideoCodec', page).val();
if (isSubProfileNew) {
currentProfile.DirectPlayProfiles.push(currentSubProfile);
}
renderSubProfiles(page, currentProfile);
currentSubProfile = null;
$('#popupEditDirectPlayProfile', page).popup('close');
}
function renderDirectPlayProfiles(page, profiles) {
var html = '';
@ -86,7 +126,7 @@
}
html += '<li>';
html += '<a href="#">';
html += '<a data-profileindex="' + i + '" class="lnkEditSubProfile" href="#">';
html += '<p>Container: ' + (profile.Container || 'All') + '</p>';
@ -101,7 +141,7 @@
html += '</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileIndex="' + i + '">Delete</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileindex="' + i + '">Delete</a>';
html += '</li>';
}
@ -112,9 +152,16 @@
$('.btnDeleteProfile', elem).on('click', function () {
var index = this.getAttribute('data-profileIndex');
var index = this.getAttribute('data-profileindex');
deleteDirectPlayProfile(page, index);
});
$('.lnkEditSubProfile', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-profileindex'));
editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]);
});
}
function deleteDirectPlayProfile(page, index) {
@ -160,7 +207,7 @@
html += '</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileIndex="' + i + '">Delete</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileindex="' + i + '">Delete</a>';
html += '</li>';
}
@ -171,7 +218,7 @@
$('.btnDeleteProfile', elem).on('click', function () {
var index = this.getAttribute('data-profileIndex');
var index = this.getAttribute('data-profileindex');
deleteTranscodingProfile(page, index);
});
}
@ -218,7 +265,7 @@
html += '</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileIndex="' + i + '">Delete</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileindex="' + i + '">Delete</a>';
html += '</li>';
}
@ -229,7 +276,7 @@
$('.btnDeleteProfile', elem).on('click', function () {
var index = this.getAttribute('data-profileIndex');
var index = this.getAttribute('data-profileindex');
deleteContainerProfile(page, index);
});
}
@ -278,7 +325,7 @@
html += '</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileIndex="' + i + '">Delete</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileindex="' + i + '">Delete</a>';
html += '</li>';
}
@ -289,7 +336,7 @@
$('.btnDeleteProfile', elem).on('click', function () {
var index = this.getAttribute('data-profileIndex');
var index = this.getAttribute('data-profileindex');
deleteCodecProfile(page, index);
});
}
@ -345,7 +392,7 @@
html += '</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileIndex="' + i + '">Delete</a>';
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileindex="' + i + '">Delete</a>';
html += '</li>';
}
@ -356,7 +403,7 @@
$('.btnDeleteProfile', elem).on('click', function () {
var index = this.getAttribute('data-profileIndex');
var index = this.getAttribute('data-profileindex');
deleteMediaProfile(page, index);
});
}
@ -440,6 +487,22 @@
});
$('#selectDirectPlayProfileType', page).on('change', function () {
if (this.value == 'Video') {
$('#fldDirectPlayVideoCodec', page).show();
} else {
$('#fldDirectPlayVideoCodec', page).hide();
}
if (this.value == 'Photo') {
$('#fldDirectPlayAudioCodec', page).hide();
} else {
$('#fldDirectPlayAudioCodec', page).show();
}
});
}).on('pageshow', "#dlnaProfilePage", function () {
var page = this;
@ -466,6 +529,16 @@
saveProfile(page, currentProfile);
return false;
},
onDirectPlayFormSubmit: function () {
var form = this;
var page = $(form).parents('.page');
saveDirectPlayProfile(page);
return false;
}
};