Skip to content

Commit f2e7ffe

Browse files
committed
Merge branch 'main' into develop
2 parents 50a17c7 + b3b97b0 commit f2e7ffe

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

site/layouts/_default/baseof.html

+7
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,12 @@
1313
{{ with $script.js }}
1414
<script src="{{ relURL . }}"></script>
1515
{{ end }}
16+
<script>
17+
const d = new Date();
18+
// Show April Fools' joke
19+
if (d.getMonth() === 3 && d.getDate() === 1) {
20+
$.getScript("/js/april.js");
21+
}
22+
</script>
1623
</body>
1724
</html>

site/static/js/april.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
(async function($) {
3+
4+
$("body").append("<a href='#' id='disable-spotlight' class='btn dark'>Désactiver le mode sombre</a><div id='spotlight'></div>");
5+
6+
const spotlightEl = $("#spotlight");
7+
8+
function handleMouseMove(event) {
9+
const {clientX, clientY} = event;
10+
11+
spotlightEl[0].style.background = `radial-gradient(circle at ${clientX}px ${clientY}px, #00000000 10px, #000000FF 100px)`;
12+
}
13+
14+
$("body").on("mousemove", handleMouseMove);
15+
16+
$("#disable-spotlight").on("click", () => {
17+
disableApril();
18+
localStorage.setItem("disable-april", "true");
19+
});
20+
21+
if (localStorage.getItem("disable-april") === "true") {
22+
disableApril();
23+
}
24+
25+
function disableApril() {
26+
$("#spotlight")[0].style.display = "none";
27+
$("#disable-spotlight")[0].style.display = "none";
28+
$("body").off("mousemove", handleMouseMove);
29+
}
30+
})(jQuery);

src/css/april.scss

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
3+
#spotlight {
4+
position: fixed;
5+
background: black;
6+
opacity: 1;
7+
width: 100vw;
8+
height: 100vh;
9+
top: 0;
10+
left: 0;
11+
z-index: 1000;
12+
pointer-events: none;
13+
@media screen and (max-width: 1024px) {
14+
display: none;
15+
}
16+
}
17+
18+
#disable-spotlight {
19+
position: fixed;
20+
z-index: 999;
21+
right: 50px;
22+
bottom: 20px;
23+
@media screen and (max-width: 1024px) {
24+
display: none;
25+
}
26+
}

src/css/main.scss

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@import 'swiper';
1919
@import 'legals';
2020
@import 'cloud';
21+
@import 'april';
2122

2223
:root {
2324
scroll-behavior: smooth;

0 commit comments

Comments
 (0)