User talk:MarkS/Extra edit buttons

Latest comment: 10 years ago by Helder.wiki in topic Alternative way to add buttons

Where is monobook.js?

edit

Has anyone solved this issue yet. I tried this as well and it did not work in the newest version of Wikimedia? Any advice would be much appreciated. THanks --Tperrault (talk) 01:09, 1 October 2008 (UTC)Reply

I've been able to install the extra button to my personal mediawiki installeation by adding the .js code to the /common/edit.js file. Seems to work....


Ok, well... this was a very vague explanation on the installation of this. For people who aren't genius computer programmers, this could be difficult. Try being more specific when writing pages on Wiki which involve people installing/following directions. 68.90.122.135 (talk) 01:22, 10 July 2008 (UTC)Reply

--77.4.44.112 (talk) 21:26, 6 March 2008 (UTC)Reply
Has anybody tried to include the js of the buttons directly into the skin? This would be by far the most appropriate solution. Any advice is highly appreciated!


--Johnp125 16:59, 18 September 2007 (UTC)Reply

I do not understand what I am need to do with the monobook.js. Do I need to make a new skin. Do I put the code in the current skin and add this data to it and then change the name to monobook.js. Do I need to edit my LocalSettings.php and make the new monobook.js the default skin? Do I need to put the code in a namespace? I am a little confused as to how to get this working, and how to ref the data. Do I put this in a extension? I need some direction. Please help.

--205.144.218.172 00:05, 23 September 2007 (UTC)Reply

Is this a dead discussion?


I did not find info. on in which directory to put monobook.js into? Kindly assist. (June 13, 2007)

me too. there´s no monobook.js in wiki 1.11.0. ist there anywhere a installation-guide for 1.11.0? 143.164.102.13 06:27, 31 October 2007 (UTC)Reply

I cann't find monobook.js either. I can find skins/monobook directory, but there's no js files in it at all. Anybody can explain about the monobook.js? —Preceding unsigned comment added by 24.218.73.252 (talk) 15:43, 31 January 2008 (UTC)Reply



Hi there,

We are desperately looking for the extended toolbar, aspecially for tables, only... Where is the 'monobook.js'? It's not in the mediawiki files I downloaded on 10 Jan. 2007 from the official site... So the 'simple' install just doesn't work. Please give instructions how to add this for a user who just downloaded the wiki package, installed it and doesn't know diddly about it otherwise.

Many thanks, Marc



Hi Mark,

This is interesting. How to add this for my site? Can we do this without editing the EditPage.php.

Thanks Vasu


Answer

edit

Monobook.js is a page on the Wiki itself. It can be found or created by each individual user at User:Yourname/monobook.js or at Special:MyPage/monobook.js.

On some MediaWiki installs the ability for users to edit such a page is forbidden by the sysops, so the simple install method will not work. You will have to ask your sysops to permit editing of monobook.js or ask them to install the toolbar globally.

Hope this helps the confusion.

--Agrestis (talk) 13:28, 5 May 2009 (UTC)Reply


Left Right Align

edit

May you please add a button for right to left align? Thanks, David

You mean right   for left? For what in fact is left used? --Olliminatore 15:16, 19 September 2006 (UTC)Reply
As of 13 October2006 XEB includes left aligned, centred and right aligned buttons --MarkS (talk) 15:45, 13 October 2006 (UTC)Reply

When adding your own new buttons, how do we specify the url for the button's image? You look like you're using the absolute path of the image ex: 6/6a/Button_sup_letter.png. But I can't see that path when I search for that image on wikipedia. So I assume I create images using gimp, them upload them to wikipedia. But how do I know the path to the image?

Thanks in advance, Jason L Michael

Hi Jason, you can find the absolute path to the image by clicking on its link in its description page, e.g. here, you would click on the text right beneath the picture which says "John_W._Bricker_cropped.jpg‎ (10KB, MIME type: image/jpeg)". That takes you to the absolute path: http://upload.wikimedia.org/wikipedia/en/7/77/John_W._Bricker_cropped.jpg
--Matt57 15:45, 28 October 2006 (UTC)Reply
All the icons are now in commons so rather than specify the full path on each line 'http://upload.wikimedia.org/wikipedia/commons/' is added to the front of each URL. If you are looking at the code then you can see variable Isrc is defined at the top to hold this part of the URL. Isrc is then added to the location specified for each button.


Reference tags

edit

Hello there. This seems like a great tool, but there's one more thing I'm missing. There's plenty of reference templates available out there and copy-pasting them and then filling them with content might be a tedious task. Is there a way to create buttons that would paste the three most common templates?

  • {{cite book | author = | coauthors = | title = | year = | editor = | pages = | chapter = | chapterurl = | publisher = | location = | id =ISBN | url = | format = | accessdate = }}
  • {{cite journal | author = | year = | month = | title = | journal = | volume = | issue = | pages = | id = | url = | format = | accessdate = }}
  • {{cite web | author= | title= | publisher= | year= | work= | url= | accessdate= }}

//Halibutt 09:02, 31 October 2006 (UTC)Reply

There are two ways:
  1. You could use the mwCustomEditButtons function directly in your own monobook.js. mwCustomEditButtons is an array which contains details of the buttons to add. You can see an example of using it in extraeditbuttons.js.
  2. Extra buttons can be added. These would probably be non-standard buttons. This ensures the buttons don't appear automatically for everybody. You would then need to use XEBOrder to get the buttons to appear.
I'm willing to follow the second option and add the buttons into XEB. Would you be willing to design the icons? --MarkS (talk) 20:34, 1 November 2006 (UTC)Reply
More: Thanh công cụ soạn thảo --Nguyễn Thế Phúc Talk 04:07, 4 March 2007 (UTC)Reply

Have you had a chance to implement these useful citation buttons? NigelG (or Ndsg) | Talk 00:43, 6 February 2007 (UTC)Reply

edit

It's much larger then I expected - perhaps it should be split off? In either case, we need to move some buttons to Commons; and it should be helpful for people designing their own buttons (we can also use a place to list them). -- Piotr Konieczny aka Prokonsul Piotrus | talk  19:18, 24 December 2006 (UTC)Reply

Button images not appearing

edit

A really useful tool: thanks!

One problem, though. I've added some buttons to colour text, as follows (in my monobook.js):

myButtons={'_BL':['http://commons.wikimedia.org/wiki/Image:Bouton_Vandale0.png','blue','<span style="color:blue">','</span>','text'], '_GR':['http://commons.wikimedia.org/wiki/Image:Bouton_Vandale1.png','green','<span style="color:green">','</span>','text'], '_FU':['http://commons.wikimedia.org/wiki/Image:Bouton_Vandale2.png','fuchsia','<span style="color:fuchsia">','</span>','text'], '_RE':['http://commons.wikimedia.org/wiki/Image:Bouton_Vandale3.png','red','<span style="color:red">','</span>','text']}; :XEBOrder="R,F,Q,_GR,_BL,_FU,_RE";

The buttons work; but instead of getting the images, all I see in the toolbar is the tooltips ("blue", "green", etc). What am I doing wrong? --NigelG (or Ndsg) | Talk 18:51, 30 January 2007 (UTC)Reply

The URL you have provided doesn't actually link to the picture. Your URL's point to the page that contains all the wikimedia stuff (menus, licence, the picture etc...). In your case if you go to this page then just below each image is a link to the picture itself. Follow the link to get to just the button image. For example the image for your first button is at: http://upload.wikimedia.org/wikipedia/commons/f/f0/Bouton_Vandale0.png. You need to take the URL of this page and that in, rather than the page you are linked to. --MarkS (talk) 20:11, 2 February 2007 (UTC)Reply

Thanks! I've finally got them to work. But how does this fit in with your previous statement?

"All the icons are now in commons so rather than specify the full path on each line 'http://upload.wikimedia.org/wikipedia/commons/' is added to the front of each URL."

It seems that you still have to type the whole verbose URL - or have I missed something? --NigelG (or Ndsg) | Talk 00:47, 6 February 2007 (UTC)Reply

How to have extra buttons installed on my wiki

edit

Hi,

What is the license for extra buttons. Is it possible to place them on my wiki? If yes what are the steps I have to follow to have them? Do I have to make any changes to code? Is it possible to default users accounts to have extra buttons by default (i.e. each user doesn't have to copy all the code, etc.)

Regards, Aretai 13:59, 2 February 2007 (UTC)Reply

Comment on my talk page. --MarkS (talk) 20:11, 2 February 2007 (UTC)Reply

Thank you - it works on my MediaWiki

edit

Thank you! I finaly figured out how to install this on my MediaWiki site. This is great. IIt works great. I also have the wikEd installed for the other users, but it only works for FireFox. Many of the potential users of my site use IE7 and IE6, so, this universal extra buttons are very helpful. This will make Wiki style editting a bit more approachable for some. Thank you again!Kohyin 22:18, 15 February 2007 (UTC)Reply

Ref tag button

edit

I see from the Changes section that some buttons have been modified:

"6 March 2007 Major upgrade. XEB now features popups on some of the buttons. These display a dialog box to complete with parameters. The markup code then depends on the inserted text."

In the case of the <ref>...</ref> button this has made things worse. I find it much easier to type (sometimes quite long) footnotes in the text, then highlight them and click on the Ref button. This used to work, but no longer does so. Could you please reinstate it? Thanks -- NigelG (or Ndsg) | Talk 12:25, 14 March 2007 (UTC

NigelG, quick question: Would you be happy with a single option for the moment to turn all the popups off in one go?
In the longer term I know something needs to be done to improve the reference popup. The popup is an attempt to fix the two types of buttons for reference that XEB has (one does the whole reference in one go, whilst the other builds in up in bits so you can specify the name as well as the reference). The ultimate intention is that the popup should pick up the selected text, the insert button should be the one with the focus (so if you press enter it is just entered) and that the popup can let you specify different types of cite references (my understanding is that is what should be between the ref tags). Any comments on this as a longer term plan? --MarkS (talk) 18:10, 14 March 2007 (UTC)Reply
I've added an option to turn off popups entirely. Simply add XEBPopups=false; to your monobook.js before the XEB code is include. I'll look for more sophisticated solutions when I get a proper chance. Comments on the reference button in general (see above) or this fix are welcome. --MarkS (talk) 22:38, 14 March 2007 (UTC)Reply
Thanks for giving us the option, & for doing it so promptly! Yes, that's fine for the time being.
In the longer term it would certainly be nice to have an additional option of the various Cite templates (book, journal, web) inside the Ref tags. But remember that not all Refs are for citations of this sort: some are just footnotes with additional information. So allowance must be made for this type of Ref as well. --NigelG (or Ndsg) | Talk 00:00, 15 March 2007 (UTC)Reply


Multiple Lines

edit

Is it possible to create buttons on two lines? Like having two button toolbars? If I use to many, then the toolbar extends off of the page. How can I fix this?

thanks--198.70.22.217 17:42, 16 March 2007 (UTC)Reply

The buttons are drawn by the mediaWiki software. XEB just gives it a list of buttons (the list contains the image, the tooltip and the tags to insert). So there isn't an easy way to get it to create two toolbars. However, in testing the MediaWiki software has always caused the buttons to wrap on to a second line if necessary. There are two possible explanations for your problem:
  1. You are using a browser I haven't tested on. The only major group of browsers I haven't tested on are for MAC (as I don't have access to a MAC).
  2. You have a particular style that tells the toolbar not to wrap. This might be set from a MediaWiki skin or by another user script.

Mac OS tested

edit

Being a user of Mac OS and Mac OS alone, I can confirm that it works perfectly. I can make text:

  1. Small
  2. Underlined; and
Defined
Made clear

In short, it's brilliant! CarrotMan 07:27, 17 March 2007 (UTC)Reply

Breaks table sorting?

edit

I'm using an out-of-the-box installation of MediaWiki 1.9.3 and my sortable tables are no longer sortable. Testing on Wikipedia, I see the same thing; when I'm using the extra edit buttons, I cannot sort tables.

This should now be fixed. The problem arose because both sortable tables and XEB had a function with an identical name (getElement ByClassName if I remember). This is a function I grabbed off the net and is incredibly useful. I've renamed the XEB version but the issue could arise somewhere else with another script. --MarkS(talk) 21:10, 1 May 2007 (UTC)Reply

Does it work on other Wikimedia Wikis?

edit

Hi, this is great! But does it work on other wikimedia wikis? TomasBat (@)(Contribs)(Sign!) 03:26, 31 March 2007 (UTC)Reply

It should copy over to other wikimedia wikis without any problems. The buttons are all in commons so they shouldn't cause any problem. It might be even work directly but adapting the monobook code to include the full URL. I haven't tried this but can't imagine any problems. I'll have a look if I get a chance.

prettytable not working

edit

Although the the popup box is great, if i select anything more than caption when the table resolves it shows the table 'options' like

align="center" which showed with just selecting align center. if i build the table option by itself then this does not appear to happen. So it seems to be some kind of timing error? any ideas? --Dtsig 04:17, 22 April 2007 (UTC)Reply

There is a revised version of XEB which changes the way text is inserted when popups are used. Can you refresh your cache etc and tell me how you get on. --MarkS(talk) 21:21, 1 May 2007 (UTC)Reply

Some changes in install directions and a request

edit

I just installed this onto my wiki and it works just fine. I am on mediawiki v1.10 and have found that the install is quite simple as explained in the posting by Carlos Hanson. I dropped your code into mediawiki:common.js and snap, extra buttons!. This does mean that each wiki administrator needs to add this to their own wiki but this is not necessarily a bad thing as each wiki admin may want a different set of buttons.

Request: Since your code has hard coded locations for all the JPGs it would be nice of you could provide a tar/zip file of the buttons starting 1 level below /images.

Citation

edit

Is it possible to make two extra buttons for citing books and websites. The templates are:

{{cite book|last=|first=|authorlink=|coauthors=|title=|year=|publisher=|location=|isbn=}}

and

{{cite web|url=|title=|accessdate=|last=|first=|authorlink=|coauthors=|date=|publisher=|pages=|language=|quote=}}

Note: It would be nice if the accessdate parameter be completed automatically (using CURRENTYEAR, etc.)

It would be awesome if these buttons can be designed to show a popup window with all options, much like the advanced image and table buttons. I tried adding them (as extra buttons) but I failed, after several tries. This tool would make life so much easier for me and I would really appreciate if this can be done. Thanks, Anas talk? 15:24, 15 July 2007 (UTC)Reply

I've made a start (but can't claim to be actively working on it) to create some extra cite buttons. This would create a set of buttons all of which had a similar look which could then be used for "cite book", "cite web" .... . Once these are done I'll add them on. I'd like to have a single popup from which you choose what to cite at the top (eg. web, book ...) and it then showed the relevant parameters to complete. The problem is that this means the popup will change in size. At the moment XEB doesn't support and popups changing content let alone size. I have therefore been playing on my own version of the wikimedia software to try and solve this. Once that's done I'll do an XEB update. --MarkS(talk) 20:26, 23 July 2007 (UTC)Reply
Excellent! Good luck with that, Mark. I'll be waiting for the update. Thanks, Anas talk? 17:19, 24 July 2007 (UTC)Reply

subst and sig

edit

I'm creating a custom button. The intent is for a Welcome tag subst, as I am getting tired of typing it :) The code I want is {{subst:WelcomeIcon}}~~~~

However, if I create the button as, say: myButtons={'_ZZ':['http://upload.wikimedia.org/wikipedia/commons/9/9c/Button_smiley2.png', 'Welcome','{{subst:WelcomeIcon}}~~~~','','']};

Then the subst both of the WelcomeIcon tag and the sig is performed as I save the monobook.js page.

Next, I tried

myButtons={'_ZZ':['http://upload.wikimedia.org/wikipedia/commons/9/9c/Button_smiley2.png', 'Welcome','<nowiki>{{subst:WelcomeIcon}}~~~~</nowiki>',,]};

but when I do that, the nowiki tags get put into the edit box as well

My solution, for now is to do this:

myButtons={'_ZZ':['http://upload.wikimedia.org/wikipedia/commons/9/9c/Button_smiley2.png', 'Welcome','{{subst:','~~','WelcomeIcon}}~~']};

which breaks things up enough that it doesn't subst in the monobook.js, but it is rather inelegant. Do you have any suggestions?  — Timotab Timothy (not Tim dagnabbit!) 03:28, 5 September 2007 (UTC)Reply

Recent update prevents my wiki page to open in IE7

edit

Hi,

I suppose that the monobook.js has recently been changed. The main page of my wiki won't open anymore, and deactivating the extraEdit Buttons solves that problem.

Did you have the chance to test it on IE 7 ?

Thx, --Jacques-- —Preceding unsigned comment added by 90.34.105.16 (talk) 07:28, 24 September 2007 (UTC)Reply

Dont know how to Install

edit

Hi,

Im Using the latest version of Wiki, and i cannot intall the XEB, please give me the details guide

Im going to my special page from search form i typed special Special:Mypage/monobook.js then i put your code over there, after refresh, its nothing happening ?

kindly assist the details —Preceding unsigned comment added by 203.121.47.26 (talk) 02:18, 27 October 2007 (UTC)Reply

ERROR

edit

There is an error in the extra edit buttons:
The left and right align codes are the same, at least in the Comments / What is shown when editing table.
please fix this, thanks!-- penubag  08:40, 9 January 2008 (UTC)Reply

References to buttons

edit

I browsed the source for some ideas for a gadget of my own and stumbled upon how you access the buttons. Specifically, when you want to add a onclick handler to a button, you loop through all the buttons and compare the img attributes. At least on the German Wikipedia, with [1], the much easier solution is to pass the attribute imageId to mwEditButtons that will set the ID attribute of the element. HTH, Tim Landscheidt (talk) 17:10, 24 April 2008 (UTC)Reply

Mediawiki 1.13

edit

xeb doesn't seem to be working quite right on mw1.13. ie: when trying to use a numbered list i get:

# Element A
# Element 2
# Element 3

in stead of it placing a # sign before the selected text/current line. This goes for most of the buttons. Also it may be a firefox 3 thing, but the popup for tables is not longer showing up.

I have the same problem with the POP-UPs. They do not show up anymore. Is any fix planned for this issue? —Preceding unsigned comment added by 194.138.12.146 (talk) 09:41, 12 September 2008 (UTC)Reply

I have also problems with pop-ups in my own wiki, but only using IE and not in firefox. Pop-ups do not open!! --62.47.140.222 (talk) 10:08, 18 October 2008 (UTC)Reply

'undefined' buttons

edit

Love the script - it works great after I figured everything out.

I'm having a problem, though, on my own wiki (1.9.3). I set all of the mediawiki buttons to be removed and populated the toolbar with a set of your buttons and custom buttons, which all work, but I have two "undefined" text blocks before and after the toolbar - it look like:
undefinedundefined[toolbar]undefinedundefined
When you hover over the words, the tooltip pops up and says 'undefined,' so it looks like it's trying to render four extra buttons. Any ideas? Thanks!--71.203.126.129 (talk) 00:35, 11 September 2008 (UTC)Reply

Access Keys

edit

Is it possible to add access keys to some or all of the buttons?

This is a great script, many thanks for making it available.

--Agrestis (talk) 10:39, 5 May 2009 (UTC)Reply


Button Image Location

edit

commons:Category:ButtonToolbar seems to have been deleted, the buttons now seem to be at commons:Category:MediaWiki edit toolbar

--Agrestis (talk) 13:17, 5 May 2009 (UTC)Reply

edit

I somehow can't get the popup windows to show up in IE8. Is this a general restriction or do I make a mistage somewhere? Firefox works fine and I cleared the cache.

Thanks for the help, --jpkoester1 (talk) 14:50, 6 August 2009 (UTC)Reply

MIA

edit

Friendly notice.. -  allstarecho    23:05, 9 August 2009 (UTC)Reply

version 1.15.1 ?

edit

Bonjour. je cherche une extension comme celle-ci pour ajouter des boutons dans ma boite d'édition.
est-ce que cette extension fonctionne avec médiawiki version 1.15.1 ?
merci :)
--Uf4280 (talk) 10:49, 29 September 2009 (UTC)Reply

Request

edit

Hi. A question from a newby. Is it possible to have a function to be executed by a button? E.g. convert selected text to Lowercase? I tried to look around but I could not find anything. If so, can you give a short example of code? Mpaa (talk) 12:09, 5 May 2011 (UTC)Reply

edit

Some popup do not work en FF4 like advance image(AI) and reference(R), the table popup works fine--Tsouchon (talk) 18:12, 14 June 2011 (UTC)Reply

Broken after 1.18?

edit

My custom buttons aren't showing up anymore since 1.18 deployment. –xenotalk 13:17, 6 October 2011 (UTC)Reply

Maybe its fixed in r99097!? --91.42.213.119 (talk) 15:58, 6 October 2011 (UTC)Reply
Unfortunately not, it is perhaps unrelated. –xenotalk 16:02, 6 October 2011 (UTC)Reply
Mine are broke too, seemingly with MW 1.18.   Avicennasis @ 22:23, 16 Tishrei 5772 / 22:23, 14 October 2011 (UTC)Reply
I suppose this was bug 31511, which was marked as fixed (by rev:111983 / rev:112451 / rev:112573?). No one else tested the changes suggested last year, so the script is still as it was in October 2011‎, i.e. not even the migration was done...
The module "mediawiki.action.edit" received more updates since than. One of them (gerrit:16238) makes the old property "buttons" of the "mw.toolbar" object to be a local variable, and not accessible externally. From what I understood, scripts which alter the toolbar should now use only the methods provide in the API (currently, "mw.toolbar.addButton" and "mw.toolbar.insertTags", which corresponds to the legacy window.addButton and window.insertTags). There is no method to remove buttons AFAIK, so the update I suggested won't work anymore (it stopped working on Portuguese Wikipedia, at least) and someone will need to rewrite it again... Helder 02:37, 19 August 2012 (UTC)Reply

Alternative way to add buttons

edit

In case anyone needs to add some extra buttons to the old toolbar and don't want to wait until this script is fixed (which seems unlikely), here is a code example which you can copy to your common.js (after removing the old code related to the "extra edit buttons") and adapt for your own needs:

/*global jQuery, mediaWiki */
( function ( mw, $ ) {
'use strict';
var addExtraButtons = function(){
	mw.toolbar.addButton( {
		imageFile: '//upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.png',
		speedTip: 'Redirect',
		tagOpen: '#REDIRECT [[',
		tagClose: ']]',
		sampleText: 'Article Name',
		imageId: 'button-redirect'
	} );
	mw.toolbar.addButton( {
		imageFile: '//upload.wikimedia.org/wikipedia/commons/7/74/Button_comment.png',
		speedTip: 'Comment',
		tagOpen: '<!--',
		tagClose: '-->',
		sampleText: 'Comment',
		imageId: 'button-comment'
	} );

	/* If you want more buttons, copy and adapt the examples above and paste the modified version before this comment */

};

mw.loader.using( 'user.options', function () {
	// This can be the string "0" if the user disabled the preference ([[bugzilla:52542#c3]])
	if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
		// Use something like [[m:User:Krinkle/Scripts/InsertWikiEditorButton#Example]]
	} else if ( mw.user.options.get( 'showtoolbar' ) == 1 && mw.toolbar ) {
		$( addExtraButtons );
	}
} );

}( mediaWiki, jQuery ) );

Best regards, Helder.wiki 17:59, 22 February 2014 (UTC)Reply

FYI: For compare, this script has an running fork as gadget on DE.: de:MediaWiki:Gadget-Extra-Editbuttons.js

@Helder.wiki: could you coding a function to disable the other "new" toolbar if this script is added!?User: Perhelion16:45, 13 August 2014 (UTC)Reply
@Perhelion: could you elaborate? Which new toolbar? The one from mw:Extension:WikiEditor? The script above only loads only when that toolbar is disabled in your preferences. Helder 18:02, 13 August 2014 (UTC)Reply
@Helder.wiki: Yes exactly this I mean. If someone load the script (especially as gadget) it is illogical and incomprehensible that this toolbar don't appear!? So deactivate / remove the other automatically!?User: Perhelion19:04, 13 August 2014 (UTC)Reply
I think it is the user's responsibility to disable WikiEditor's toolbar in order to use a gadget/script which is designed to add buttons to the classic toolbar. Alternatively, it could call another function (e.g. meta:User:Krinkle/Scripts/InsertWikiEditorButton) to add buttons to the WikiEditor toolbar instead, or just notify the user that he needs to disable the enhanced toolbar if he wants to use this script:
mw.loader.using( 'mediawiki.notify' )
.done( function(){
	mw.notify( 'Please disable the WikiEditor toolbar to add buttons to the classic toolbar!' )
} );

Helder 20:26, 13 August 2014 (UTC)Reply