Nav's Place: Nav's Home on the Interwebs

Make MyBB Editor Variable Width How-to

I recently tried to make the default editor thats provided with the MyBB forum software variable width.  This is what the editor looked like before the edits..

This is what it looks like after the modifications were made

To do this use your favorite ftp program connect to you MyBB installion directory, browse to /jscripts/ Edit the editor.js file with the following changes (make a backup of this file incase things don’t go the way you had hoped)

Find:

w = oldTextarea.getDimensions().width+”px”;
if(!w || parseInt(w) < 400)
{
w = “400”;
}

Replace with:

/*w = oldTextarea.getDimensions().width+”px”;
if(!w || parseInt(w) < 400)
{
w = “400”;
}*/

Find:

this.editor.style.width = w;

Replace with:

//this.editor.style.width = w;

Find:

areaContainer.style.width = parseInt(Element.getDimensions(this.editor).width)-subtract2+”px”;

Replace with:

areaContainer.style.width = “100%”;

Find:

textInput.style.width = parseInt(areaContainer.style.width)+”px”;

Replace with:

textInput.style.width = “99%”;

That should it be it, save your changes and refresh you page. The editor should now be variable width. I know this probably isn’t the most efficient or elegant or possibly the correct way of doing it but it seems to work. If anyone has any suggestions on how to improve or use a better technique then please let me know :)

You can follow any responses to this entry through the RSS 2.0 feed.