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:
parent
9c7cf7b686
commit
f560b29837
2 changed files with 133 additions and 11 deletions
|
@ -155,8 +155,57 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div data-role="popup" data-transition="slidefade" id="popupEditDirectPlayProfile" class="popup">
|
||||
|
||||
<div class="ui-bar-a" style="text-align: center; padding: 0 20px;">
|
||||
<h3>Direct Play Profile</h3>
|
||||
</div>
|
||||
|
||||
<div data-role="content">
|
||||
<form class="editDirectPlayProfileForm">
|
||||
|
||||
<div style="margin: 1em 0;">
|
||||
<label for="selectDirectPlayProfileType">Type:</label>
|
||||
<select id="selectDirectPlayProfileType" data-mini="true">
|
||||
<option value="Audio">Audio</option>
|
||||
<option value="Photo">Photo</option>
|
||||
<option value="Video">Video</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div style="margin: 1em 0;">
|
||||
<label for="txtDirectPlayContainer">Containers:</label>
|
||||
<input type="text" id="txtDirectPlayContainer" data-mini="true" />
|
||||
<div>Separated by comma. This can be left empty to apply to all containers</div>
|
||||
</div>
|
||||
|
||||
<div id="fldDirectPlayVideoCodec" style="margin: 1em 0;">
|
||||
<label for="txtDirectPlayVideoCodec">Video codecs:</label>
|
||||
<input type="text" id="txtDirectPlayVideoCodec" data-mini="true" />
|
||||
<div>Separated by comma. This can be left empty to apply to all containers</div>
|
||||
</div>
|
||||
|
||||
<div id="fldDirectPlayAudioCodec" style="margin: 1em 0 2em;">
|
||||
<label for="txtDirectPlayAudioCodec">Audio codecs:</label>
|
||||
<input type="text" id="txtDirectPlayAudioCodec" data-mini="true" />
|
||||
<div>Separated by comma. This can be left empty to apply to all containers</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
|
||||
Ok
|
||||
</button>
|
||||
<button type="button" data-icon="delete" onclick="$(this).parents('.popup').popup('close');" data-mini="true">
|
||||
Cancel
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('.dlnaProfileForm').off('submit', DlnaProfilePage.onSubmit).on('submit', DlnaProfilePage.onSubmit);
|
||||
$('.editDirectPlayProfileForm').off('submit', DlnaProfilePage.onDirectPlayFormSubmit).on('submit', DlnaProfilePage.onDirectPlayFormSubmit);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue