sz1
03-05-2012, 07:28 AM
Hi,
I have installed the latex editor for my forum, so that mathematical expressions within [TEX] BBCodes can be converted automatically to a respectable image. For the integration into vB, I used the addon vLatex (https://vborg.vbsupport.ru/showthread.php?t=230589), which is actually only compatible till vB 4.0.4. The corresponding developer does not seem to be active anymore. I run my forum with version 4.1.10 - nonetheless, the addon works except for one small thing.
When writing a post, there is a small but very handy Quick Menu.
https://vborg.vbsupport.ru/attachment.php?attachmentid=136850&stc=1&d=1330935700
It should speed up and simplify the use of latex. By clicking on an icon, the appropriate BBCode should then be inserted in the editor. That just does?nt happen. If you click on an icon, simply nothing happens. As I understand it, this menu is controlled via a JavaScript, which is presented as follows. I only know that the editor has changed since 4.0.4 vB very much. I hope someone can help me there because my Java knowledge is very limited or not available.
window.status = 'actualizado';
vB_Text_Editor.prototype.pod_vlatex_insertcommand = function (code)
{
if (this.wysiwyg_mode)
{
while (code.indexOf('{br}') != -1) code = code.replace('{br}', '<br />');
}
else
{
while (code.indexOf('{br}') != -1) code = code.replace('{br}', "\n");
}
var anchorpos = code.indexOf('#');
if (anchorpos == -1)
{
this.insert_text(code+' ', code.length+1);
}
else
{
var seltext = this.get_selection();
if ((seltext === false) || (seltext.length == 0))
{
seltext = "";
}
else
{
seltext = new String(seltext);
}
var precode = code.substring(0, anchorpos);
var poscode = code.substring(anchorpos+1);
this.insert_text(precode + seltext + poscode+' ', precode.length, poscode.length+1);
}
}
vB_Text_Editor.prototype.pod_vlatex_init = function()
{
this.vlatex_commandmenu = document.getElementById('vlatex_commandmenu');
if (is_ie)
{ var buttonTagName = 'img'; }
else
{ var buttonTagName = 'li'; }
var buttons = this.vlatex_commandmenu.getElementsByTagName(butto nTagName);
for (var i=0; i < buttons.length; i++)
{
buttons[i].editorid = this.editorid;
buttons[i].onclick = function () { vB_Editor[this.editorid].check_focus(); };
buttons[i].onmousedown = function () {
if (is_ie)
{ vB_Editor[this.editorid].pod_vlatex_insertcommand(this.alt); }
else
{ vB_Editor[this.editorid].pod_vlatex_insertcommand(this.title); }
};
}
}
Regards
Koch (Germany)
I have installed the latex editor for my forum, so that mathematical expressions within [TEX] BBCodes can be converted automatically to a respectable image. For the integration into vB, I used the addon vLatex (https://vborg.vbsupport.ru/showthread.php?t=230589), which is actually only compatible till vB 4.0.4. The corresponding developer does not seem to be active anymore. I run my forum with version 4.1.10 - nonetheless, the addon works except for one small thing.
When writing a post, there is a small but very handy Quick Menu.
https://vborg.vbsupport.ru/attachment.php?attachmentid=136850&stc=1&d=1330935700
It should speed up and simplify the use of latex. By clicking on an icon, the appropriate BBCode should then be inserted in the editor. That just does?nt happen. If you click on an icon, simply nothing happens. As I understand it, this menu is controlled via a JavaScript, which is presented as follows. I only know that the editor has changed since 4.0.4 vB very much. I hope someone can help me there because my Java knowledge is very limited or not available.
window.status = 'actualizado';
vB_Text_Editor.prototype.pod_vlatex_insertcommand = function (code)
{
if (this.wysiwyg_mode)
{
while (code.indexOf('{br}') != -1) code = code.replace('{br}', '<br />');
}
else
{
while (code.indexOf('{br}') != -1) code = code.replace('{br}', "\n");
}
var anchorpos = code.indexOf('#');
if (anchorpos == -1)
{
this.insert_text(code+' ', code.length+1);
}
else
{
var seltext = this.get_selection();
if ((seltext === false) || (seltext.length == 0))
{
seltext = "";
}
else
{
seltext = new String(seltext);
}
var precode = code.substring(0, anchorpos);
var poscode = code.substring(anchorpos+1);
this.insert_text(precode + seltext + poscode+' ', precode.length, poscode.length+1);
}
}
vB_Text_Editor.prototype.pod_vlatex_init = function()
{
this.vlatex_commandmenu = document.getElementById('vlatex_commandmenu');
if (is_ie)
{ var buttonTagName = 'img'; }
else
{ var buttonTagName = 'li'; }
var buttons = this.vlatex_commandmenu.getElementsByTagName(butto nTagName);
for (var i=0; i < buttons.length; i++)
{
buttons[i].editorid = this.editorid;
buttons[i].onclick = function () { vB_Editor[this.editorid].check_focus(); };
buttons[i].onmousedown = function () {
if (is_ie)
{ vB_Editor[this.editorid].pod_vlatex_insertcommand(this.alt); }
else
{ vB_Editor[this.editorid].pod_vlatex_insertcommand(this.title); }
};
}
}
Regards
Koch (Germany)