Port Memes to TypeScript

This commit is contained in:
Andreas Nedbal 2022-01-13 23:01:42 +01:00 committed by Andreas Nedbal
parent ef9a08d3fc
commit 1a408e1bc6
4 changed files with 13 additions and 6 deletions

View File

@ -1,5 +0,0 @@
import cheet from 'cheet.js'
cheet 'up up down down left right left right b a', ->
($ "body").addClass 'fa-spin'
($ "p.answerbox__question-text").each (i) -> ($ this).html ":^)"

View File

@ -10,6 +10,7 @@ import initLists from 'retrospring/features/lists';
import initQuestionbox from 'retrospring/features/questionbox';
import initQuestion from 'retrospring/features/question';
import initModeration from 'retrospring/features/moderation';
import initMemes from 'retrospring/features/memes';
start();
document.addEventListener('DOMContentLoaded', initAnswerbox);
@ -20,4 +21,5 @@ document.addEventListener('DOMContentLoaded', initLists);
document.addEventListener('DOMContentLoaded', initQuestionbox);
document.addEventListener('DOMContentLoaded', initQuestion);
document.addEventListener('DOMContentLoaded', initModeration);
document.addEventListener('DOMContentLoaded', initMemes);
document.addEventListener('turbolinks:load', initAnnouncements)

View File

@ -9,7 +9,6 @@ import Cookies from 'js-cookie'
# this file is generated by Rails
import I18n from '../legacy/i18n'
import '../legacy/memes'
import '../legacy/pagination'
import '../legacy/locale-box'
import '../legacy/util'

View File

@ -0,0 +1,11 @@
import cheet from 'cheet.js';
export default (): void => {
cheet('up up down down left right left right b a', () => {
document.body.classList.add('fa-spin');
Array.from(document.querySelectorAll('.answerbox__question-text')).forEach((element: HTMLElement) => {
element.innerText = ':^)';
});
});
}