This really isn't a full mod, but I didn't know where else to post this.
The bug is when using the javascript formating options, such as bold, italics, etc, in a textbox with enough lines of text to have scroll bars, the textbox scrolls all the way to the top.
This easy fix keeps the scroll bar where it is when click the formating buttons.
Open inc_code.js and find the following function AddText
Code needs to be placed at the beginning of the function and at the end of the function:
Paste the following
var crtScrollTop;
var crtScrollLeft;
try {
var tarea = document.PostTopic.Message;
if (typeof tarea.scrollTop != 'undefined') {
crtScrollTop = tarea.scrollTop;
crtScrollLeft = tarea.scrollLeft;
}
} catch (e) {};
at the top, immediatly after function AddText(text) {
Then, at the bottom of the function, paste the following:
;
try {
var tarea = document.PostTopic.Message;
if (typeof tarea.scrollTop != 'undefined') {
tarea.scrollTop = crtScrollTop;
tarea.scrollLeft = crtScrollLeft;
}
} catch (e) {};
immediately BEFORE the closing } of the function.
That's it.
If you haven't made any changes to your javascript then the default function, as being used by this forum right now, would look like this where new code is blue and old code is red.
function AddText(text) {
var crtScrollTop;
var crtScrollLeft;
try {
var tarea = document.PostTopic.Message;
if (typeof tarea.scrollTop != 'undefined') {
crtScrollTop = tarea.scrollTop;
crtScrollLeft = tarea.scrollLeft;
}
} catch (e) {};
var tarea = document.PostTopic.Message;
if (typeof tarea.selectionStart != 'undefined'){ // if it supports DOM2
start = tarea.selectionStart;
end = tarea.selectionEnd;
tarea.value = tarea.value.substr(0,tarea.selectionStart)
+ text + tarea.value.substr(tarea.selectionEnd);
tarea.focus();
tarea.selectionStart = ((start - end) == 0) ? start + text.length : start;
tarea.selectionEnd = start + text.length;
} else {
if (tarea.createTextRange && tarea.caretPos) {
var caretPos = tarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else {
tarea.value += text;
}
tarea.focus(caretPos);
};
try {
var tarea = document.PostTopic.Message;
if (typeof tarea.scrollTop != 'undefined') {
tarea.scrollTop = crtScrollTop;
tarea.scrollLeft = crtScrollLeft;
}
} catch (e) {};
}
<