Last modified: 2012-05-04 22:34:09 UTC
Some of the booklet related toolbar-API-functions don't work in a $j( document ).ready-function: Inserting an empty booklet (if you want to build things up step by step), adding pages to the two existing booklets (adding pages to an own booklet works), removing pages and removing characters. To test it, put this into your personal vector.js: function atT_booklet() { $j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'emoticons': { 'type': 'booklet', 'label': 'Emoticons' } } } ); } function atT_chars() { $j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'characters', 'pages': { 'emoticons': { 'layout': 'characters', 'label': 'Emoticons', 'characters': [ ':)', ':))', ':(', '<3', ';)' ] } } } ); } function atT_table() { $j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'help', 'pages': { 'colors': { 'layout': 'table', 'label': 'Colors', 'headings': [ { text: 'Name' }, // or use textMsg for localization, see also above { text: 'Temperature' }, { text: 'Swatch' } ], 'rows': [ { 'name': { text: 'Red' }, 'temp': { text: 'Warm' }, 'swatch': { html: '<div style="width:10px;height:10px;background-color:red;">' } }, { 'name': { text: 'Blue' }, 'temp': { text: 'Cold' }, 'swatch': { html: '<div style="width:10px;height:10px;background-color:blue;">' } }, { 'name': { text: 'Silver' }, 'temp': { text: 'Neutral' }, 'swatch': { html: '<div style="width:10px;height:10px;background-color:silver;">' } } ] } } } ); } function rfT_page() { $j( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'help', 'page': 'format' } ); } function rfT_char() { $j( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'characters', 'page': 'latin', 'character': 'Á' } ); } if ( typeof $j != 'undefined' && typeof $j.fn.wikiEditor != 'undefined' ) { // Execute on load $j( document ).ready( function() { atT_booklet(); //atT_chars(); //atT_table(); //rfT_page(); //rfT_char(); });} Expectet behaviour: The thing not commented out should appear/disappear. Actual behaviour: Nothing happens, atT_booklet fails with "page is not defined", the others fail silently. The interesting thing: All functions work via javascript:atT_booklet(); in the browser's navigation bar or if you put them in some onclick-thing or in a window.setTimeout.
We need a queue for toolbar API calls that come in when the toolbar isn't set up yet.
A similar problem happens when changing addOnloadHook to $j(document).ready in a script which add a new section in the sidebar: http://pt.wikibooks.org/w/index.php?title=MediaWiki:Common.js&diff=prev&oldid=197700 If I use addOnloadHook the section is collapsible, if $j(document).ready is used, the section is permanently hidden.
See also: http://commons.wikimedia.org/w/index.php?title=MediaWiki%3AInterProject.js&action=historysubmit&diff=45407092&oldid=45400093
That's another bug, which was reported in bug 25726.
Unassigning default assignments. http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/54734