deblan.io-murph/assets/js/app/knmc.js
2021-03-29 19:40:55 +02:00

33 lines
858 B
JavaScript

const Knmc = function(w) {
this.window = w;
}
Knmc.prototype.init = function() {
var chars = '';
var seq = '38384040373937396665';
var body = this.window.document.querySelector('body');
body.addEventListener('keyup', function(e) {
chars += e.keyCode.toString();
if (chars.indexOf(seq) !== -1) {
chars = '';
var url = '/bundles/deblanblog/skin2018/frontoffice/img/mario.gif';
var image = new Image();
image.classList.add('fixed');
image.style.position = 'fixed';
image.style.bottom = '-11px';
image.style.left = '-256px';
image.onload = function() {
image.classList.add('knmc');
body.appendChild(image);
}
image.src = url;
}
});
}
module.exports = Knmc