Модификация работы кнопки "цитата". Автор сего чуда -
Uho
Ссылка "цитата", та которая над аватарой
в
posting_buttons.html после
Код: Выделить всё
<script type="text/javascript" src="{T_TEMPLATE_PATH}/editor.js"></script>
добавляем функуцию addsuperquote
Код: Выделить всё
<script type="text/javascript">
function addsuperquote(post_id, username, post_date)
{
var message_name = 'message_' + post_id;
var theSelection = '';
var divarea = false;
if (document.all)
{
divarea = document.all[message_name];
}
else
{
divarea = document.getElementById(message_name);
}
// Get text selection - not only the post content :(
if (window.getSelection)
{
theSelection = window.getSelection().toString();
}
else if (document.getSelection)
{
theSelection = document.getSelection();
}
else if (document.selection)
{
theSelection = document.selection.createRange().text;
}
if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
{
if (divarea.innerHTML)
{
theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
theSelection = theSelection.replace(/<br\/>/ig, '\n');
theSelection = theSelection.replace(/<\;/ig, '<');
theSelection = theSelection.replace(/>\;/ig, '>');
theSelection = theSelection.replace(/&\;/ig, '&');
theSelection = theSelection.replace(/ \;/ig, ' ');
}
else if (document.all)
{
theSelection = divarea.innerText;
}
else if (divarea.textContent)
{
theSelection = divarea.textContent;
}
else if (divarea.firstChild.nodeValue)
{
theSelection = divarea.firstChild.nodeValue;
}
}
if (theSelection)
{
insert_text('[superquote=' + username + ',' + post_id + ',' + post_date + ']' + theSelection + '[/superquote]');
}
return;
}
</script>
в
viewtopic_body.html
заменяем на
Код: Выделить всё
<!-- IF QUICK_REPLY -->
<tr>
<td class="postdetails"><a href="#postform" onclick="addsuperquote({postrow.POST_ID},'{postrow.POSTER_QUOTE}','{postrow.POST_DATE}'); insert_text('\r\n'); return false;" title="{L_QUOTE_TEXT}">{L_QUOTE}</a></td>
</tr>
<!-- ENDIF -->
добавляем невидимый
BBCode
Код: Выделить всё
[superquote={TEXT1},{NUMBER},{TEXT2}]{TEXT3}[/superquote]
Код: Выделить всё
<div class="quotetitle"><a href="./viewtopic.php?p={NUMBER}#p{NUMBER}" title="Добавлено: {TEXT2}">{TEXT1} писал(а):</a></div><div class="quotecontent">{TEXT3}</div>
если хочешь, чтобы без всплывающей подсказки, то замена
HTML BBCode'а должна быть типа такой:
Код: Выделить всё
<div class="quotetitle"><a href="./viewtopic.php?p={NUMBER}#p{NUMBER}">Добавлено: {TEXT2}, {TEXT1} писал(а):</a></div><div class="quotecontent">{TEXT3}</div>
Кнопка цитата. Работает и как ссылка над аватарой (если текст выделен), и как цитирование всего поста (если выделения нет)
идем в
viewtopic_body.html
ищем
Код: Выделить всё
<!-- IF postrow.U_QUOTE --><a href="{postrow.U_QUOTE}">{QUOTE_IMG}</a> <!-- ENDIF -->
заменяем на
Код: Выделить всё
<!-- IF postrow.U_QUOTE --><!-- IF QUICK_REPLY --><a href="#postform" onclick="addsuperquote({postrow.POST_ID},'{postrow.POSTER_QUOTE}','{postrow.POST_DATE}'); insert_text('\r\n'); return false;" title="{L_QUOTE_TEXT}">{QUOTE_IMG}</a><!-- ELSE --><a href="{postrow.U_QUOTE}">{QUOTE_IMG}</a><!-- ENDIF --><!-- ENDIF -->
ищем
Код: Выделить всё
<div class="postbody">{postrow.MESSAGE}</div>
заменяем на
Код: Выделить всё
<div class="postbody" id="message_{postrow.POST_ID}">{postrow.MESSAGE}</div>
ищем
Код: Выделить всё
<!-- IF QUICK_REPLY -->
....
<!-- ENDIF -->
удаляем это или закомменчиваем
идем в
posting_buttons.html
в функции addsuperquote()
заменяем
Код: Выделить всё
theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
theSelection = theSelection.replace(/<br\/>/ig, '\n');
theSelection = theSelection.replace(/<\;/ig, '<');
theSelection = theSelection.replace(/>\;/ig, '>');
theSelection = theSelection.replace(/&\;/ig, '&');
theSelection = theSelection.replace(/ \;/ig, ' ');
на
Код: Выделить всё
window.location='http://адрес_форума/posting.php?mode=quote&f={FORUM_ID}&p='+post_id;