replace comment links with usernames
This commit is contained in:
parent
0351ffcd28
commit
f9de9ece21
2 changed files with 9 additions and 1 deletions
|
@ -38,7 +38,7 @@ class BBCode extends FormatterExtension {
|
|||
$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "<i>\\1</i>", $text);
|
||||
$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "<u>\\1</u>", $text);
|
||||
$text = preg_replace("/\[s\](.*?)\[\/s\]/s", "<s>\\1</s>", $text);
|
||||
$text = preg_replace("/>>(\d+)(#c?(\d+))?/s", "<a href=\"".make_link("post/view/\\1#c\\3")."\" onclick=\"$('#c\\3').effect('highlight', {}, 5000);\">>>\\1\\2</a>", $text);
|
||||
$text = preg_replace("/>>(\d+)(#c?(\d+))?/s", "<a class='comment_link' href=\"".make_link("post/view/\\1#c\\3")."\" onclick=\"$('#c\\3').effect('highlight', {}, 5000);\">>>\\1\\2</a>", $text);
|
||||
$text = preg_replace("/(^|\s)#(\d+)/s", "\\1<a href=\"#\\2\">#\\2</a>", $text);
|
||||
$text = preg_replace("/>>([^\d].+)/", "<blockquote><small>\\1</small></blockquote>", $text);
|
||||
$text = preg_replace("/\[url=((?:https?|ftp|irc|mailto):\/\/.*?)\](.*?)\[\/url\]/s", "<a href=\"\\1\">\\2</a>", $text);
|
||||
|
|
|
@ -51,6 +51,14 @@ $(document).ready(function() {
|
|||
a = document.getElementById("nextlink");
|
||||
a.href = a.href + '?' + query;
|
||||
}
|
||||
|
||||
$(".comment_link").each(function(idx, elm) {
|
||||
var target_id = $(elm).text().match(/#c\d+/);
|
||||
if(target_id && $(target_id)) {
|
||||
var target_name = $(target_id+" .username").html();
|
||||
$(elm).html("@"+target_name);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
Reference in a new issue