better formatting for notes
This commit is contained in:
@@ -218,13 +218,18 @@ Danbooru.Note = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_text: function($note_body, text) {
|
set_text: function($note_body, text) {
|
||||||
text = text.replace('<tn>', '<p class="tn">');
|
Danbooru.Note.Body.display_text($note_body, text);
|
||||||
text = text.replace('</tn>', '</p>');
|
|
||||||
$note_body.html(text);
|
|
||||||
Danbooru.Note.Body.resize($note_body);
|
Danbooru.Note.Body.resize($note_body);
|
||||||
Danbooru.Note.Body.bound_position($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) {
|
bind_events: function($note_body) {
|
||||||
$note_body.mouseover(function(e) {
|
$note_body.mouseover(function(e) {
|
||||||
var $note_body_inner = $(e.currentTarget);
|
var $note_body_inner = $(e.currentTarget);
|
||||||
@@ -304,7 +309,7 @@ Danbooru.Note = {
|
|||||||
y: $note_box.position().top / ratio,
|
y: $note_box.position().top / ratio,
|
||||||
width: $note_box.width() / ratio,
|
width: $note_box.width() / ratio,
|
||||||
height: $note_box.height() / ratio,
|
height: $note_box.height() / ratio,
|
||||||
body: $note_body.html(),
|
body: $note_body.data("original-body"),
|
||||||
post_id: Danbooru.meta("post-id")
|
post_id: Danbooru.meta("post-id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,12 +199,13 @@ class DText
|
|||||||
def self.sanitize(text)
|
def self.sanitize(text)
|
||||||
Sanitize.clean(
|
Sanitize.clean(
|
||||||
text,
|
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 => {
|
:attributes => {
|
||||||
"a" => %w(href title),
|
"a" => %w(href title style),
|
||||||
"span" => %w(class),
|
"span" => %w(class style),
|
||||||
"div" => %w(class),
|
"div" => %w(class style),
|
||||||
"p" => %w(class)
|
"p" => %w(class style),
|
||||||
|
"font" => %w(color size style)
|
||||||
},
|
},
|
||||||
:protocols => {
|
:protocols => {
|
||||||
"a" => {
|
"a" => {
|
||||||
|
|||||||
Reference in New Issue
Block a user