# HG changeset patch # User edogawaconan # Date 1404367161 -32400 # Node ID 55287d8a5a0406f704555c062fd253b1140ee705 # Parent 3ce44f960d3a46116ffcde28dea5e6434e961349 coffee: formatter. diff -r 3ce44f960d3a -r 55287d8a5a04 app/assets/javascripts/zp.formatter.js --- a/app/assets/javascripts/zp.formatter.js Thu Jul 03 14:53:46 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -//= require config/marked -//= require config/prettify -(function($) { - window.zp.formatter = { - raw: function() { return $("#pl pre").text() }, - links: function() { return $("#paste-mode a") }, - current: function() { return $("#paste-mode .active a").attr("href").slice(1) }, - markdown: function() { - var area = $("#md div") - area.html(marked(this.raw())) - area.find("pre").addClass("prettyprint") - area.find("a").prop("rel", "nofollow") - }, - highlight: function() { - $("#hl pre").text(this.raw()) - prettyPrint() - }, - init: function() { - this.markdown() - this.highlight() - } - } -})(jQuery) diff -r 3ce44f960d3a -r 55287d8a5a04 app/assets/javascripts/zp.formatter.js.coffee --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/assets/javascripts/zp.formatter.js.coffee Thu Jul 03 14:59:21 2014 +0900 @@ -0,0 +1,18 @@ +#= require config/marked +#= require config/prettify +window.zp.formatter = + raw: -> $("#pl pre").text() + links: -> $("#paste-mode a") + current: -> $("#paste-mode .active a").attr("href").slice(1) + markdown: -> + $("#md div") + .html(marked @raw()) + .find("pre").addClass "prettyprint" + .end() + .find("a").prop "rel", "nofollow" + highlight: -> + $("#hl pre").text @raw() + prettyPrint() + init: -> + @markdown() + @highlight()