Last modified: 2012-05-04 22:34:09 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T25479, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23479 - Some of the toolbar-API-functions don't work in a $( document ).ready-function
Some of the toolbar-API-functions don't work in a $( document ).ready-function
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
WikiEditor (Other open bugs)
unspecified
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-12 07:25 UTC by Michael M.
Modified: 2012-05-04 22:34 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Michael M. 2010-05-12 07:25:46 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.
Comment 1 Roan Kattouw 2010-05-12 14:19:13 UTC
We need a queue for toolbar API calls that come in when the toolbar isn't set up yet.
Comment 2 Helder 2010-11-07 13:51:49 UTC
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.
Comment 4 Michael M. 2010-11-09 08:46:32 UTC
That's another bug, which was reported in bug 25726.
Comment 5 Bugmeister Bot 2011-08-19 19:12:50 UTC
Unassigning default assignments. http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/54734

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links