diff --git a/app/javascript/legacy/memes.coffee b/app/javascript/legacy/memes.coffee deleted file mode 100644 index 5c2e5101..00000000 --- a/app/javascript/legacy/memes.coffee +++ /dev/null @@ -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 ":^)" \ No newline at end of file diff --git a/app/javascript/packs/application.ts b/app/javascript/packs/application.ts index a36c6552..12161a36 100644 --- a/app/javascript/packs/application.ts +++ b/app/javascript/packs/application.ts @@ -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) \ No newline at end of file diff --git a/app/javascript/packs/legacy.coffee b/app/javascript/packs/legacy.coffee index 4983d8c7..636dbf5c 100644 --- a/app/javascript/packs/legacy.coffee +++ b/app/javascript/packs/legacy.coffee @@ -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' diff --git a/app/javascript/retrospring/features/memes/index.ts b/app/javascript/retrospring/features/memes/index.ts new file mode 100644 index 00000000..fe509ce7 --- /dev/null +++ b/app/javascript/retrospring/features/memes/index.ts @@ -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 = ':^)'; + }); + }); +} \ No newline at end of file