Compare commits
4 Commits
9d1a268875
...
492acb4052
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
492acb4052 | ||
|
|
68dc9efa4d | ||
|
|
7b15ed46c1 | ||
|
|
8019ba760f |
@@ -138,18 +138,16 @@ public class BirthdayOptions {
|
||||
|
||||
public class CarnivalOptions {
|
||||
public bool EnableCarnival { get; set; } = true;
|
||||
public bool EnableRandomCarnival { get; set; } = true;
|
||||
public bool EnableRandomCarnivalMobile { get; set; } = false;
|
||||
public bool EnableDifferentDuration { get; set; } = true;
|
||||
public bool EnableCarnivalSway { get; set; } = true;
|
||||
public int ObjectCount { get; set; } = 120;
|
||||
public int ObjectCountMobile { get; set; } = 60;
|
||||
}
|
||||
|
||||
public class CherryBlossomOptions {
|
||||
public bool EnableCherryBlossom { get; set; } = true;
|
||||
public int PetalCount { get; set; } = 25;
|
||||
public bool EnableRandomCherryBlossom { get; set; } = true;
|
||||
public bool EnableRandomCherryBlossomMobile { get; set; } = false;
|
||||
public int PetalCountMobile { get; set; } = 15;
|
||||
public bool EnableDifferentDuration { get; set; } = true;
|
||||
}
|
||||
|
||||
@@ -242,6 +240,9 @@ public class MatrixOptions {
|
||||
|
||||
public class OktoberfestOptions {
|
||||
public bool EnableOktoberfest { get; set; } = true;
|
||||
public int SymbolCount { get; set; } = 25;
|
||||
public int SymbolCountMobile { get; set; } = 10;
|
||||
public bool EnableDifferentDuration { get; set; } = true;
|
||||
}
|
||||
|
||||
public class OlympiaOptions {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
const config = window.SeasonalsPluginConfig?.Carnival || {};
|
||||
|
||||
const carnival = config.EnableCarnival !== undefined ? config.EnableCarnival : true; // enable/disable carnival
|
||||
const randomCarnival = config.EnableRandomCarnival !== undefined ? config.EnableRandomCarnival : true; // enable random carnival
|
||||
const randomCarnivalMobile = config.EnableRandomCarnivalMobile !== undefined ? config.EnableRandomCarnivalMobile : false; // enable random carnival on mobile
|
||||
const carnivalCount = config.ObjectCount !== undefined ? config.ObjectCount : 120; // Number of confetti pieces to spawn
|
||||
const carnivalCountMobile = config.ObjectCountMobile !== undefined ? config.ObjectCountMobile : 60; // Number of confetti pieces to spawn on mobile
|
||||
const enableDifferentDuration = config.EnableDifferentDuration !== undefined ? config.EnableDifferentDuration : true; // enable different durations
|
||||
const enableSway = config.EnableCarnivalSway !== undefined ? config.EnableCarnivalSway : true; // enable/disable carnivalsway
|
||||
const carnivalCount = config.ObjectCount !== undefined ? config.ObjectCount : 120; // Number of confetti pieces to spawn
|
||||
|
||||
const confettiColors = [
|
||||
'#fce18a', '#ff726d', '#b48def', '#f4306d',
|
||||
@@ -148,19 +147,8 @@ function createConfettiPiece(container, isInitial = false) {
|
||||
container.appendChild(wrapper);
|
||||
}
|
||||
|
||||
function addRandomCarnivalObjects(count) {
|
||||
const carnivalContainer = document.querySelector('.carnival-container');
|
||||
if (!carnivalContainer) return;
|
||||
|
||||
console.log('Adding random carnival confetti');
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
createConfettiPiece(carnivalContainer, true);
|
||||
}
|
||||
}
|
||||
|
||||
// initialize standard carnival objects
|
||||
function initCarnivalObjects() {
|
||||
function initCarnivalObjects(count) {
|
||||
let container = document.querySelector('.carnival-container');
|
||||
if (!container) {
|
||||
container = document.createElement("div");
|
||||
@@ -170,7 +158,7 @@ function initCarnivalObjects() {
|
||||
}
|
||||
|
||||
// Initial confetti
|
||||
for (let i = 0; i < 60; i++) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
createConfettiPiece(container, true);
|
||||
}
|
||||
}
|
||||
@@ -178,13 +166,12 @@ function initCarnivalObjects() {
|
||||
// initialize carnival
|
||||
function initializeCarnival() {
|
||||
if (!carnival) return;
|
||||
initCarnivalObjects();
|
||||
toggleCarnival();
|
||||
|
||||
const screenWidth = window.innerWidth;
|
||||
if (randomCarnival && (screenWidth > 768 || randomCarnivalMobile)) {
|
||||
addRandomCarnivalObjects(carnivalCount);
|
||||
}
|
||||
const count = screenWidth > 768 ? carnivalCount : carnivalCountMobile;
|
||||
|
||||
initCarnivalObjects(count);
|
||||
toggleCarnival();
|
||||
}
|
||||
|
||||
initializeCarnival();
|
||||
|
||||
@@ -2,8 +2,7 @@ const config = window.SeasonalsPluginConfig?.CherryBlossom || {};
|
||||
|
||||
const cherryBlossom = config.EnableCherryBlossom !== undefined ? config.EnableCherryBlossom : true; // enable/disable cherryblossom
|
||||
const petalCount = config.PetalCount !== undefined ? config.PetalCount : 25; // count of petal
|
||||
const randomCherryBlossom = config.EnableRandomCherryBlossom !== undefined ? config.EnableRandomCherryBlossom : true; // enable random cherryblossom
|
||||
const randomCherryBlossomMobile = config.EnableRandomCherryBlossomMobile !== undefined ? config.EnableRandomCherryBlossomMobile : false; // enable random cherryblossom on mobile
|
||||
const petalCountMobile = config.PetalCountMobile !== undefined ? config.PetalCountMobile : 10; // count of petal on mobile
|
||||
const enableDifferentDuration = config.EnableDifferentDuration !== undefined ? config.EnableDifferentDuration : true; // enable different durations
|
||||
|
||||
let msgPrinted = false;
|
||||
@@ -67,16 +66,7 @@ function createPetal(container) {
|
||||
container.appendChild(petal);
|
||||
}
|
||||
|
||||
function addRandomObjects() {
|
||||
const container = document.querySelector('.cherryblossom-container');
|
||||
if (!container) return;
|
||||
|
||||
for (let i = 0; i < petalCount; i++) {
|
||||
createPetal(container);
|
||||
}
|
||||
}
|
||||
|
||||
function initObjects() {
|
||||
function initObjects(count) {
|
||||
let container = document.querySelector('.cherryblossom-container');
|
||||
if (!container) {
|
||||
container = document.createElement("div");
|
||||
@@ -86,20 +76,19 @@ function initObjects() {
|
||||
}
|
||||
|
||||
// Initial batch
|
||||
for (let i = 0; i < 15; i++) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
createPetal(container);
|
||||
}
|
||||
}
|
||||
|
||||
function initializeCherryBlossom() {
|
||||
if (!cherryBlossom) return;
|
||||
initObjects();
|
||||
toggleCherryBlossom();
|
||||
|
||||
const screenWidth = window.innerWidth;
|
||||
if (randomCherryBlossom && (screenWidth > 768 || randomCherryBlossomMobile)) {
|
||||
addRandomObjects();
|
||||
}
|
||||
const count = screenWidth > 768 ? petalCount : petalCountMobile;
|
||||
|
||||
initObjects(count);
|
||||
toggleCherryBlossom();
|
||||
}
|
||||
|
||||
initializeCherryBlossom();
|
||||
|
||||
@@ -54,15 +54,33 @@ function createMarioDay(container) {
|
||||
wrapper.appendChild(mario);
|
||||
container.appendChild(wrapper);
|
||||
|
||||
let jumpCount = 0;
|
||||
let maxJumpsForThisRun = Math.floor(Math.random() * 3); // 0, 1, or 2
|
||||
|
||||
const resetJumpInterval = setInterval(() => {
|
||||
if (!document.body.contains(container)) { clearInterval(resetJumpInterval); return; }
|
||||
jumpCount = 0;
|
||||
maxJumpsForThisRun = Math.floor(Math.random() * 3); // Randomize jumps for the next pass
|
||||
}, (marioSpeedSeconds / 2) * 1000);
|
||||
|
||||
// Periodically throw out an 8-bit coin
|
||||
const intervalId = setInterval(() => {
|
||||
if (!document.body.contains(container)) { clearInterval(intervalId); return; }
|
||||
if (container.style.display === 'none') return;
|
||||
|
||||
const marioRect = wrapper.getBoundingClientRect();
|
||||
if (marioRect.left < 0 || marioRect.right > window.innerWidth) return;
|
||||
|
||||
if (letMarioJump && !mario.classList.contains('mario-jump') && jumpCount < maxJumpsForThisRun) {
|
||||
mario.classList.add('mario-jump');
|
||||
jumpCount++;
|
||||
setTimeout(() => mario.classList.remove('mario-jump'), 800);
|
||||
}
|
||||
|
||||
const coin = document.createElement('div');
|
||||
coin.className = 'mario-coin';
|
||||
|
||||
// Grab Mario's current screen position to lock the coin's X coordinate
|
||||
const marioRect = wrapper.getBoundingClientRect();
|
||||
coin.style.left = `${marioRect.left + 16}px`;
|
||||
coin.style.bottom = '35px'; // bottom offset
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
const config = window.SeasonalsPluginConfig?.Oktoberfest || {};
|
||||
const oktoberfest = config.EnableOktoberfest !== undefined ? config.EnableOktoberfest : true; // enable/disable oktoberfest
|
||||
const symbolCount = config.SymbolCount !== undefined ? config.SymbolCount : 25; // count of symbols
|
||||
const symbolCountMobile = config.SymbolCountMobile !== undefined ? config.SymbolCountMobile : 10; // count of symbols on mobile
|
||||
const enableDifferentDuration = config.EnableDifferentDuration !== undefined ? config.EnableDifferentDuration : true; // enable different durations
|
||||
|
||||
const oktoberfestSymbols = ['🥨', '🍺', '🍻', '🥨', '🥨'];
|
||||
|
||||
@@ -38,8 +41,8 @@ observer.observe(document.body, {
|
||||
attributes: true
|
||||
});
|
||||
|
||||
function createOktoberfest(container) {
|
||||
for (let i = 0; i < 20; i++) {
|
||||
function createOktoberfest(container, count) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const symbol = document.createElement('div');
|
||||
symbol.className = 'oktoberfest-symbol';
|
||||
symbol.textContent = oktoberfestSymbols[Math.floor(Math.random() * oktoberfestSymbols.length)];
|
||||
@@ -47,7 +50,9 @@ function createOktoberfest(container) {
|
||||
symbol.style.animationDelay = `${Math.random() * 10}s, ${Math.random() * 5}s`;
|
||||
const duration1 = Math.random() * 5 + 8;
|
||||
const duration2 = Math.random() * 3 + 3;
|
||||
symbol.style.animationDuration = `${duration1}s, ${duration2}s`;
|
||||
if (enableDifferentDuration) {
|
||||
symbol.style.animationDuration = `${duration1}s, ${duration2}s`;
|
||||
}
|
||||
|
||||
container.appendChild(symbol);
|
||||
}
|
||||
@@ -61,6 +66,10 @@ function initializeOktoberfest() {
|
||||
container.setAttribute("aria-hidden", "true");
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
createOktoberfest(container);
|
||||
|
||||
const screenWidth = window.innerWidth;
|
||||
const count = screenWidth > 768 ? symbolCount : symbolCountMobile;
|
||||
|
||||
createOktoberfest(container, count);
|
||||
}
|
||||
initializeOktoberfest();
|
||||
|
||||
Reference in New Issue
Block a user