annotate app/assets/javascripts/zp.formatter.js.coffee @ 359:824ac1165404

Update gems.
author edogawaconan <me@myconan.net>
date Tue, 04 Nov 2014 10:42:41 +0900
parents 55287d8a5a04
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()