Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2012, 07:28 AM
sz1 sz1 is offline
 
Join Date: Feb 2012
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Problems with Javascript for Editor

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, 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.


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.

Code:
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(buttonTagName); 
    
  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)
Attached Images
File Type: png quickmen?.PNG (18.0 KB, 0 views)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:01 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03711 seconds
  • Memory Usage 2,179KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete