Add mobile-specific flower count configuration for Earth Day [skip ci]
This commit is contained in:
@@ -160,6 +160,7 @@ public class ChristmasOptions {
|
||||
public class EarthDayOptions {
|
||||
public bool EnableEarthDay { get; set; } = true;
|
||||
public int FlowersCount { get; set; } = 60;
|
||||
public int FlowersCountMobile { get; set; } = 20;
|
||||
}
|
||||
|
||||
public class EasterOptions {
|
||||
|
||||
@@ -125,8 +125,6 @@
|
||||
<!-- Advanced Tab -->
|
||||
<div id="seasonals-advanced" class="seasonals-tab-content" style="display: none;">
|
||||
<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>
|
||||
<summary>Autumn</summary>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
@@ -735,6 +733,11 @@
|
||||
<input is="emby-input" type="number" id="EarthDayFlowersCount" name="EarthDayFlowersCount" />
|
||||
<div class="fieldDescription">Number of flowers in the lawn.</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>
|
||||
<hr style="max-width: 800px; margin: 1em 0;">
|
||||
|
||||
@@ -1664,7 +1667,8 @@
|
||||
// EarthDay
|
||||
|
||||
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
|
||||
|
||||
@@ -2044,6 +2048,7 @@
|
||||
// Earth Day
|
||||
config.EarthDay.EnableEarthDay = document.querySelector('#EnableEarthDay').checked;
|
||||
config.EarthDay.FlowersCount = parseInt(document.querySelector('#EarthDayFlowersCount').value);
|
||||
config.EarthDay.FlowersCountMobile = parseInt(document.querySelector('#EarthDayFlowersCountMobile').value);
|
||||
|
||||
// Eurovision
|
||||
config.Eurovision.EnableEurovision = document.querySelector('#EnableEurovision').checked;
|
||||
@@ -2167,6 +2172,7 @@
|
||||
// Earth Day
|
||||
config.EarthDay.EnableEarthDay = document.querySelector('#EnableEarthDay').checked;
|
||||
config.EarthDay.FlowersCount = parseInt(document.querySelector('#EarthDayFlowersCount').value);
|
||||
config.EarthDay.FlowersCountMobile = parseInt(document.querySelector('#EarthDayFlowersCountMobile').value);
|
||||
|
||||
// Eurovision (second pass - deduplicated)
|
||||
config.Eurovision.EnableEurovision = document.querySelector('#EnableEurovision').checked;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
const config = window.SeasonalsPluginConfig?.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'];
|
||||
|
||||
@@ -68,7 +69,8 @@ function createElements() {
|
||||
}
|
||||
|
||||
// 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++) {
|
||||
const x = 10 + Math.random() * (w - 20);
|
||||
const y = hSVG * 0.1 + Math.random() * (hSVG * 0.5);
|
||||
|
||||
Reference in New Issue
Block a user