woollights / simile-widgets

Automatically exported from code.google.com/p/simile-widgets
0 stars 0 forks source link

Wibbit Javascript wiki-toolbox-bundle.js doesn't load correctly #365

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When installing Wibbit plugin on mediawiki, the wiki-toolbox-bundle.js
javascript library, which adds the table edition buttons on the wiki
toolbar, doesn't load correctly.

See http://simile.mit.edu/wiki/Wibbit/Use#Wiki_Table_Editor for Wiki Table
Editor information.

The problem is that, except on Google Chrome, the browser loads the
wiki-toolbox-bundle.js library before the wiki toolbar is created. If you
look at the first lines of this javascript library:

if(document.getElementById('toolbar')!==null){ 

The code is only executed if the toolbar already exists on the DOM.

In order to solve the problem, you have to do a little modification on the
Exhibit_Main.php file that is on the includes folder.

Change this:

(function(){ 
        var script=document.createElement('script'); 
        script.type='text/javascript'; 

script.src='http://simile.mit.edu/repository/wiki-toolbox/trunk/src/wiki-toolbox
-bundle.js';

        script.id='wiki-toolbox-bundle'; 
        document.getElementsByTagName('head')[0].appendChild(script); 
        })(); 

With this:

addOnloadHook(function(){
        var script=document.createElement('script');
        script.type='text/javascript';

script.src='http://simile.mit.edu/repository/wiki-toolbox/trunk/src/wiki-toolbox
-bundle.js';
        script.id='wiki-toolbox-bundle';
        document.getElementsByTagName('head')[0].appendChild(script);
    });

For more information about the addOnloadHook function, see:

http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Tutorial

I hope this helps you.

---------------------
I found this error when using:

MediaWiki   1.12.0
PHP     5.2.4
MySQL   5.0.77

And the latest Wibbit version.

Original issue reported on code.google.com by alejo.uoc on 14 Apr 2010 at 10:12

GoogleCodeExporter commented 8 years ago

Original comment by ryan...@csail.mit.edu on 23 Jun 2011 at 9:45