better formatting for notes
This commit is contained in:
@@ -218,13 +218,18 @@ Danbooru.Note = {
|
||||
},
|
||||
|
||||
set_text: function($note_body, text) {
|
||||
text = text.replace('<tn>', '<p class="tn">');
|
||||
text = text.replace('</tn>', '</p>');
|
||||
$note_body.html(text);
|
||||
Danbooru.Note.Body.display_text($note_body, text);
|
||||
Danbooru.Note.Body.resize($note_body);
|
||||
Danbooru.Note.Body.bound_position($note_body);
|
||||
},
|
||||
|
||||
display_text: function($note_body, text) {
|
||||
text = text.replace(/<tn>/g, '<p class="tn">');
|
||||
text = text.replace(/<\/tn>/g, '</p>');
|
||||
text = text.replace(/\n/g, '<br>');
|
||||
$note_body.html(text);
|
||||
},
|
||||
|
||||
bind_events: function($note_body) {
|
||||
$note_body.mouseover(function(e) {
|
||||
var $note_body_inner = $(e.currentTarget);
|
||||
@@ -304,7 +309,7 @@ Danbooru.Note = {
|
||||
y: $note_box.position().top / ratio,
|
||||
width: $note_box.width() / ratio,
|
||||
height: $note_box.height() / ratio,
|
||||
body: $note_body.html(),
|
||||
body: $note_body.data("original-body"),
|
||||
post_id: Danbooru.meta("post-id")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,12 +199,13 @@ class DText
|
||||
def self.sanitize(text)
|
||||
Sanitize.clean(
|
||||
text,
|
||||
:elements => %w(h1 h2 h3 h4 h5 h6 a span div blockquote br p ul li ol em strong),
|
||||
:elements => %w(tn h1 h2 h3 h4 h5 h6 a span div blockquote br p ul li ol em strong small big b i font),
|
||||
:attributes => {
|
||||
"a" => %w(href title),
|
||||
"span" => %w(class),
|
||||
"div" => %w(class),
|
||||
"p" => %w(class)
|
||||
"a" => %w(href title style),
|
||||
"span" => %w(class style),
|
||||
"div" => %w(class style),
|
||||
"p" => %w(class style),
|
||||
"font" => %w(color size style)
|
||||
},
|
||||
:protocols => {
|
||||
"a" => {
|
||||
|
||||
Reference in New Issue
Block a user