Commit f2deb9de authored by Lukas Fülling's avatar Lukas Fülling

fix error page

parent efcd2c74
import ready from '../mastodon/ready';
ready(() => {
const image = document.querySelector('img');
image.addEventListener('mouseenter', () => {
image.src = '/oops.gif';
const soul = {
'up': [
'̍', '̎', '̄', '̅',
'̿', '̑', '̆', '̐',
'͒', '͗', '͑', '̇',
'̈', '̊', '͂', '̓',
'̈', '͊', '͋', '͌',
'̃', '̂', '̌', '͐',
'̀', '́', '̋', '̏',
'̒', '̓', '̔', '̽',
'̉', 'ͣ', 'ͤ', 'ͥ',
'ͦ', 'ͧ', 'ͨ', 'ͩ',
'ͪ', 'ͫ', 'ͬ', 'ͭ',
'ͮ', 'ͯ', '̾', '͛',
'͆', '̚',
],
'down': [
'̖', '̗', '̘', '̙',
'̜', '̝', '̞', '̟',
'̠', '̤', '̥', '̦',
'̩', '̪', '̫', '̬',
'̭', '̮', '̯', '̰',
'̱', '̲', '̳', '̹',
'̺', '̻', '̼', 'ͅ',
'͇', '͈', '͉', '͍',
'͎', '͓', '͔', '͕',
'͖', '͙', '͚', '̣',
],
'mid': [
'̕', '̛', '̀', '́',
'͘', '̡', '̢', '̧',
'̨', '̴', '̵', '̶',
'͜', '͝', '͞',
'͟', '͠', '͢', '̸',
'̷', '͡', ' ҉',
],
};
let all = [].concat(soul.up, soul.down, soul.mid);
let zalgo = {};
function randomNumber(range) {
return Math.floor(Math.random() * range);
}
function is_char(character) {
let bool = false;
all.filter(function (i) {
bool = (i === character);
});
return bool;
}
zalgo.heComes = function (text, options) {
let result = '';
options = options || {};
options.up = options.up || true;
options.mid = options.mid || true;
options.down = options.down || true;
options.size = options.size || 'maxi';
let counts;
text = text.split('');
for (let l in text) {
// noinspection JSUnfilteredForInLoop
if (is_char(l)) {
continue;
}
// noinspection JSUnfilteredForInLoop
result = result + text[l];
counts = { 'up': 0, 'down': 0, 'mid': 0 };
switch (options.size) {
case 'mini':
counts.up = randomNumber(8);
counts.min = randomNumber(2);
counts.down = randomNumber(8);
break;
case 'maxi':
counts.up = randomNumber(16) + 3;
counts.min = randomNumber(4) + 1;
counts.down = randomNumber(64) + 3;
break;
default:
counts.up = randomNumber(8) + 1;
counts.mid = randomNumber(6) / 2;
counts.down = randomNumber(8) + 1;
break;
}
let arr = ['up', 'mid', 'down'];
for (let d in arr) {
let index = arr[d];
for (let i = 0; i <= counts[index]; i++) {
if (options[index]) {
result = result + soul[index][randomNumber(soul[index].length)];
}
}
}
}
return result;
};
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('message').innerHTML = zalgo.heComes(document.getElementById('message').innerText, { size: 'mini' });
});
});
......@@ -15,4 +15,3 @@
%img{ alt: Setting.default_settings['site_title'], src: '/oops.gif' }/
.dialog__message
%h1#message= yield :content
%script{:src => "/zalgo.js", :type => "text/javascript"}
const soul = {
'up': [
'̍', '̎', '̄', '̅',
'̿', '̑', '̆', '̐',
'͒', '͗', '͑', '̇',
'̈', '̊', '͂', '̓',
'̈', '͊', '͋', '͌',
'̃', '̂', '̌', '͐',
'̀', '́', '̋', '̏',
'̒', '̓', '̔', '̽',
'̉', 'ͣ', 'ͤ', 'ͥ',
'ͦ', 'ͧ', 'ͨ', 'ͩ',
'ͪ', 'ͫ', 'ͬ', 'ͭ',
'ͮ', 'ͯ', '̾', '͛',
'͆', '̚',
],
'down': [
'̖', '̗', '̘', '̙',
'̜', '̝', '̞', '̟',
'̠', '̤', '̥', '̦',
'̩', '̪', '̫', '̬',
'̭', '̮', '̯', '̰',
'̱', '̲', '̳', '̹',
'̺', '̻', '̼', 'ͅ',
'͇', '͈', '͉', '͍',
'͎', '͓', '͔', '͕',
'͖', '͙', '͚', '̣',
],
'mid': [
'̕', '̛', '̀', '́',
'͘', '̡', '̢', '̧',
'̨', '̴', '̵', '̶',
'͜', '͝', '͞',
'͟', '͠', '͢', '̸',
'̷', '͡', ' ҉',
],
};
let all = [].concat(soul.up, soul.down, soul.mid);
let zalgo = {};
function randomNumber(range) {
return Math.floor(Math.random() * range);
}
function is_char(character) {
let bool = false;
all.filter(function (i) {
bool = (i === character);
});
return bool;
}
zalgo.heComes = function (text, options) {
let result = '';
options = options || {};
options.up = options.up || true;
options.mid = options.mid || true;
options.down = options.down || true;
options.size = options.size || 'maxi';
let counts;
text = text.split('');
for (let l in text) {
if (is_char(l)) {
continue;
}
result = result + text[l];
counts = { 'up': 0, 'down': 0, 'mid': 0 };
switch (options.size) {
case 'mini':
counts.up = randomNumber(8);
counts.min = randomNumber(2);
counts.down = randomNumber(8);
break;
case 'maxi':
counts.up = randomNumber(16) + 3;
counts.min = randomNumber(4) + 1;
counts.down = randomNumber(64) + 3;
break;
default:
counts.up = randomNumber(8) + 1;
counts.mid = randomNumber(6) / 2;
counts.down = randomNumber(8) + 1;
break;
}
let arr = ['up', 'mid', 'down'];
for (let d in arr) {
let index = arr[d];
for (let i = 0; i <= counts[index]; i++) {
if (options[index]) {
result = result + soul[index][randomNumber(soul[index].length)];
}
}
}
}
return result;
};
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('message').innerHTML = zalgo.heComes(document.getElementById('message').innerText, { size: 'mini' });
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment