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

1
public/css/select2.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -15,6 +15,7 @@
<link href="css/bright.min.css" rel="stylesheet">
<link href="css/cropper.min.css" rel="stylesheet">
<link href="css/toastr.min.css" rel="stylesheet">
<link href="css/select2.min.css" rel="stylesheet">
<link rel="apple-touch-icon" sizes="57x57" href="img/apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-icon-72x72.png" />
@@ -35,6 +36,7 @@
<script src="scripts/jquery-cropper.min.js"></script>
<script src="scripts/toastr.min.js"></script>
<script src="scripts/fuse.js"></script>
<script src="scripts/select2.min.js"></script>
<script type="module" src="scripts/eventemitter.js"></script>
<script type="module" src="scripts/power-user.js"></script>
<script type="module" src="scripts/swiped-events.js"></script>
@@ -3453,4 +3455,4 @@
</script>
</body>
</html>
</html>

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,
});
}
})

2
public/scripts/select2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -4801,4 +4801,128 @@ body.waifuMode .zoomed_avatar {
#horde_model {
height: unset;
}
}
}
/* Customize the Select2 container */
.select2-container {
color: var(--SmartThemeBodyColor);
}
/* Customize the dropdown */
.select2-dropdown {
background-color: var(--SmartThemeBlurTintColor);
border: 1px solid var(--white30a) !important;
border-radius: 10px;
box-shadow: 0 0 5px black;
text-shadow: 0px 0px calc(var(--shadowWidth) * 1px) var(--SmartThemeShadowColor);
backdrop-filter: blur(calc(var(--SmartThemeBlurStrength)*2));
color: var(--SmartThemeBodyColor);
z-index: 4000;
}
.select2-selection__clear {
color: var(--SmartThemeBodyColor);
}
.select2-container .select2-selection--multiple .select2-selection__choice__remove {
padding: revert;
}
.select2-container .select2-selection--multiple .select2-selection__choice__display {
padding-left: 5px;
}
/* Customize the search input */
.select2-search__field {
background-color: var(--black30a);
color: var(--SmartThemeBodyColor);
border: 1px solid var(--white30a);
border-radius: 7px;
font-family: "Noto Sans", "Noto Color Emoji", sans-serif;
padding: 3px 5px;
}
/* Customize the selected option */
.select2-selection--single {
border: 1px solid var(--SmartThemeShadowColor);
border-radius: 4px;
background-color: var(--SmartThemeBlurTintColor);
}
/* Customize the selected option text */
.select2-selection__rendered {
color: var(--SmartThemeBodyColor);
}
/* Customize the option list item */
.select2-results__option {
color: var(--SmartThemeBodyColor);
background-color: var(--SmartThemeBodyColor);
}
.select2-container .select2-selection--multiple {
background-color: var(--black30a);
color: var(--SmartThemeBodyColor);
border: 1px solid var(--white30a);
border-radius: 7px;
font-family: "Noto Sans", "Noto Color Emoji", sans-serif;
padding: 3px 5px;
}
.select2-container .select2-selection--multiple .select2-selection__choice {
border-radius: 5px;
border-style: solid;
border-width: 1px;
box-sizing: border-box;
color: var(--SmartThemeBodyColor);
background-color: var(--black30a);
border-color: var(--white50a);
font-size: calc(var(--mainFontSize) - 5%);
text-shadow: none !important;
}
.select2-results .select2-results__option--selectable {
background-color: unset;
color: var(--SmartThemeBodyColor);
opacity: 0.5;
transition: opacity 200ms ease-in-out;
position: relative;
}
/* Customize the hovered option list item */
.select2-results .select2-results__option--highlighted.select2-results__option--selectable {
color: var(--SmartThemeBodyColor);
background-color: unset;
opacity: 1;
}
/* Customize the option list item */
.select2-results__option {
padding-left: 30px;
/* Add some padding to make room for the checkbox */
}
/* Add the custom checkbox */
.select2-results__option:before {
content: '';
display: inline-block;
position: absolute;
left: 6px;
top: 50%;
margin-top: -7px;
width: 14px;
height: 14px;
border: 1px solid var(--white30a);
background-color: var(--SmartThemeBlurTintColor);
border-radius: 2px;
}
/* Add the custom checkbox checkmark */
.select2-results__option--selected.select2-results__option:before {
content: '\2713';
font-weight: bold;
color: var(--SmartThemeBodyColor);
background-color: var(--SmartThemeBlurTintColor);
text-align: center;
line-height: 14px;
}