secretsanta/pairing.html

195 lines
5.5 KiB
HTML
Executable file

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Secret Santa Pairing</title>
<script src="vendors/Lodash-3.10.1.js"></script>
<script src="vendors/Cryptojs.aes-3.1.2.js"></script>
<style>
* {
box-sizing: border-box;
}
html, body, .main {
margin: 0;
width: 100%;
height: 100%;
padding: 0;
}
body {
background: url(./assets/snow.png), url(./assets/santa.png), url(./assets/snow.png), radial-gradient(#FB3B3B, #EF3D3D);
background-repeat: repeat, no-repeat, repeat, no-repeat;
animation-name: snow;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
font-family: 'Comic Sans MS';
}
@keyframes snow {
from { background-position: 130px 40px, bottom right, 0 0, 0 0; }
to { background-position: 130px 640px, bottom right, 0 300px, 0 0; }
}
.spirit-of-christmas {
display: block;
position: absolute;
bottom: 0;
left: 0;
padding: 20px;
font-size: 12px;
text-decoration: none;
color: #FFFFFF;
}
.main {
display: flex;
}
.background {
position: absolute;
left: 0;
bottom: 0;
}
.wrapper {
margin: auto;
padding: 20px;
background: repeating-linear-gradient(
45deg,
#5CC48A,
#5CC48A 30px,
#FFFFFF 30px,
#FFFFFF 60px,
#EF3D3D 60px,
#EF3D3D 90px,
#FFFFFF 90px,
#FFFFFF 120px
);
box-shadow: 3px 3px 10px rgba(0, 0, 0, .5);
}
.content {
padding: 40px;
background: #ffffff;
text-align: center;
}
.title {
font-size: 30px;
}
#pairing-name {
font-size: 90px;
}
#pairing-details {
margin-top: 20px;
margin-bottom: 20px;
font-size: 20px;
}
.affiliate {
display: block;
box-sizing: content-box;
margin-top: 40px;
border: none;
background: rgba(255, 255, 255, .7);
}
.affiliate + .affiliate {
margin-top: 40px;
}
</style>
<script>
var queryString = _.chain( location.search.slice( 1 ).split( /&/g ) )
.map( function ( item ) { if ( item ) return item.split( /=/ ).map( function ( str ) { return decodeURIComponent( str ); } ); } )
.compact().object().value();
var name = queryString.name;
var pairing = CryptoJS.AES.decrypt( queryString.pairing, queryString.key ).toString(CryptoJS.enc.Utf8);
var pairingDefinition = pairing.match( /^([^(]+)(?: \(([^)]+)\))?$/ );
</script>
</head>
<body>
<div class="main">
<div class="wrapper">
<div class="content">
<div class="title">
Hej <span id="name"></span>!<br>
Your secret child is (drum roll<span id="drum-roll"></span>)
</div>
<script>document.getElementById('name').innerText = name</script>
<div class="pairing" id="pairing-box">
<div id="pairing-name"></div>
<div id="pairing-details"></div>
<script>
document.getElementById('pairing-name').innerText = pairingDefinition[1];
if (pairingDefinition[2]) {
document.getElementById('pairing-details').innerHTML = pairingDefinition[2].replace(/\|/g, '<br>');
} else {
document.getElementById('pairing-details').style.display = 'none';
}
</script>
</div>
<script>
document.getElementById('pairing-box').style.color = 'white';
intervalId = window.setInterval(function() {
document.getElementById('drum-roll').innerText += '.';
}, 200);
window.setTimeout(function() {
document.getElementById('pairing-box').style.color = 'inherit';
clearInterval(intervalId);
}, 3000);
</script>
<div class="title">
May you bring them joy and happiness with your gift!
</div>
</div>
</div>
<a href="https://louis.hostux.fr/secretsanta/" class="spirit-of-christmas">
Want to start your own Secret Santa with your friends? Click here to get started!
</a>
</div>
</body>
</html>