1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2025-12-10 16:46:42 +01:00
projekteuler/app/assets/javascripts/init.coffee

23 lines
555 B
CoffeeScript

window.App ||= {}
cm = null
loadCodeMirror = ->
$('#translationNav li:first').addClass('active')
$("textarea").each ->
cm = CodeMirror.fromTextArea($(this).get(0), {
lineNumbers: false,
lineWrapping: true,
mode: "text/html"
})
App.init = ->
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
loadCodeMirror();
$(document).on "turbolinks:load", ->
App.init()
$(document).on "click", '#translationNav a[href="#preview"]', ->
$('#preview .problem-content').html(cm.getValue())
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);