Quote:
Originally Posted by zozex
Hi
how can i add a button to the WYSIWYG editor like a real one player button so the song or whatever will be played in the thread like the old tool bar
and thank you
* sorry for the bad english *
|
Open ./includes/functions_editor.php and find this:
PHP Code:
global $datastore, $bbcodecache;
And change to:
PHP Code:
global $datastore, $bbcodecache, $stylevar;
Find this
PHP Code:
foreach ($bbcodecache AS $bbcode)
{
if ($bbcode['buttonimage'] != '')
{
$tag = strtoupper($bbcode['bbcodetag']);
if ($toolbartype == 2)
{
$extrabuttons .= "<td><div class=\"imagebutton\" id=\"cmd_wrap$bbcode[twoparams]_$bbcode[bbcodetag]\"><img src=\"$bbcode[buttonimage]\" alt=\"Wrap [$tag] Tags\" width=\"21\" height=\"20\" /></div></td>\n";
}
else
{
$extrabuttons .= "<td><div class=\"imagebutton\"><a href=\"#\" onclick=\"return vbcode('$tag', '')\"><img src=\"$bbcode[buttonimage]\" alt=\"Wrap [$tag] Tags\" title=\"Wrap [$tag] Tags\" width=\"21\" height=\"20\" border=\"0\" /></a></div></td>\n";
}
}
}
And add this
below:
Code:
if ($toolbartype == 2){
$extrabuttons .= '<td><div class="imagebutton" id="cmd_realone"><img src="' . $stylevar[imgdir_editor] . '/realone.gif" alt="Real One" width="21" height="20" /></div></td>';
}else{
$extrabuttons .= '<td><div class="imagebutton"><a href="#" onclick="return realone()"><img src="' . $stylevar[imgdir_editor] . '/realone.gif" alt="Real One" title="Real One" width="21" height="20" border="0" /></a></div></td>';
}
Be sure to change the bolded
realone to be whatever you want it to be.(leaving it as is is fine... just be sure to upload a realone.gif file to your editor images dir)
Now, open clientscript/vbulletin_wysiwyg.js and find this:
Code:
htmlbox.execCommand(formatcommand, showinterface, extraparameters);
set_context(formatcommand);
And
REPLACE with:
Code:
if(formatcommand == 'realone') {
realone();
}else{
// this was original but outside IF
htmlbox.execCommand(formatcommand, showinterface, extraparameters);
set_context(formatcommand);
}
And open clientscript/vbulletin_global.js and add a function called realone to do whatever you want it to do and you'll be set. It's quite easy actually