Как создать кнопку "цитировать" без плагинов?

[Удален]
1037

Добрый день всем, всем и, конечно же, всем))

У меня вопрос к знающим программистам.

Есть плагин Wordpress "comment-toolbar".

При соответствующих настройках он интегрирует в поля комментариев кнопки "ответить" и "цитировать".

Плагин работает исправно, правда он загружает скрипт (2 функции) в исходном коде страницы. Мне это не нравится. Как переместить его в footer я не знаю.

Можно ли с помощью кода добавить кнопку "цитировать", функционал которой позволял бы выделять текст в тегах "blockquote", отвечая на комментарии посетителей сайта?

Вот это безобразие красуется у меня в исходном коде (сразу после метатегов description и keywords):

<script type="text/javascript">

/*Плагин для возможности цитирования комментариев*/

function CF_Quote(id, oauthor) {

var otext = document.getElementById('co_' + id);

var otextCommentArea = document.getElementById("comment");

if (otextCommentArea == null)

{

alert("WARNING! Add \"ID=\'comment\'\" into the field <textarea name=\'comment\' ...></textarea> in the file \'comment.php\' of your theme.");

return;

}

if (window.getSelection)

var sel = window.getSelection();

else if (document.getSelection)

var sel = document.getSelection();

else if (document.selection) {

var sel = document.selection.createRange().text; }

if (otext.innerText){

if (sel != "") otextCommentArea.value += "" + oauthor + " комментирует:\n<blockquote>" + sel + "</blockquote>\n";

else otextCommentArea.value += "" + oauthor + " комментирует:\n<blockquote>" + otext.innerText + "</blockquote>\n";

}

else {

if (sel != "") otextCommentArea.value += "" + oauthor + " комментирует:\n<blockquote>" + sel + "</blockquote>\n";

else otextCommentArea.value += "" + oauthor + " комментирует:\n<blockquote>" + otext.textContent + "</blockquote>\n";

}

otextCommentArea.focus();

}

function CF_Reply(id, oauthor) {

var otextCommentArea = document.getElementById("comment");

if (otextCommentArea == null)

{

alert("WARNING! Add \"ID=\'comment\'\" into the field <textarea name=\'comment\' ...></textarea> in the file \'comment.php\' of your theme.");

return;

}

otextCommentArea.value += "@ " + oauthor + ":\n";

otextCommentArea.focus();

}

//-->

</script>

Заранее Вам благодарен.

[Удален]
#1

Всем спасибо за благодарную помощь.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий