Commit 0129be36 by Matthew Mongeau

Get highlighting working.

parent ffab52be
...@@ -23,6 +23,8 @@ class @DiscussionThreadView extends DiscussionContentView ...@@ -23,6 +23,8 @@ class @DiscussionThreadView extends DiscussionContentView
Markdown.makeWmdEditor @$(".reply-body"), "", DiscussionUtil.urlFor("upload"), (text) -> DiscussionUtil.postMathJaxProcessor(text) Markdown.makeWmdEditor @$(".reply-body"), "", DiscussionUtil.urlFor("upload"), (text) -> DiscussionUtil.postMathJaxProcessor(text)
@convertMath() @convertMath()
@renderResponses() @renderResponses()
@highlight @$(".post-body")
@highlight @$("h1")
@ @
renderDogear: -> renderDogear: ->
...@@ -151,3 +153,6 @@ class @DiscussionThreadView extends DiscussionContentView ...@@ -151,3 +153,6 @@ class @DiscussionThreadView extends DiscussionContentView
type: "POST" type: "POST"
success: (response, textStatus) => success: (response, textStatus) =>
@model.set('endorsed', not endorsed) @model.set('endorsed', not endorsed)
highlight: (el) ->
el.html(el.html().replace(/&lt;mark&gt;/g, "<mark>").replace(/&lt;\/mark&gt;/g, "</mark>"))
...@@ -12,6 +12,7 @@ class @ThreadListItemView extends Backbone.View ...@@ -12,6 +12,7 @@ class @ThreadListItemView extends Backbone.View
@$el.html(@template(@model.toJSON())) @$el.html(@template(@model.toJSON()))
if window.user.following(@model) if window.user.following(@model)
@follow() @follow()
@highlight @$(".title")
@ @
threadSelected: (event) -> threadSelected: (event) ->
event.preventDefault() event.preventDefault()
...@@ -25,3 +26,6 @@ class @ThreadListItemView extends Backbone.View ...@@ -25,3 +26,6 @@ class @ThreadListItemView extends Backbone.View
addComment: => addComment: =>
@$(".comments-count").html(parseInt(@$(".comments-count").html()) + 1) @$(".comments-count").html(parseInt(@$(".comments-count").html()) + 1)
highlight: (el) ->
el.html(el.html().replace(/&lt;mark&gt;/g, "<mark>").replace(/&lt;\/mark&gt;/g, "</mark>"))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment