if (wgAction == 'edit') { mw.addOnloadHook( function() { var $target = $j('#wpTextbox1'); var section = { 'sections': { 'test': { type: 'toolbar', labelMsg: 'Test', groups: { 'test1': { labelMsg: 'Test1l', tools: { 'nrefs': { type: 'button', action: { type: 'dialog', module: 'test-dialog', }, icon: '', section: 'test', group: 'test1', labelMsg: 'Test1', } } }, } } } }; var dialogs = { 'test-dialog': { titleMsg: 'Test1', id: 'test-dialog1', html: 'Click', init: function() {}, dialog: { width: 550, buttons: { 'wikieditor-toolbar-tool-link-cancel': function() { $j(this).dialog( 'close' ); }, } } } }; $target.wikiEditor('addDialog', dialogs); $target.wikiEditor('addToToolbar', section); $j('#dialog-testing').live('click', function() { alert("Clicked"); }); }); }