Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions quote-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@

function jsEncode(str){

// ugly hack
str = " " + str;

var aStr = str.split(''), i = aStr.length, aRet = [];
str = str.toString();
str = str.replace(/&/g, '&');
str = str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
str = str.replace(/'/g, '&#039;');
str = str.replace(/"/g, '&quot;');

return str;

while (--i) {
var iC = aStr[i].charCodeAt();

if (iC < 65 || iC > 127 || (iC>90 && iC<97)) {
aRet.push('&#'+iC+';');
} else {
aRet.push(aStr[i]);
}
}

return aRet.reverse().join('');

}


Expand Down Expand Up @@ -50,10 +41,11 @@ function quote(postid, author, commentarea, commentID, mce) {
return true;
}

posttext = posttext.toString();

if (posttext=='') { // quoting entire comment

// quoteing the entire thing
var selection = false;
// quoting the entire thing
var commentID = commentID.split("div-comment-")[1];

// quote entire comment as html
Expand Down Expand Up @@ -94,6 +86,10 @@ function quote(postid, author, commentarea, commentID, mce) {

}

// trim
var posttext = posttext.replace(/^\s+/, "");
var posttext = posttext.replace(/\s+$/, "");

// build quote
if (author) {

Expand All @@ -104,7 +100,7 @@ function quote(postid, author, commentarea, commentID, mce) {

} else {

var quote='\n<blockquote cite="comment-'+postid+'">\n\n'+posttext+'</blockquote>\n';
var quote='<blockquote cite="comment-'+postid+'">\n'+posttext+'\n</blockquote>\n';

}

Expand Down Expand Up @@ -141,7 +137,7 @@ function inlinereply(postid, author, commentarea, commentID, mce) {
author = jsEncode(author);

// build quote
var quote='\n<strong><a href="#comment-'+postid+'">'+unescape(author)+'</a></strong>, \n\n';
var quote='<strong><a href="#comment-'+postid+'">'+unescape(author)+'</a></strong>, \n\n';


// send quoted content
Expand Down
2 changes: 1 addition & 1 deletion quote-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function add_quote_button_filter($output) {

} else {

return($output . $button);
return $output;

}

Expand Down