Add mobile-specific flower count configuration for Earth Day [skip ci]

This commit is contained in:
CodeDevMLH
2026-02-28 14:11:45 +01:00
parent 3dffd847de
commit c684651cef
3 changed files with 14 additions and 5 deletions

View File

@@ -160,6 +160,7 @@ public class ChristmasOptions {
public class EarthDayOptions { public class EarthDayOptions {
public bool EnableEarthDay { get; set; } = true; public bool EnableEarthDay { get; set; } = true;
public int FlowersCount { get; set; } = 60; public int FlowersCount { get; set; } = 60;
public int FlowersCountMobile { get; set; } = 20;
} }
public class EasterOptions { public class EasterOptions {

View File

@@ -125,8 +125,6 @@
<!-- Advanced Tab --> <!-- Advanced Tab -->
<div id="seasonals-advanced" class="seasonals-tab-content" style="display: none;"> <div id="seasonals-advanced" class="seasonals-tab-content" style="display: none;">
<h2 class="sectionTitle">Configure specific settings for each seasonal theme</h2> <h2 class="sectionTitle">Configure specific settings for each seasonal theme</h2>
<!-- <p>All symbol count settings add this number in addition to the standard 12 symbols (if additional symbols is enabled).</p> -->
<p>All symbol count settings add this number in addition to the standard 12 symbols (if additional symbols is enabled).</p>
<details> <details>
<summary>Autumn</summary> <summary>Autumn</summary>
<div class="checkboxContainer checkboxContainer-withDescription"> <div class="checkboxContainer checkboxContainer-withDescription">
@@ -735,6 +733,11 @@
<input is="emby-input" type="number" id="EarthDayFlowersCount" name="EarthDayFlowersCount" /> <input is="emby-input" type="number" id="EarthDayFlowersCount" name="EarthDayFlowersCount" />
<div class="fieldDescription">Number of flowers in the lawn.</div> <div class="fieldDescription">Number of flowers in the lawn.</div>
</div> </div>
<div class="inputContainer">
<label class="inputLabel" for="EarthDayFlowersCountMobile">Flowers Count (Mobile)</label>
<input is="emby-input" type="number" id="EarthDayFlowersCountMobile" name="EarthDayFlowersCountMobile" />
<div class="fieldDescription">Number of flowers on mobile devices.</div>
</div>
</details> </details>
<hr style="max-width: 800px; margin: 1em 0;"> <hr style="max-width: 800px; margin: 1em 0;">
@@ -1664,7 +1667,8 @@
// EarthDay // EarthDay
document.querySelector('#EnableEarthDay').checked = config.EarthDay.EnableEarthDay; document.querySelector('#EnableEarthDay').checked = config.EarthDay.EnableEarthDay;
document.querySelector('#EarthDayFlowersCount').value = config.EarthDay.FlowersCount; document.querySelector('#EarthDayFlowersCount').value = config.EarthDay.FlowersCount !== undefined ? config.EarthDay.FlowersCount : 60;
document.querySelector('#EarthDayFlowersCountMobile').value = config.EarthDay.FlowersCountMobile !== undefined ? config.EarthDay.FlowersCountMobile : 20;
// Easter // Easter
@@ -2044,6 +2048,7 @@
// Earth Day // Earth Day
config.EarthDay.EnableEarthDay = document.querySelector('#EnableEarthDay').checked; config.EarthDay.EnableEarthDay = document.querySelector('#EnableEarthDay').checked;
config.EarthDay.FlowersCount = parseInt(document.querySelector('#EarthDayFlowersCount').value); config.EarthDay.FlowersCount = parseInt(document.querySelector('#EarthDayFlowersCount').value);
config.EarthDay.FlowersCountMobile = parseInt(document.querySelector('#EarthDayFlowersCountMobile').value);
// Eurovision // Eurovision
config.Eurovision.EnableEurovision = document.querySelector('#EnableEurovision').checked; config.Eurovision.EnableEurovision = document.querySelector('#EnableEurovision').checked;
@@ -2167,6 +2172,7 @@
// Earth Day // Earth Day
config.EarthDay.EnableEarthDay = document.querySelector('#EnableEarthDay').checked; config.EarthDay.EnableEarthDay = document.querySelector('#EnableEarthDay').checked;
config.EarthDay.FlowersCount = parseInt(document.querySelector('#EarthDayFlowersCount').value); config.EarthDay.FlowersCount = parseInt(document.querySelector('#EarthDayFlowersCount').value);
config.EarthDay.FlowersCountMobile = parseInt(document.querySelector('#EarthDayFlowersCountMobile').value);
// Eurovision (second pass - deduplicated) // Eurovision (second pass - deduplicated)
config.Eurovision.EnableEurovision = document.querySelector('#EnableEurovision').checked; config.Eurovision.EnableEurovision = document.querySelector('#EnableEurovision').checked;

View File

@@ -1,7 +1,8 @@
const config = window.SeasonalsPluginConfig?.EarthDay || {}; const config = window.SeasonalsPluginConfig?.EarthDay || {};
const enabled = config.EnableEarthDay !== undefined ? config.EnableEarthDay : true; // enable/disable earthday const enabled = config.EnableEarthDay !== undefined ? config.EnableEarthDay : true; // enable/disable earthday
const flowersCount = config.FlowersCount !== undefined ? config.FlowersCount : 60; // count of vine const flowersCount = config.FlowersCount !== undefined ? config.FlowersCount : 60; // count of flowers
const flowersCountMobile = config.FlowersCountMobile !== undefined ? config.FlowersCountMobile : 20; // count of flowers on mobile
const flowerColors = ['#FF69B4', '#FFD700', '#87CEFA', '#FF4500', '#BA55D3', '#FFA500', '#FF1493']; const flowerColors = ['#FF69B4', '#FFD700', '#87CEFA', '#FF4500', '#BA55D3', '#FFA500', '#FF1493'];
@@ -68,7 +69,8 @@ function createElements() {
} }
// Generate Flowers // Generate Flowers
const flowerCount = Math.max(10, flowersCount); const isMobile = window.matchMedia("only screen and (max-width: 768px)").matches;
const flowerCount = Math.max(5, isMobile ? flowersCountMobile : flowersCount);
for (let i = 0; i < flowerCount; i++) { for (let i = 0; i < flowerCount; i++) {
const x = 10 + Math.random() * (w - 20); const x = 10 + Math.random() * (w - 20);
const y = hSVG * 0.1 + Math.random() * (hSVG * 0.5); const y = hSVG * 0.1 + Math.random() * (hSVG * 0.5);