SickGear/gui/slick/js/qualityChooser.js

31 lines
786 B
JavaScript
Raw Normal View History

2014-11-20 22:25:33 +00:00
function setFromPresets (preset) {
var elCustomQuality = $('.show-if-quality-custom'),
2014-11-20 22:25:33 +00:00
selected = 'selected';
if (0 == preset) {
elCustomQuality.show();
return;
}
elCustomQuality.hide();
2014-11-20 22:25:33 +00:00
$('#anyQualities').find('option').each(function() {
var result = preset & $(this).val();
$(this).attr(selected, (0 < result ? selected : false));
});
2014-11-20 22:25:33 +00:00
$('#bestQualities').find('option').each(function() {
var result = preset & ($(this).val() << 16);
$(this).attr(selected, (result > 0 ? selected: false));
});
}
2014-11-20 22:25:33 +00:00
$(document).ready(function() {
var elQualityPreset = $('#qualityPreset'),
selected = ':selected';
2014-11-20 22:25:33 +00:00
elQualityPreset.change(function() {
setFromPresets($('#qualityPreset').find(selected).val());
});
2014-11-20 22:25:33 +00:00
setFromPresets(elQualityPreset.find(selected).val());
});