2014-11-20 22:25:33 +00:00
|
|
|
function setFromPresets (preset) {
|
2015-07-16 23:09:27 +00:00
|
|
|
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-03-10 05:18:05 +00:00
|
|
|
|
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-03-10 05:18:05 +00:00
|
|
|
|
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-03-10 05:18:05 +00:00
|
|
|
|
2014-11-20 22:25:33 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
var elQualityPreset = $('#qualityPreset'),
|
|
|
|
selected = ':selected';
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-11-20 22:25:33 +00:00
|
|
|
elQualityPreset.change(function() {
|
|
|
|
setFromPresets($('#qualityPreset').find(selected).val());
|
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-11-20 22:25:33 +00:00
|
|
|
setFromPresets(elQualityPreset.find(selected).val());
|
|
|
|
});
|