22 lines
521 B
JavaScript
22 lines
521 B
JavaScript
export function span(text) {
|
|
const s = document.createElement('span');
|
|
s.textContent = text;
|
|
return s;
|
|
}
|
|
export function popup(text) {
|
|
const d = document.createElement('div');
|
|
d.className = 'popup';
|
|
const s = span(text);
|
|
d.appendChild(s);
|
|
d.onanimationend = () => {
|
|
d.remove();
|
|
};
|
|
document.body.appendChild(d);
|
|
}
|
|
export function shuffle(array) {
|
|
for (let i = array.length - 1; i > 0; i--) {
|
|
let j = Math.floor(Math.random() * (i + 1));
|
|
[array[i], array[j]] = [array[j], array[i]];
|
|
}
|
|
}
|