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