mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Quality type sizes moved to backbone + SS (API)
This commit is contained in:
parent
5ba1c0eceb
commit
c8621b8100
24 changed files with 244 additions and 356 deletions
|
@ -1,80 +1,4 @@
|
|||
var deleteQualityProfileUrl = '../../Settings/DeleteQualityProfile';
|
||||
|
||||
$(document).on('click', '.delete-profile', function (e) {
|
||||
var container = $(this).closest('.profileSection');
|
||||
var id = $(container).attr('data-profile-id');
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: deleteQualityProfileUrl,
|
||||
data: jQuery.param({ profileId: id }),
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
$(container).remove();
|
||||
removeOption(id);
|
||||
}
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
function renameOption(text, value) {
|
||||
$("#DefaultQualityProfileId option[value='" + value + "']").html(text);
|
||||
}
|
||||
|
||||
function addOption(text, value) {
|
||||
var myCombo = $('#DefaultQualityProfileId');
|
||||
|
||||
var exists = $("#DefaultQualityProfileId option[value='" + value + "']");
|
||||
|
||||
if (exists.length == 0)
|
||||
myCombo.append($('\<option\> \</option\>').val(value).html(text));
|
||||
}
|
||||
|
||||
function removeOption(value) {
|
||||
$("#DefaultQualityProfileId option[value='" + value + "']").remove();
|
||||
}
|
||||
|
||||
function getProfileId(obj) {
|
||||
var parentProfileSection = $(obj).closest('.profileSection');
|
||||
return parentProfileSection.attr('data-profile-id');
|
||||
}
|
||||
|
||||
function getCleanId(obj) {
|
||||
var parentProfileSection = $(obj).parents('.profileSection');
|
||||
return parentProfileSection.children('.cleanId').val();
|
||||
}
|
||||
|
||||
$(document).on('keyup', '.profileName_textbox', function () {
|
||||
var value = $(this).val();
|
||||
|
||||
$(this).closest('.profileSection').find('.titleText').text(value);
|
||||
var profileId = getProfileId(this);
|
||||
|
||||
renameOption(value, profileId);
|
||||
}).keyup();
|
||||
|
||||
$(document).on('click', '.quality-selectee', function () {
|
||||
var id = $(this).attr('id');
|
||||
var cleanId = getCleanId(this);
|
||||
var cutoff = '#' + cleanId + '_Cutoff';
|
||||
var name = jQuery('[for="' + id + '"]').children('.ui-button-text').text();
|
||||
var qualityId = $(this).attr('data-quality-id');
|
||||
|
||||
//Remove 'Unknown'
|
||||
$(cutoff + ' option').each(function () { if ($(this).text().indexOf('Unknown') > -1) $(cutoff + ' option').remove(':contains("' + $(this).text() + '")'); });
|
||||
|
||||
//Add option to cutoff SelectList
|
||||
if ($(this).attr('checked')) {
|
||||
$('<option>' + name + '</option>').val(qualityId).appendTo(cutoff);
|
||||
}
|
||||
|
||||
//Remove option from cutoff SelectList
|
||||
else {
|
||||
$(cutoff).find('option[value="' + qualityId + '"]').remove();
|
||||
}
|
||||
});
|
||||
|
||||
var sliderOptions = {
|
||||
var sliderOptions = {
|
||||
min: 0,
|
||||
max: 200,
|
||||
value: 0,
|
||||
|
@ -88,14 +12,19 @@ var sliderOptions = {
|
|||
$(this).siblings('.slider-value').val(ui.value);
|
||||
$(this).siblings('.30-minute').text(ui.value * 30);
|
||||
$(this).siblings('.60-minute').text(ui.value * 60);
|
||||
},
|
||||
change: function (event, ui) {
|
||||
$(this).siblings('.slider-value').val(ui.value).trigger('change');
|
||||
}
|
||||
};
|
||||
|
||||
function setupSliders() {
|
||||
$(".slider").each(function () {
|
||||
var localOptions = sliderOptions;
|
||||
localOptions["value"] = $(this).siblings('.slider-value').val();
|
||||
$('.quality-selectee').livequery(function () {
|
||||
$(this).button();
|
||||
});
|
||||
|
||||
$(this).empty().slider(localOptions);
|
||||
});
|
||||
}
|
||||
$('.slider').livequery(function () {
|
||||
var localOptions = sliderOptions;
|
||||
localOptions["value"] = $(this).siblings('.slider-value').val();
|
||||
|
||||
$(this).empty().slider(localOptions);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue