From e78507a7ccd2f72797cf1067db5cc1182e35dac9 Mon Sep 17 00:00:00 2001 From: "Glitch (hello-webpage)" Date: Sun, 6 Oct 2019 19:14:50 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=BD=F0=9F=95=8B=20Checkpoint=20./confe?= =?UTF-8?q?tti.js:7435365/2847=20./script.js:7435365/4233=20./index.html:7?= =?UTF-8?q?435365/336=20./style.css:7435365/767?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- confetti.js | 1 + index.html | 4 +++- script.js | 67 +++++++++++++++++++++++++++++------------------------ style.css | 17 ++++++++++++++ 4 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 confetti.js diff --git a/confetti.js b/confetti.js new file mode 100644 index 0000000..702450d --- /dev/null +++ b/confetti.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).ConfettiGenerator=t()}(this,function(){"use strict";return function(e){var i={target:"confetti-holder",max:80,size:1,animate:!0,props:["circle","square","triangle","line"],colors:[[165,104,246],[230,61,135],[0,199,228],[253,214,126]],clock:25,interval:null,rotate:!1,width:window.innerWidth,height:window.innerHeight};e&&(e.target&&(i.target=e.target),e.max&&(i.max=e.max),e.size&&(i.size=e.size),null!=e.animate&&(i.animate=e.animate),e.props&&(i.props=e.props),e.colors&&(i.colors=e.colors),e.clock&&(i.clock=e.clock),e.width&&(i.width=e.width),e.height&&(i.height=e.height),null!=e.rotate&&(i.rotate=e.rotate));var t=document.getElementById(i.target),a=t.getContext("2d"),r=[];function o(e,t){e||(e=1);var r=Math.random()*e;return t?Math.floor(r):r}var n=i.props.reduce(function(e,t){return e+(t.weight||1)},0);function s(){var e=i.props[function(){for(var e=Math.random()*n,t=0;t

-
+
+ + π diff --git a/script.js b/script.js index e7eea22..d879fa2 100644 --- a/script.js +++ b/script.js @@ -1,48 +1,49 @@ var birthday = { now: null, day: 25, - month: 6, // June + month: 6, // June match: false, check: function() { this.now = new Date(); - if (this.now.getDate() == this.day && this.now.getMonth() + 1 == this.month) this.activate() - else this.deactivate() + if (this.now.getDate() == this.day && this.now.getMonth() + 1 == this.month) + this.activate(); + else this.deactivate(); }, activate: function() { - document.getElementById('isit').innerHTML = "Yes!" - elementClass.remove(document.getElementById('isit'), 'nope') - elementClass.add(document.getElementById('isit'), 'yep') + document.getElementById("isit").innerHTML = "Yes!"; + elementClass.remove(document.getElementById("isit"), "nope"); + elementClass.add(document.getElementById("isit"), "yep"); confetti.render(); }, deactivate: function() { - document.getElementById('isit').innerHTML = "No" - elementClass.remove(document.getElementById('isit'), 'yep') - elementClass.add(document.getElementById('isit'), 'nope') + document.getElementById("isit").innerHTML = "No"; + elementClass.remove(document.getElementById("isit"), "yep"); + elementClass.add(document.getElementById("isit"), "nope"); confetti.clear(); } -} +}; var confetti = { displayed: false, confetti: null, - target: 'confetti-holder', + target: "confetti-holder", max: null, size: 1, animate: true, - props: ['circle', 'square', 'triangle', 'line'], - colors: [[165,104,246], [230,61,135], [0,199,228], [253,214,126]], + props: ["circle", "square", "triangle", "line"], + colors: [[165, 104, 246], [230, 61, 135], [0, 199, 228], [253, 214, 126]], clock: 25, rotate: true, width: null, height: null, render: function() { - this.width = window.innerWidth - this.height = window.innerHeight - this.max = Math.floor(this.width * this.height / 1799.04) + this.width = window.innerWidth; + this.height = window.innerHeight; + this.max = Math.floor((this.width * this.height) / 1799.04); if (this.confetti) this.confetti.clear(); - this.confetti = new ConfettiGenerator(this) + this.confetti = new ConfettiGenerator(this); this.confetti.render(); this.displayed = true; }, @@ -52,31 +53,37 @@ var confetti = { this.confetti.clear(); this.displayed = false; } -} +}; var elementClass = { has: function(e, c) { - return !!e.className.match(new RegExp('(\\s|^)' + c + '(\\s|$)')); + return !!e.className.match(new RegExp("(\\s|^)" + c + "(\\s|$)")); }, add: function(e, c) { - if (!this.has(e,c)) e.className += " " + c; + if (!this.has(e, c)) e.className += " " + c; }, remove: function(e, c) { - if (this.has(e,c)) { - var r = new RegExp('(\\s|^)' + c + '(\\s|$)'); - e.className=e.className.replace(r, ' '); + if (this.has(e, c)) { + var r = new RegExp("(\\s|^)" + c + "(\\s|$)"); + e.className = e.className.replace(r, " "); } - }, -} + } +}; window.onload = function() { birthday.check(); + + document.getElementById('pilink') }; -window.addEventListener('resize', function() { - if (confetti.displayed) confetti.render(); -}, false); +window.addEventListener( + "resize", + function() { + if (confetti.displayed) confetti.render(); + }, + false +); -window.setInterval(function(){ +window.setInterval(function() { birthday.check(); -}, 5000); +}, 5000); \ No newline at end of file diff --git a/style.css b/style.css index 68d1d15..13edb62 100644 --- a/style.css +++ b/style.css @@ -31,6 +31,23 @@ body { font-size: 16vw; } +#pilink { + position: fixed; + bottom: 1vw; + right: 1vw; + font-family: 'Times New Roman', serif; + font-size: 1.2vw; +} + +#pilink a { + text-decoration: none; + color: #6e7f80; +} + +#pilink a:hover { + color: #FF0000; +} + p.nope { color: #888888; }