view 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
line wrap: on
line source

//= 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)