では、CoffeeScriptは3.1以降Railsに同梱されていますか?素晴らしい!構文に取り掛かっています。シンプルさが好きです。
それでも、自分のサイトにそれを含める方法がわからないようです。私はそれを間に入れてみましたが、うまくいきませんでした。
これを入れたい.erbファイルnew.html.erbが1つあります(明らかに、これはRailsアプリです)。
<script type="text/coffeescript">
# Countdown to date script provided by JavaScriptKit.com
# http://www.javascriptkit.com/script/script2/count.shtml
montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
countdown(yr,m,d) ->
today=new Date()
todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
todaym=today.getMonth()
todayd=today.getDate()
todaystring=montharray[todaym]+" "+todayd+", "+todayy
futurestring=montharray[m-1]+" "+d+", "+yr
difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
if (difference==0) and document.write(current)
elseif (difference>0) document.write("ONLY "+difference+" DAYS LEFT!")
countdown(2012,4,30)
</script>
そして、それはまったく表示されません。アイデア?