* moved remote oggHandler code to remoteMwEmbed.js
[lhc/web/wiklou.git] / js2 / editPage.js
1 /*
2 * JS2-style replacement for MediaWiki edit.js
3 * (right now it just supports the toolbar)
4 */
5
6 // Setup configuration vars (if not set already)
7 if( !mwAddMediaConfig )
8 var mwAddMediaConfig = {};
9
10 //The default editPage AMW config
11 var defaultAddMediaConfig = {
12 'profile': 'mediawiki_edit',
13 'target_textbox': '#wpTextbox1',
14 // Note: selections in the textbox will take over the default query
15 'default_query': wgTitle,
16 'target_title': wgPageName,
17 // Here we can setup the content provider overrides
18 'enabled_cps':['wiki_commons'],
19 // The local wiki API URL:
20 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php'
21 };
22 js2AddOnloadHook( function() {
23 mwEditPageHelper.init(
24 $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig )
25 );
26 });
27 var mwEditPageHelper = {
28 init: function( amwConf ) {
29 var _this = this;
30 // kind of tricky, it would be nice to use run on ready "loader" call here
31 if( typeof $j.wikiEditor != 'undefined' ) {
32 setTimeout( function() {
33 $j( '.wikiEditor-ui [rel=file]' ).unbind().addMediaWiz(
34 amwConf
35 );
36 }, 100 );
37 } else {
38 // Add the add-media-wizard button for old toolbar:
39 $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
40 mv_skin_img_path + 'Button_add_media.png">' );
41 $j( '#btn-add-media-wiz' ).addMediaWiz(
42 amwConf
43 );
44 }
45
46 // Add to new toolbar (need to use api)
47 /*$j( '[rel=insert] tool-file' ).addMediaWiz(
48 mwAddMediaConfig
49 );*/
50 }
51 }