Port localebox to TypeScript
This commit is contained in:
parent
bee75584d0
commit
7d14e93ada
|
@ -1,4 +0,0 @@
|
||||||
$(document).on 'click', '#locale-switch', (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$('#locales-panel').slideToggle()
|
|
||||||
$("html, body").animate({ scrollTop: $(document).height() }, 1000)
|
|
|
@ -11,6 +11,7 @@ import initQuestionbox from 'retrospring/features/questionbox';
|
||||||
import initQuestion from 'retrospring/features/question';
|
import initQuestion from 'retrospring/features/question';
|
||||||
import initModeration from 'retrospring/features/moderation';
|
import initModeration from 'retrospring/features/moderation';
|
||||||
import initMemes from 'retrospring/features/memes';
|
import initMemes from 'retrospring/features/memes';
|
||||||
|
import initLocales from 'retrospring/features/locales';
|
||||||
|
|
||||||
start();
|
start();
|
||||||
document.addEventListener('DOMContentLoaded', initAnswerbox);
|
document.addEventListener('DOMContentLoaded', initAnswerbox);
|
||||||
|
@ -22,4 +23,5 @@ document.addEventListener('DOMContentLoaded', initQuestionbox);
|
||||||
document.addEventListener('DOMContentLoaded', initQuestion);
|
document.addEventListener('DOMContentLoaded', initQuestion);
|
||||||
document.addEventListener('DOMContentLoaded', initModeration);
|
document.addEventListener('DOMContentLoaded', initModeration);
|
||||||
document.addEventListener('DOMContentLoaded', initMemes);
|
document.addEventListener('DOMContentLoaded', initMemes);
|
||||||
document.addEventListener('turbolinks:load', initAnnouncements)
|
document.addEventListener('turbolinks:load', initAnnouncements);
|
||||||
|
document.addEventListener('turbolinks:load', initLocales);
|
|
@ -7,7 +7,6 @@ import 'bootstrap'
|
||||||
import 'particleground/jquery.particleground.min'
|
import 'particleground/jquery.particleground.min'
|
||||||
|
|
||||||
import '../legacy/pagination'
|
import '../legacy/pagination'
|
||||||
import '../legacy/locale-box'
|
|
||||||
import '../legacy/util'
|
import '../legacy/util'
|
||||||
|
|
||||||
_ready = ->
|
_ready = ->
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import registerEvents from 'utilities/registerEvents';
|
||||||
|
|
||||||
|
function localeSwitchHandler(event: Event): void {
|
||||||
|
event.preventDefault();
|
||||||
|
document.querySelector('#locales-panel').classList.toggle('d-block');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default (): void => {
|
||||||
|
registerEvents([
|
||||||
|
{ type: 'click', target: document.querySelector('#locale-switch'), handler: localeSwitchHandler }
|
||||||
|
]);
|
||||||
|
}
|
Loading…
Reference in New Issue