Mercurial > zeropaste
annotate app/assets/javascripts/zp.formatter.js @ 347:3ce44f960d3a
coffee: autosize_box_fix.
author | edogawaconan <me@myconan.net> |
---|---|
date | Thu, 03 Jul 2014 14:53:46 +0900 |
parents | c8757469da39 |
children |
rev | line source |
---|---|
214
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
1 //= require config/marked |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
2 //= require config/prettify |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
3 (function($) { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
4 window.zp.formatter = { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
5 raw: function() { return $("#pl pre").text() }, |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
6 links: function() { return $("#paste-mode a") }, |
288 | 7 current: function() { return $("#paste-mode .active a").attr("href").slice(1) }, |
214
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
8 markdown: function() { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
9 var area = $("#md div") |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
10 area.html(marked(this.raw())) |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
11 area.find("pre").addClass("prettyprint") |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
12 area.find("a").prop("rel", "nofollow") |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
13 }, |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
14 highlight: function() { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
15 $("#hl pre").text(this.raw()) |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
16 prettyPrint() |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
17 }, |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
18 init: function() { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
19 this.markdown() |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
20 this.highlight() |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
21 } |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
22 } |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
23 })(jQuery) |