Skip to content

Commit

Permalink
Merge pull request #1954 from tomudding/feature/festivities
Browse files Browse the repository at this point in the history
feat: ❄️🎆❄🎆❄🎆
  • Loading branch information
tomudding authored Dec 31, 2024
2 parents b452472 + 2c94c8d commit 293f35d
Show file tree
Hide file tree
Showing 6 changed files with 962 additions and 21 deletions.
61 changes: 43 additions & 18 deletions module/Application/view/layout/layout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,50 @@ endif; ?>

<?= $this->partial('partial/privacy-widget.phtml') ?>

<div id="gewis-festivities" style="position: fixed; width: 100vw; height: 100vh; pointer-events: none;">
<?php
$currentDate = new DateTime();
$targetDate = DateTime::createFromFormat('j n', '28 6');

if (
$currentDate->format('j n') === $targetDate->format('j n')
|| (
null !== $this->identity()
&& $this->identity()->getMember()->getBirth()->format('m-d') === $currentDate->format('m-d')
)
) {
$this->inlineScript()->prependFile(
$this->basepath('js/balloons.js'),
'text/javascript',
['nonce' => NONCE_REPLACEMENT_STRING],
);
}
?>
<?php if (null !== $this->identity()): ?>
<?php
if (
$currentDate >= new DateTime('December 24')
&& $currentDate <= new DateTime('December 31 23:59:59')
) {
$this->inlineScript()->prependFile(
$this->basepath('js/snowstorm.js'),
'text/javascript',
['nonce' => NONCE_REPLACEMENT_STRING],
);
}
?>
<?php if ('01-01' === $currentDate->format('m-d')): ?>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework"></div>
<?php endif; ?>
<?php endif; ?>
</div>

<!-- Scripts -->
<?php
$currentDate = new DateTime();
$targetDate = DateTime::createFromFormat('j n', '28 6');

if (
$currentDate->format('j n') === $targetDate->format('j n')
|| (
null !== $this->identity()
&& $this->identity()->getMember()->getBirth()->format('m-d') === $currentDate->format('m-d')
)
) {
$this->inlineScript()->prependFile(
$this->basepath('js/balloons.js'),
'text/javascript',
['nonce' => NONCE_REPLACEMENT_STRING],
);
}
?>
<?= $this->inlineScript()
->prependFile(
$this->basepath('js/bootstrap.min.js'),
Expand Down
2 changes: 1 addition & 1 deletion public/css/gewis-theme.css

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions public/js/balloons.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ const getRandomStyles = () => {
}

const createBalloons = async (num) => {
const body = document.body;
const balloonContainer = document.createElement('div');
balloonContainer.id = 'balloon-container';
body.append(balloonContainer);
document.getElementById('gewis-festivities').append(balloonContainer);

for (let i = 0; i < num; i++) {
const balloon = document.createElement('div');
Expand Down
Loading

0 comments on commit 293f35d

Please sign in to comment.