Restyle Horde model selector

This commit is contained in:
Cohee
2023-06-28 02:09:33 +03:00
parent 515a0af1b4
commit 9949d5695c
5 changed files with 144 additions and 7 deletions

View File

@@ -225,12 +225,10 @@ async function showKudos() {
}
jQuery(function () {
let hordeModelSelectScrollTop = null;
$("#horde_model").on('mousedown change', async function (e) {
//desktop-only routine for multi-select without CTRL
if (deviceInfo.device.type === 'desktop') {
/*if (deviceInfo.device.type === 'desktop') {
let hordeModelSelectScrollTop = null;
e.preventDefault();
const option = $(e.target);
const selectElement = $(this)[0];
@@ -238,7 +236,7 @@ jQuery(function () {
option.prop('selected', !option.prop('selected'));
await delay(1);
selectElement.scrollTop = hordeModelSelectScrollTop;
}
}*/
horde_settings.models = $('#horde_model').val();
console.log('Updated Horde models', horde_settings.models);
});
@@ -265,4 +263,14 @@ jQuery(function () {
$("#horde_refresh").on("click", getHordeModels);
$("#horde_kudos").on("click", showKudos);
// Not needed on mobile
if (deviceInfo.device.type === 'desktop') {
$('#horde_model').select2({
width: '100%',
placeholder: 'Select Horde models',
allowClear: true,
closeOnSelect: false,
});
}
})