added max option to custom background image size

This commit is contained in:
Smithster 2021-04-06 00:58:55 +01:00
parent 230da777cb
commit 48c7835f2b
4 changed files with 22 additions and 3 deletions

View file

@ -1375,7 +1375,7 @@ export function setCustomBackground(value, nosave) {
}
export function setCustomBackgroundSize(value, nosave) {
if (value != "cover" && value != "contain") {
if (value != "cover" && value != "contain" && value!= "max") {
value = "cover";
}
config.customBackgroundSize = value;

View file

@ -769,6 +769,13 @@ $(".pageSettings .section.customBackgroundSize .inputAndButton .contain").on(
}
);
$(".pageSettings .section.customBackgroundSize .inputAndButton .max").on(
"click",
(e) => {
UpdateConfig.setCustomBackgroundSize("max");
}
);
$(".pageSettings .section.customBackgroundSize .inputAndButton input").keypress(
(e) => {
if (e.keyCode == 13) {

View file

@ -163,7 +163,11 @@ export function applyCustomBackground() {
}
export function applyCustomBackgroundSize() {
if (Config.customBackgroundSize != "") {
if (Config.customBackgroundSize == "max"){
$(".customBackground").css({
backgroundSize: "100% 100%" ,
});
} else if (Config.customBackgroundSize != "") {
$(".customBackground").css({
backgroundSize: Config.customBackgroundSize,
});

View file

@ -2925,7 +2925,7 @@
<div class="text">
Set an image url to be a custom background image. Cover fits
the image to cover the screen. Contain fits the image to be
fully visible.
fully visible. Max fits the image corner to corner.
</div>
<div>
<div class="inputAndButton">
@ -2961,6 +2961,14 @@
>
contain
</div>
<div
class="button"
customBackGroundSize="max"
tabindex="0"
onclick="this.blur();"
>
max
</div>
</div>
</div>
</div>