Di_Mok, в subsilver2 у меня так легко не вышло. хотя может я пошел не по самому простому пути)
кстати, dE вроде бы только вкл/выкл элемент...
В общем в /styles/subsilver2/template/editors.js
функция insert_text:
Код: Выделить всё
function insert_text(text, spaces, popup, focus)
{
var textarea;
if (focus === undefined) { var focus = true};
if (!popup)
{
textarea = document.forms[form_name].elements[text_name];
}
else
{
textarea = opener.document.forms[form_name].elements[text_name];
}
if (spaces)
{
text = ' ' + text + ' ';
}
// Since IE9, IE also has textarea.selectionStart, but it still needs to be treated the old way.
// Therefore we simply add a !is_ie here until IE fixes the text-selection completely.
if (!isNaN(textarea.selectionStart) && !is_ie)
{
var sel_start = textarea.selectionStart;
var sel_end = textarea.selectionEnd;
mozWrap(textarea, text, '', focus);
textarea.selectionStart = sel_start + text.length;
textarea.selectionEnd = sel_end + text.length;
}
else if (textarea.createTextRange && textarea.caretPos)
{
if (baseHeight != textarea.caretPos.boundingHeight)
{
if (focus) textarea.focus();
storeCaret(textarea);
}
var caret_pos = textarea.caretPos;
caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
}
else
{
textarea.value = textarea.value + text;
}
if (!popup && focus)
{
textarea.focus();
}
}
тот же файл, функция mozWrap:
Код: Выделить всё
function mozWrap(txtarea, open, close, focus)
{
var selLength = (typeof(txtarea.textLength) == 'undefined') ? txtarea.value.length : txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
var scrollTop = txtarea.scrollTop;
var focus = (focus===undefined) ? true : focus;
if (selEnd == 1 || selEnd == 2)
{
selEnd = selLength;
}
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd);
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
txtarea.selectionStart = selStart + open.length;
txtarea.selectionEnd = selEnd + open.length;
if (focus) txtarea.focus();
txtarea.scrollTop = scrollTop;
return;
}
там же функция addQuote:
Код: Выделить всё
function addquote(post_id, username, l_wrote, focus)
{
if (focus === undefined) { focus = true };
...
if (theSelection)
{
if (bbcodeEnabled)
{
insert_text('[quote="' + username + '"]' + theSelection + '[/quote]', 0, 0, focus);
}
else
{
insert_text(username + ' ' + l_wrote + ':' + '\n', 0, 0, focus);
var lines = split_lines(theSelection);
for (i = 0; i < lines.length; i++)
{
insert_text('> ' + lines[i] + '\n', 0, 0, focus);
}
}
}
затем в /styles/subsilver2/template/viewtopic_body.html
найти:
заменить строку на:
Код: Выделить всё
<td><div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"> <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}">{PROFILE_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_PM --><a href="{postrow.U_PM}">{PM_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_EMAIL --><a href="{postrow.U_EMAIL}">{EMAIL_IMG}</a> <!-- ENDIF --> </div> <div class="gensmall" style="float: {S_CONTENT_FLOW_END};"><!-- IF not S_IS_BOT --><!-- IF S_QUICK_REPLY --><a onclick="if((window.getSelection && window.getSelection().toString() == '') || (document.getSelection && document.getSelection() == '') || (document.selection && document.selection.createRange().text == '')){ alert('{L_NO_SELECTION}'); return false; }else{addquote({postrow.POST_ID},'{postrow.POSTER_QUOTE}', 0, 0); insert_text('\r\n', 0, 0, 0); return false; }" title="{L_QUICKQUOTE_TEXT}">{QUICKQUOTE_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_EDIT --><a href="{postrow.U_EDIT}">{EDIT_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_QUOTE --><a href="{postrow.U_QUOTE}">{QUOTE_IMG}</a> <!-- ENDIF --> <!-- ENDIF --> </div></td>
надеюсь ничего не упустил...
результат: при клике на quickquote не будет скролла к quickreply, но при клике по нику - будет.
Если скролл к полю quickreply не нужен вообще никогда, то можно просто повыкидывать в editors.js textarea.focus(); в соотв.местах.