annotate app/assets/javascripts/zp.formatter.coffee @ 380:2ddd61aca2c8

I18n. And refactor paste privacy settings form.
author nanaya <me@myconan.net>
date Sun, 07 Jun 2015 02:45:49 +0900
parents 5a4d31e97937
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
348
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
1 #= require config/marked
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
2 #= require config/prettify
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
3 window.zp.formatter =
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
4 raw: -> $("#pl pre").text()
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
5 links: -> $("#paste-mode a")
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
6 current: -> $("#paste-mode .active a").attr("href").slice(1)
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
7 markdown: ->
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
8 $("#md div")
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
9 .html(marked @raw())
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
10 .find("pre").addClass "prettyprint"
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
11 .end()
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
12 .find("a").prop "rel", "nofollow"
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
13 highlight: ->
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
14 $("#hl pre").text @raw()
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
15 prettyPrint()
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
16 init: ->
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
17 @markdown()
55287d8a5a04 coffee: formatter.
edogawaconan <me@myconan.net>
parents: 288
diff changeset
18 @highlight()