Mobile doesn't like select2

This commit is contained in:
Cohee 2023-09-10 14:39:49 +03:00
parent d81c94de0b
commit dc5deaf47c
2 changed files with 14 additions and 7 deletions

View File

@ -8473,6 +8473,7 @@ jQuery(async function () {
'.ui-widget',
'.text_pole',
'#toast-container',
'.select2-results',
];
for (const id of forbiddenTargets) {
if (clickTarget.closest(id).length > 0) {

View File

@ -1,4 +1,5 @@
import { api_server_textgenerationwebui, getRequestHeaders, setGenerationParamsFromPreset } from "../script.js";
import { getDeviceInfo } from "./RossAscends-mods.js";
let models = [];
@ -63,11 +64,16 @@ function getMancerModelTemplate(option) {
}
jQuery(function () {
$('#mancer_model').on('change', onMancerModelSelect).select2({
placeholder: 'Select a model',
searchInputPlaceholder: 'Search models...',
searchInputCssClass: 'text_pole',
width: '100%',
templateResult: getMancerModelTemplate,
});
$('#mancer_model').on('change', onMancerModelSelect);
const deviceInfo = getDeviceInfo();
if (deviceInfo && deviceInfo.device.type === 'desktop') {
$('#mancer_model').select2({
placeholder: 'Select a model',
searchInputPlaceholder: 'Search models...',
searchInputCssClass: 'text_pole',
width: '100%',
templateResult: getMancerModelTemplate,
});
}
});