Mercurial > zeropaste
annotate app/assets/javascripts/zp.formatter.js @ 284:bd29f6af1f1c
Add a bit more padding on footer.
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 16 Oct 2013 04:02:57 +0900 |
parents | 22c4b5f90e24 |
children | c8757469da39 |
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") }, |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
7 current: function() { return this.links().filter(".active").attr("href").slice(1) }, |
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) |