diff app/assets/javascripts/application.coffee @ 417:080dd141898c

Add support for explicit highlighter languages
author nanaya <me@myconan.net>
date Mon, 14 Sep 2015 14:50:35 +0900
parents c4c8214fb0b2
children f0b4d6bec50e
line wrap: on
line diff
--- a/app/assets/javascripts/application.coffee	Mon Sep 14 14:48:36 2015 +0900
+++ b/app/assets/javascripts/application.coffee	Mon Sep 14 14:50:35 2015 +0900
@@ -65,3 +65,11 @@
 
   format = window.location.hash.slice(1)
   $(".js-show-tab-#{format}").click()
+
+
+$(document).on "ready", ->
+  $languageSelectBox = $("#paste_language")
+  return unless $languageSelectBox.length
+
+  for language in hljs.listLanguages().sort()
+    $languageSelectBox.append $("<option />", value: language, text: language)