Skip to content

Commit

Permalink
Update halloween.
Browse files Browse the repository at this point in the history
  • Loading branch information
ganlvtech committed Oct 31, 2018
1 parent c5201db commit ab9b75c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
55 changes: 43 additions & 12 deletions src/easter-eggs/halloween.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
const css = `
body {
background-color: rgba(0, 0, 0, 1);
}
body * {
background-color: rgba(0,0,0, 0.2)!important;
import toastr from 'toastr';

const STYLESHEET = {
0: `
body, body * {
transition: color 1s, background-color 1s, border-color 1s;
-moz-transition: color 1s, background-color 1s, border-color 1s;
-webkit-transition: color 1s, background-color 1s, border-color 1s;
-o-transition: color 1s, background-color 1s, border-color 1s;
}`,

1000: `
body {
background-color: #000;
}`,

2000: `
body * {
background-color: rgba(0, 0, 0, 0.2) !important;
color: #fff !important;
border-color: #fff !important;
}`;
}`
}

var style = document.createElement('style');
style.type = 'text/css';
function addStyle(css) {
let style = document.createElement('style');
style.type = 'text/css';

if (style.styleSheet) { // IE
if (style.styleSheet) { // IE
style.styleSheet.cssText = css;
} else {
} else {
style.appendChild(document.createTextNode(css));
}

document.getElementsByTagName('head')[0].appendChild(style);
}

document.getElementsByTagName('head')[0].appendChild(style);
export function init() {
setTimeout(function() {
addStyle(STYLESHEET[0]);
setTimeout(function() {
addStyle(STYLESHEET[1000]);
setTimeout(function() {
addStyle(STYLESHEET[2000]);
setTimeout(function() {
toastr.info('Happy Halloween!');
}, 3000);
}, 2000);
}, 1000);
}, 0);
}
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ window.Down52PojieCn = Down52PojieCn;
const moment = require('moment');
let date = moment().format("MMDD")
if (date === '1030' || date === '1031' || date === '1101') {
require('./easter-eggs/halloween');
const halloween = require('./easter-eggs/halloween');
halloween.init();
}
})();

0 comments on commit ab9b75c

Please sign in to comment.