From: Michael Dale Date: Sat, 10 Oct 2009 21:07:39 +0000 (+0000) Subject: * add to the old toolbar even if $j.wikiEditor is set & some minor re-factoring X-Git-Tag: 1.31.0-rc.0~39307 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=7caf1999f4f9bfe4970ddc2362f6e70c81b36504;p=lhc%2Fweb%2Fwiklou.git * add to the old toolbar even if $j.wikiEditor is set & some minor re-factoring --- diff --git a/js2/editPage.js b/js2/editPage.js index 135ef99590..364f9b2106 100644 --- a/js2/editPage.js +++ b/js2/editPage.js @@ -19,36 +19,24 @@ var defaultAddMediaConfig = { // The local wiki API URL: 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php' }; -var mwEditPageHelper = { - init: function( amwConf ) { - var _this = this; - // kind of tricky, it would be nice to use run on ready "loader" call here - if( typeof $j.wikiEditor != 'undefined' ) { - setTimeout( function() { - $j( '.wikiEditor-ui [rel=file]' ).unbind().addMediaWiz( - amwConf - ); - }, 100 ); - } else { - // Add the add-media-wizard button for old toolbar: - if( $j('#btn-add-media-wiz').length == 0 ){ - $j( '#toolbar' ).append( '' ); - $j( '#btn-add-media-wiz' ).addMediaWiz( - amwConf - ); - } - } - - // Add to new toolbar (need to use api) - /*$j( '[rel=insert] tool-file' ).addMediaWiz( - mwAddMediaConfig - );*/ - } -} + js2AddOnloadHook( function() { - mwEditPageHelper.init( - $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig ) - ); + var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig ); + // kind of tricky, it would be nice to use run on ready "loader" call here + if( typeof $j.wikiEditor != 'undefined' ) { + setTimeout( function() { + $j( '.wikiEditor-ui [rel=file]' ).unbind().addMediaWiz( + amwConf + ); + }, 100 ); + } + //add to the old-toolbar all the time: + if( $j('#btn-add-media-wiz').length == 0 ){ + $j( '#toolbar' ).append( '' ); + $j( '#btn-add-media-wiz' ).addMediaWiz( + amwConf + ); + } });