User:Karl Dickman/Threads/06/11/27a

Adding standard editbuttons to XEB script
As you know, scripts exist to suppress the standard editbuttons (bold, italic, link, headline, image, etc.) I see this as a first step toward maximum customisation. For example, it make ssense to have purely formatting buttons, like underline, strike, bold, and italic right next to each other, and to have both the basic image button and the advanced image button right next to each other. The easiest way to do this would be to make the following change to User:MarkS/extraeditbuttons.js:

Karl Dickman talk 00:00, 28 November 2006 (UTC)


 * I defintely think its a good idea to include the standard buttons within XEB so you can then group similar buttons together.
 * Isrc is a just a way of keeping the urls in each button definition line short. Just like you I can't see a way to do the final section of code if we use an array. The only alternative I can think of is to add Isrc to the rest of the url when each button is declared. This would make each button line slightly longer but would still be manageble.
 * I have just been looking at the German version by Olliminatore. As far as I can see he has added some really nice pieces of extra code. Firstly he has something to remove the standard toolbar buttons (which would go nicely with being able to add them back in whereever you want with XEB) and he looks to have some code to extend the functionality of the buttons - it looks like when you press the table button you get a popup asking what size table you want.
 * I will get the standard buttons added asap and then look at seeing if we can copy some of the German code over. -- Mark S  (talk) 17:27, 30 November 2006 (UTC)

I seem to remember a popup for tables being imported here from the French Wikipedia, but it didn't work in Internet Explorer. Just something for you to check. Karl Dickman talk 19:23, 30 November 2006 (UTC)

Update: I successfully added said buttons to the script. My apologies if you feel I've trespassed in any way by doing so.

Cheers and good luck, Karl Dickman talk 08:01, 1 December 2006 (UTC)


 * That XEB buttons are not really needed, we can load these from  to add these to BDict (and give these simply the indexes as names (1-10)), but we need BDict first load in  . These give us a additional possibility to add an optional parameter for additional custom user buttons (what you've requested too). I think I will do these for the german version. —Olliminatore 12:48, 1 December 2006 (UTC)


 * Thanks for adding the buttons to the script. I have now added Olliminatore's remove buttons function to the dev version. This seems to be working for me. You just need to add something like var rmEditButtons = [2,6,7,10]; to your monobook.js to remove the buttons. The index of the buttons to remove starts from 0. I haven't tested this in IE or Opera at the moment. I also think it might be nice to make this a little simpler perhaps for people who want to remove all the buttons (for example we could have rmEditButtons="All"). I'll look into this and testing the code asap so we can get it on the live version.-- Mark S  (talk) 16:35, 1 December 2006 (UTC)


 * Here the alternative code with paramter (var myButtons, I hope you'll give it a try). Good idea to do them with rmEditButtons="All". p.s. browser compatibility: it works for me in Opera and IE too. Cheers, looking forward —Olliminatore 17:31, 1 December 2006 (UTC)


 * Well I've added an "all" option and it sort of works. However, it highlights a problem in Olliminatore's remove edit buttons function. Olliminatore's function is added to the page load event to remove the buttons. However, when the page is loading there are only 11 buttons in mwEditButtons. The media wiki software must be adding the 10 other standard buttons later. The remove buttons functions works fine with these 11 buttons but can't remove the other 10 standard buttons (because they don't exist when the function runs). It might be possible to run the remove buttons function later but that would risk removing any buttons the user has added themself. The only answer I can think of is to delete the buttons when XEB is running by searching for the individual buttons themselves. This seems a heavy handed way to do it. Will need to think about this or hope Olliminatore has a good idea.
 * Haven't looked at your alternative code yet. Will do when I get a chance. -- Mark S  (talk) 18:54, 1 December 2006 (UTC)

By the 'ten other standard buttons', do you mean the ones that have been MediaWiki:Common.js? If so, you can suppress them (thanks, Olliminatore) by adding  to your local javascript file, or to the XEB script page. Karl Dickman talk 19:12, 1 December 2006 (UTC)


 * Yes, Karl Dickman is right (I forgot the other custom  buttons are now standard too), we should delete them all (if we would extend the  function (you can correct my typo "erease", or better called removeButtons!?), it must be indexes from 0-20. That would be too complicated/ elaborated for an user friendly parameter).  —Olliminatore 20:39, 1 December 2006 (UTC)

Plus, I don't think that extending the indices on your script would work, i.e. I don't think that  would successfully erase the sixteenth and twenty-first buttons in the toolbar. I seem to remember trying that, and didn't succeed. Karl Dickman talk 23:14, 1 December 2006 (UTC)
 * At the moment you are right, because the function is not modified (in de: are no custom standard buttons). But if you really want it, it would be easy to do, connect both lists:
 * first made a copy:
 * then erase those:
 * Because the mwEditButtons is filled after the mwCustomEditButtons. Then put this line in the erase function:
 * . —Olliminatore 23:54, 1 December 2006 (UTC)


 * For the record (and this is just summarizing what Olliminatore has already said) and so that I don't forget, the buttons are working like this:
 * mwCustomEditButtons is populated with the 10 extra standard buttons
 * monobook.js is called and we add the XEB buttons
 * mwEditButtons is populated with the standard buttons
 * The eraseButtons function is run which removes the standard buttons from mwEditButtons
 * Olliminatore's proposed code should work fine and would allow any of the 21 standard buttons to be removed by index number. However, I would need to adapt the remove all function I added and probably hard code it to remove 21 buttons. I think this overall approach is the best way forward. I'll test it on the dev version as soon as possible. -- Mark S  (talk) 07:24, 2 December 2006 (UTC)
 * I have now changed the rmEraseButtons function so it can remove all the standard buttons. You can now specify either  or  . The code is currently in the dev version. I also want to have a look at   Karl Dickman's alternative code for adding the standard buttons in and then test again before moving this up to live.  That might need to wait until this evening. If you want to test the code or suggest/make any other changes that would be helpful -- Mark  S  (talk) 07:53, 2 December 2006 (UTC)