35 lines
752 B
JavaScript
35 lines
752 B
JavaScript
const Mario = require('../../images/mario.gif')
|
|
|
|
const Knmc = function (w) {
|
|
this.window = w
|
|
}
|
|
|
|
Knmc.prototype.init = function () {
|
|
let chars = ''
|
|
const seq = '38384040373937396665'
|
|
const body = this.window.document.querySelector('body')
|
|
|
|
body.addEventListener('keyup', function (e) {
|
|
chars += e.keyCode.toString()
|
|
|
|
if (chars.indexOf(seq) !== -1) {
|
|
chars = ''
|
|
const url = Mario
|
|
const 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
|