Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ❄️🎆❄🎆❄🎆 #1954

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading