Mercurial > zeropaste
comparison app/assets/javascripts/zp.formatter.js @ 214:22c4b5f90e24
Massive javascript and html refactor. Also, ie9
author | Edho Arief <edho@myconan.net> |
---|---|
date | Sun, 12 May 2013 02:43:38 +0900 |
parents | |
children | c8757469da39 |
comparison
equal
deleted
inserted
replaced
213:0993715b455d | 214:22c4b5f90e24 |
---|---|
1 //= require config/marked | |
2 //= require config/prettify | |
3 (function($) { | |
4 window.zp.formatter = { | |
5 raw: function() { return $("#pl pre").text() }, | |
6 links: function() { return $("#paste-mode a") }, | |
7 current: function() { return this.links().filter(".active").attr("href").slice(1) }, | |
8 markdown: function() { | |
9 var area = $("#md div") | |
10 area.html(marked(this.raw())) | |
11 area.find("pre").addClass("prettyprint") | |
12 area.find("a").prop("rel", "nofollow") | |
13 }, | |
14 highlight: function() { | |
15 $("#hl pre").text(this.raw()) | |
16 prettyPrint() | |
17 }, | |
18 init: function() { | |
19 this.markdown() | |
20 this.highlight() | |
21 } | |
22 } | |
23 })(jQuery) |