Quote:
Originally Posted by avpro
Хелп мне нуна...
|
В конец файла vbulletin_quick_reply.js добавь:
Code:
function Insert(nickname, text, postnb)
{
if (text != "")
{ paste("
Quote:
Originally Posted by + nickname + ";" + postnb +
" + text + "
|
\n", 0);
vB_Editor[QR_EditorID].wysiwyg_mode ? '' : document.vbform.message.focus();
}
else {alert('Ìû âîçäóõ íå öèòèðóåì!');}
}
function paste(text)
{
vB_Editor[QR_EditorID].check_focus();
var ot = vB_Editor[QR_EditorID].get_editor_contents();
if(ot == '<br />' || ot == '<br>' || ot == '<BR>' || ot == '<P> </P>' || ot == ' ' || ot == '<BR />' || ot == '<br>' || ot == '<b></b>' || ot == '<b></b><br>' || ot == '<P></P>')
{
ot = '';
}
if(ot != '')
{
ot += (vB_Editor[QR_EditorID].wysiwyg_mode?'<br>':'\n');
}
vB_Editor[QR_EditorID].write_editor_contents(ot + text, false);
}
function get_selection()
{
if (document.getSelection)
{
selection = document.getSelection();
selection = selection.replace(/\r\n\r\n/gi, "_doublecaret_");
selection = selection.replace(/\r\n/gi, " ");
while (selection.indexOf(" ") != -1) selection = selection.replace(/ /gi, "");
selection = selection.replace(/_doublecaret_/gi, "\r\n\r\n");
}
else
selection = document.selection.createRange().text;
}
function catchSelection()
{
if (window.getSelection)
{
selection = window.getSelection().toString();
}
else if (document.getSelection)
{
selection = document.getSelection();
}
else if (document.selection)
{
selection = document.selection.createRange().text;
}
}
Далее в шаблоне postbit_legacy в участок кода controls добавь:
HTML Code:
<if condition="$show['quickreply'] AND !$show['threadedmode']">
<a href="javascript:Insert('$post[username]', selection, '$post[postid]')" onMouseOver="catchSelection()"><img src="$stylevar[imgdir_button]/quote_selected.gif" alt="$vbphrase[quote_selected]" border="0" /></a>
</if>
And be done with it!
Добавлено через 2 минуты
Quote:
Originally Posted by Sell
В конец файла vbulletin_quick_reply.js добавь:
|
Эм прошу прощения (я не могу редактировать свои посты) код должен выглядеть так:
[code]function Insert(nickname, text, postnb)
{
if (text != "")
{ paste("[quote=" + nickname + ";" + postnb + "]" + text + "[/quote]\n", 0);
vB_Editor[QR_EditorID].wysiwyg_mode ? '' : document.vbform.message.focus();
}
else {alert('Сообщение об ошибке');}
}
function paste(text)
{
vB_Editor[QR_EditorID].check_focus();
var ot = vB_Editor[QR_EditorID].get_editor_contents();
if(ot == '<br />' || ot == '<br>' || ot == '<BR>' || ot == '<P> </P>' || ot == ' ' || ot == '<BR />' || ot == '<br>' || ot == '<b></b>' || ot == '<b></b><br>' || ot == '<P></P>')
{
ot = '';
}
if(ot != '')
{
ot += (vB_Editor[QR_EditorID].wysiwyg_mode?'<br>':'\n');
}
vB_Editor[QR_EditorID].write_editor_contents(ot + text, false);
}
function get_selection()
{
if (document.getSelection)
{
selection = document.getSelection();
selection = selection.replace(/\r\n\r\n/gi, "_doublecaret_");
selection = selection.replace(/\r\n/gi, " ");
while (selection.indexOf(" ") != -1) selection = selection.replace(/ /gi, "");
selection = selection.replace(/_doublecaret_/gi, "\r\n\r\n");
}
else
selection = document.selection.createRange().text;
}
function catchSelection()
{
if (window.getSelection)
{
selection = window.getSelection().toString();
}
else if (document.getSelection)
{
selection = document.getSelection();
}
else if (document.selection)
{
selection = document.selection.createRange().text;
}
}[/code]