Andreas Gohr wrote: > > You need to wait till the document is loaded and then execute you > script. To do so use the addInitEvent call. Something like this should > work (untested): Well that's right (and a fast answer!), it adds indeed a button, but _after_ the page has been loaded and the toolbar has been built, correct? Running my_toolbar_additions() as an addinitevent doesnt solve the problem, since it will not redraw the toolbar with the data of the toolbar[] array. As far as I can see js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)"); defines the toolbar in js.php where function initToolbar(tbid,edid,tb) in edit.js does the actual drawing. So I suggest to call initToolbar('tool__bar','wiki__text',toolbar) again, within my_toolbar_additions(), but I this ends up with two toolbars. Two things you could do here: remove toolbar and have initToolbar it drawn again, or add a child element to the current toolbar. What is advisable/neat without having to copy parts of initToolbar ? Riny > > function my_toolbar_additions() { > if(!toolbar) return; > var xid = document.getElementsByName("id"); > var ns=xid[0].value; > var open = "[["+ns+":"; > toolbar[toolbar.length] = {"type":"format", > "title":"newpage_below", > "icon":"below.png", > "key":"", > "open":open, > "close":"]]"}; > } > addInitEvent(my_toolbar_additions); > > Andi -- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist