PDA

View Full Version : Javascript Modification


dirkji
01-02-2007, 10:09 AM
I'm looking for a way for my forum users to input guitar tabs (a form of musical notation) into their posts. I saw this at another forum, mailed the owner and he explained me how he did it, but the problem is he's using vBulletin 3.0.3, I use 3.6.3 and I think there have been some modifications.

Here's how he explains it:

**
In the admin panel add two different BBcodes:

1ST BB CODE TO ENTER

Title: formatted Text
Tag: pre
Replacement:
<pre>
{param}
</pre>
Example: preformatted text
Description: for entering preformatted text
Use {option} : Set this radio button to NO

2ND BB CODE TO ENTER

Title: Tabulature
Tag: tab
Replacement: <font face="Courier New,Courier,Fixedsys">{param}</font>
Example:
<br>------------------<br>------------------<br>------------------<br>------------------<br>------------------<br>------------------<br>
Description: Use this tag when inserting tabs into a message so that everything lines up nicely.
Use {option} : Set this radio button to NO
**


Ok, I did this, no problem.


Then he explains:

**UPLOAD via FTP FORCED BINARY the two gifs. Put them in the forum > images > editor folder.
**

Ok, no problem

Then:

**
The only file you will have to FORCED ASCII download via FTP is the .js file from clientscripts folder. Add the lines of code at the bottom like in ours. Then upload your edited .js to the clientscripts FORCED ASCII.
**

He didn't specify which file, but I found out he means the file called "clientscript/vbulletin_stdedit.js". The name of that file must have changed, I guess to "clientscript/vbulletin_textedit.js". The lines of code he added are the following:

// ################################################## ###########################
// function to add preformatted tab to post
function add_tab()
{
getActiveText();
var tab_line = "------------------------------------------------------------------------\n";
var one_tab_row = tab_line + tab_line + tab_line + tab_line + tab_line + tab_line;
var multiple_tab_rows = "";
var tab_rows = prompt("How many rows of tab would you like?", "1");
if ((tab_rows > 0) && (tab_rows <= 10)) {
count = 0;
while (count < tab_rows) {
multiple_tab_rows = multiple_tab_rows + one_tab_row + "\n";
count++;
}
insert_tab_rows = "[code][tab]\n" + multiple_tab_rows + "[\/tab][\/code]\n";
} else {
alert("You must input a number from 1-10.");
insert_tab_rows = ("");
}

AddText(insert_tab_rows);
}

**

So I added them to vbulletin_textedit.js, but that's where I get stuck. Can anybody see where I go wrong and what I can do about it?


Kind Regards,

Dirk

Websites Wanted (http://www.i-buy-websites.com)