Jump to content

User:Karl Dickman/Threads/06/12/01b

From Wikipedia, the free encyclopedia

More on XEB

[edit]

Note: this comment is part of a synchronised thread. You can reply by clicking the [edit] link next to the comment's heading, or following this link. To ensure that you can see any further responses I make, add this page to your watchlist. Once you have replied, feel free to remove this boilerplate.

One final thing: at User:Karl Dickman/standard.js I tried adding some buttons by adding more to the variable BDict at my local .js. However, that didn't work. I assume I got the syntax wrong for whatever I was doing. When you get a moment, I would appreciate it very much if you could take some time to help me out.

Cheers, Karl Dickman talk 08:34, 1 December 2006 (UTC)

Example custom button for XEB: document.write("<script> addCustomButton(Isrc+'1/13/Button_enter.png','Line break','<br style=\"clear:all','','\">') <\/script>"); Hmm ... I updated the code, I can't say way but the code must be in script tag (local it works without). Currently you can only add buttons at the end (or beginning, or end of standard buttons), but we could make a optional parameter for additional custom buttons, which are changeable in order too. (don't forget to share your ideas) happy editing :) (p.s. I was a bit inactive in wikipedia) —Olliminatore 09:19, 1 December 2006 (UTC)
I really suggest an user friendly parameter like
var myButtons={
 'Mm':['http://upload.wikimedia.org/wikipedia/commons/f/fd/Button_blockquote.png','Insert block of quoted text','<blockquote style="padding:2em;">\n','\n<\/blockquote>','Block quote'],
 'Ba':['http://upload.wikimedia.org/wikipedia/commons/1/13/Button_enter.png','Line break','<br style=\"clear: ','all',''\">']
}

Here the code therefor that works: [1]Olliminatore 17:21, 1 December 2006 (UTC)

This code is now on the dev version. I'll try and test it tomorrow. --MarkS (talk) 21:00, 5 December 2006 (UTC)
I'm having some problems with the code. Whenever I open any Wikipedia page, it gives me a popup that says:

intiButtons
mwEditButtons.length=0
mwCustomEditButtons.length=10

This popup appears twice, and I must click OK twice before I can see the page I went to. Karl Dickman talk 17:42, 6 December 2006 (UTC)
I see: it's your debugging report. Here's what I suggest: add if(user=='MarkS') { \\debugging code here }; that should help prevent those of us who are also checking out your dev source from having to deal with the debugger thing. Cheers, Karl Dickman talk 01:55, 7 December 2006 (UTC)
You mean if(wgUserName=='MarkS')? Or you can made a debug parameter var debug = true;, so more user can test it. p.s. Maybe I wrote a hint on the dev talk. —Olliminatore 09:31, 7 December 2006 (UTC)
I have commented out the code and will add something to stop the messages popping up for other users (although in my defence this is the development version of the code !). The reason for the popup boxes is that I'm having trouble getting the remove edit buttons to work. The problem is that firefox and IE/Opera fire the onload event at different times. Specifically it seems to me that IE/Opera fire the onload event after drawing the toolbar (so you can't use the event to remove buttons from the toolbar). Even worse is that in IE/Opera it appears that the standard 10 toolbar buttons are added immediately before the toolbar is drawn (so you can't remove the buttons). When you include the extra 11 buttons that English Wikipedia adds in Common.js to mwCustomEditButtons rather than mwEditButtons it all gets very confusing. I've started a new page called Development notes which contains some technical information on how the toolbar buttons work. If you have any extra info (or know of links to other places in Wikimedia/Wikipedia) that might be relevant then please expand this page. In the meantime I'm going to do a bit more testing. --MarkS (talk) 17:19, 7 December 2006 (UTC)
Oh* I think I've tested only with IE6 and Opera8.5. Here the fix for Opera 9 [2] I now install IE7 (IE6 works). —Olliminatore 20:46, 7 December 2006 (UTC)
I'll have a look at this tomorrow. Testing tonight (before your fix) suggests the biggest problem is the 11 extra standard buttons added on en wikipedia. In Firefox these are added before the onload event fires (so I can remove them). However, in IE (and probably Opera) these are added very late on in the process. Development notes contains what I believe is the order the various functions run in. If you use an onLoad routine then the toolbar has been drawn before the onLoad event runs whereas if you setup the toolbar directly in monobook.js then these extra 11 buttons are added to mwCustomEditButtons after the monobook.js code has run. Hopefully your code will fix this. --MarkS (talk) 22:16, 7 December 2006 (UTC)
This is odd. I've updated the XEB code as you suggested. I actually copied the piece of code that does the onload hooks from the German version. In Firefox its working fine. However, in IE7 its not drawing any of the XEB buttons all. It does seem as if the execution order of the various steps matches my notes in Development notes. After this test I added the German version of XEB to my German account (SMark). That version works fine and adds the buttons in, so its not my browser. I'm left with two possible explanations: (1) somewhere in the code (on the English version) I've made a mistake or (2) The German and English versions of Wikipedia execute in a slightly different order. Is it possible for you to have a look over the code for me and test the English version to see if the result is different to the German version. --MarkS (talk) 19:49, 8 December 2006 (UTC)

In general I think IE tends to have problems with XEB. Until I got to college and started using the computers here, I never met a version of IE6 that could execute XEB at all. Karl Dickman talk 23:12, 8 December 2006 (UTC)

Yes that IE (is not working for me too) bug is new in wikibits.js, I'll report this. —Olliminatore 01:25, 9 December 2006 (UTC)
I think and hope I solved the putative IE problem :/ (works now really for me) [3] (look at addOnloadHook(initButtons)) p.s. sometimes the IE is a mystery —Olliminatore 04:48, 9 December 2006 (UTC)
I have copied over your code from the German version and it looks to be working for me too. There is one issue to sort and that is the eraseButtons function can't handle the extra 11 buttons inserted by the English Wikipedia (they are added to mwCustomEditButtons rather than mwEditButtons). I did have something that solved this once before so I will try putting that back . Hopefully I'll get a chance tomorrow to look at this and tidy up the code in general. Then hopefully it will be ready to go. I'll post another update as soon as I have looked at it again. In the meantime thanks for all your help. --MarkS (talk) 21:40, 9 December 2006 (UTC)
The code looks fine now and I have tested it. I have updated the eraseButtons function to handle the extra 11 buttons in English Wikipedia. I have also added sorting to the rmEditButtons variable in case the user defines the buttons in the wrong order. My intention is to do another quick test tomorrow and then relase it at some point tomorrow. I'll will also look to update the documentation at that time. If you have any comments or notice any problems let me know and I will delay the release. --MarkS (talk) 20:05, 11 December 2006 (UTC)