MediaWiki talk:Gadget-UserMessages.js/Archive 2

From Wikimedia Commons, the free media repository
Jump to: navigation, search
Archive This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page.

Installation info

To make these links work for you, please insert this into your monobook.js file:

importScript( "MediaWiki:UserMessages.js" );

Instructions updated 13:43, 26 August 2007 (UTC), Platonides

This method is deprecated. Don't use it. Instead use the gadget-checkbox (User Messages) in your preferences. -- RE rillke questions? 20:04, 2 November 2011 (UTC)


These scripts are great, but please remember that the point of them is to communicate something to another person. Using an auto script is not always the best way to do that, especially if they have many previous automated messages or you intend to give them multiple messages. DON'T SPAM USER TALK PAGES. When in doubt write a personal message. Thankyou......... --pfctdayelise (说什么?) 15:46, 12 June 2007 (UTC)

I see where you're coming from, but there are a few things to keep in mind here.
Firstly, message templates are multi-lingual. Because of this, leaving one {{image source}} template for each relevant file often has a greater chance of being understood than a single {{image source}} template with a footnote about it also applying to other files (which may be overlooked). It certainly has a better chance of being understood than a personal message without any standard template at all.
Secondly, in my opinion, keeping up with the huge number of poorly tagged uploads and protecting the integrity of Commons is more important than accommodating users who fail to read our very clear instructions. If our janitors are required to write personalised messages to every habitually sloppy uploader, they'll have less time and incentive to identify files needing attention.
Thirdly, given that uploaders who receive such messages have already chosen to ignore the instructions displayed during the upload process, the chances that they will heed their talk page messages are rather slim. This is true whether the messages are templates or personalised messages. This is not to say that we should leave no messages at all; occasionally, they are effective, and when they are not, at least users are clearly warned before being blocked. What it does mean, however, is that we should not require our janitors to spend a lot of time on something which has a very low probability of having an impact.
LX (talk, contribs) 11:09, 16 June 2007 (UTC)

Template to add: speedywhat

One of the templates I use the most, {{speedywhat}}, is not included. I suggest to include it. / Fred J 15:44, 10 August 2007 (UTC)

I'd have done it if I knew how to. You need multi line support for the parameter. No idea how to do that... Cheers! Siebrand 17:23, 10 August 2007 (UTC)
Any possibility to add this template with pop-up box for file/page name? -Justass (talk) 10:02, 22 March 2010 (UTC)

Add check for existence of language version

Not all templates translated to all languages. Will be good idea to add if translation exists when lang? clicked. If it isn't, script could warn or fallback to default English text.

Otherwise it's necessary to fix user talk page manually.

EugeneZelenko 16:05, 17 March 2008 (UTC)


This has added to Gadgets. – Mike.lifeguard | @en.wb 01:31, 3 April 2008 (UTC)

Feature requests

  1. When a user page is redlinked, please add a welcome template at the top automatically.
  2. Do not add language versions which don't exist; use a fallback language (there is a list defined for MediaWiki; that'd be fine; or just use English).
  3. Allow the Image: prefix as a parameter (ie if the user gives an image which has the prefix, remove it before passing it along to the template.

– Mike.lifeguard | @en.wb 16:25, 5 April 2008 (UTC)

For the 2nd point, I suggest to remove the subst in template_addTemplate and template_addTemplate2, as the message templates are now autotranslated. This will enable these messages to be displayed on the user page in the interface language of the reader. The fallback of autotranslated templates is English, unless a given subpage redirects to another one. -- AlNo (discuter/talk/hablar/falar) 16:05, 14 January 2009 (UTC)
2nd point ✓ done -- AlNo (discuter/talk/hablar/falar) 17:26, 16 January 2009 (UTC)


Could someone more knowledgeable with tech stuff than I add {{Inappropriate imagenotes}} please? Thank you! –Juliancolton | Talk 02:39, 9 November 2009 (UTC)

Done now. –Juliancolton | Talk 03:13, 10 November 2009 (UTC)

Code change request

I'd like to request a small codechange to make the "destination" the user messages are linked to configurable (here and -dev alike).

What to change: like in this edit, move the destination 'p-tb' into a variable that can be overriden before including the messages.

Why the change? I have written a "dropdown-Menu" - solution for the vector skin (needs some more testing on different browsers, but seems to be working acceptably well on Firefox and Opera). Using this drop-down, I'd like to move the (long) list of potential templates from the toolbox. To test how it would work:

if (wgNamespaceNumber == 3)
 var userMessagesDest = 'p-user-talk';
 addOnloadHook(function(){ newFavMenu(userMessagesDest,'Talk');});

Right now I'm using my own copy of the messages. Naturally, that's code duplication we really don't need. --Guandalug (talk) 08:22, 3 July 2010 (UTC)

Allow a parameter - change required please

Not a .js person so pretty please could someone take a look at helping me out on this. Generally where there is an optional parameter on a template the .js prompts you for the parameter. With the {{Project scope}} template there is the option for a parameter but it doesn't come up on the .js. It has been pointed out to me - correctly I think - that it would be better if the parameter was used - can anyone do that? Cheers --Herby talk thyme 12:25, 22 July 2010 (UTC)

Will do tonight..--DieBuche (talk) 15:13, 19 August 2010 (UTC)
Done--DieBuche (talk) 16:26, 21 August 2010 (UTC)
Errr - thanks but it didn't work. It didn't ask me for a parameter when I used the template via this? Regards --Herby talk thyme 07:11, 22 August 2010 (UTC)
Cache issue - my bad. Many thanks indeed - works just fine :) --Herby talk thyme 09:38, 22 August 2010 (UTC)

Using wikibits and wikiglobals

Functions like addPortletLink() and variables like wgServer, wgScript, wgArticlePath should be used instead of the local wiki and skin dependant function addLink() and wikiHostname, scriptPath, prettyPath. I'm not sure how much needs to be changed, if someone knows - that'd be great. Otherwise I might try it out next week in the dev. –Krinkletalk 08:28, 12 October 2010 (UTC)

Surely, but are you sure you posted to the right talk? This script uses non of the functions you named--DieBuche (talk) 17:50, 13 October 2010 (UTC)

"Please name" message does not work properly

Because it is not prompting for a parameter. Please exchange line 210

addPortletLink('p-tb', 'javascript:template_mark(\'4\')', uText[4], 'mark-please', uHelp[4], null, null);


addPortletLink('p-tb', 'javascript:template_mark2(\'4\', prompt(\'' + template_mediaquery + '\', \'InsertImageNameHere\'), 0, true)', uText[4], 'mark-please', uHelp[4]);

Sorry but this JavaScript is anything but "stable": If you use ID attributes, they should be unique. Otherwise use the name attribute. This will ease the usage of getElementByID or ~tsByName; therefore it is easier for users to customize their scripts if there are bugs. (I had to loop through all <li> elements.)

Next question: sometimes null is used and sometimes arguments are omitted. Just look above.

Und ich muss dann doch noch ein großes Lob aussprechen: Das AJAX-Script (AjaxQuickDelete) von DieBuche und anderen ist wirklich super geraten. Schnell, zuverlässig, übersichtlich. Weiter so.

Thanks. --RE RILLKE Questions? 21:13, 23 March 2011 (UTC)

No Advertising

There is a useful template: No advertising, which is not added, yet. How to do:

after l. 222, add

addPortletLink('p-tb', 'javascript:template_mark(\'35\')', uText[35], 'mark-warn',   uHelp[35], null, null)

after l. 139, add

uHelp[35] = "Tell user not to advertise on commons. Tell him about the goal of an educative image collection."

l. 104, replace

var uHelp = new Array(33)


var uHelp = new Array(36)

after l. 102, add

uText[35] = "Dont advertise"

l. 67, replace

var uText = new Array(33)


var uText = new Array(36)

after l. 65, add

uTemplate[35] = 'No advertising'

l. 30, replace

var uTemplate = new Array(33)


var uTemplate = new Array(36)

But there are still two questions (I come from C++):

  1. Why there are no semicolons at the end of the lines?
  2. Why it worked, despite the obviously too small Array?

--RE RILLKE Questions? 15:05, 24 March 2011 (UTC)

Semicolons are not strictly necessary. Arrays aren't fixed size. No idea why someone would do new Array(23) in JS--DieBuche (talk) 12:07, 12 April 2011 (UTC)

New Line and Space prior to signature

Using the button: Please describe, a new line and a space is inserted in front of the signature causing Wikimedia-software rendering the signature differently (see below). Could somebody fix this? Thanks.

--RE RILLKE Questions?  21:47, 25 March 2011 (UTC)
Should be fixed--DieBuche (talk) 14:16, 12 April 2011 (UTC)

Error in Vector

Talk pages are not saved after inserting copyvionote template: Error: at line 103: template_autosave is not defined. --EugeneZelenko (talk) 15:35, 12 April 2011 (UTC)

it's a small bug. what you want is to change
if (!window.template_autosave == false) {
   template_autosave = true;


if (!(window.template_autosave == false)) {
   template_autosave = true;
note the extra parenthesis.
personally, i prefer not to define this variable at all - it is only used in one place, and at this place you can use instead:
  if (typeof template_autosave == "undefined" || template_autosave)
to allow users to override autosaving by defining in their private js something like "template_autosave = false;" or "template_autosave = 0;".
peace, - קיפודנחש (talk) 21:48, 12 April 2011 (UTC)

All namespaces

Gadget is adding links for pages in all namespaces (including File and Special). Should be User talk only. --EugeneZelenko (talk) 15:12, 24 April 2011 (UTC)

Fixed--DieBuche (talk) 19:09, 24 April 2011 (UTC)

AJAX-based editing

Is it possible to convert this gadget to using AJAX-based editing similar to Quick Delete and DelReqHandler? --EugeneZelenko (talk) 15:39, 14 May 2011 (UTC)

  • This will remove the possibility to edit the user-page with only "one edit" (if you want to do other things).
  • If you, a developer, do so, please add only one link to the tool-bar and then ask what to do. When I have time, I'll look how to do/change into an API-using script. Please put a note here if you (someone else from my POV) make it to your task. If I start creating, I'll put a notification here. Thanks -- RE rillke questions? 13:49, 15 May 2011 (UTC)
Started now. Wednesday or Saturday, a first test-version will be present at my user-namespace. -- RE rillke questions? 10:29, 16 May 2011 (UTC)
Yes, I know, to late but even better than never:
Add this to Special:MyPage/common.js or <skin>.js.
If you do not trust in me, ask a user you trust in to review this script. Please report Bugs here. Thank you. -- RE rillke questions? 18:24, 25 May 2011 (UTC)
I test it now. There ↑ is a ";" missing at the end, isn't it? ;) Cheers --Saibo (Δ) 14:15, 22 October 2011 (UTC)
✓ ;) -- RE rillke questions? 17:45, 22 October 2011 (UTC)

{{subst:editprotected}} In order to announce the intended replacement, please insert the code from here. It will add a link for users of this gadget on top of a user-talk-page to this page. They should have the possibility to mention concerns. Thank you. -- RE rillke questions? 20:13, 4 October 2011 (UTC)

Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. RE rillke questions? 12:51, 6 December 2011 (UTC)

Replacement coming soon

Dear user of Gadget-UserMessages, if there are no objections, it will be replaced soon by User:Rillke/AxUserMsg.js (doc).

All you have to know about this change, you can find on Commons:Village pump/Proposals/Archive/2011/09#Replacing MediaWiki:Gadget-UserMessages.js. Please read this before posting questions.

If you have objections, please report them here. Thank you. -- RE rillke questions? 20:04, 4 October 2011 (UTC)

Are you sure this msg. is necessary ? --DieBuche (talk) 12:28, 13 October 2011 (UTC)
Weiß nicht. Wenn man die Leute nicht fragt und ihnen das Gefühl gibt etwas mitgetragen zu haben, gibt es hinterher immer großes Geschrei. Schien mir der effektivste Weg. Man könnte natürlich auch einfach ersetzen und wenn es zu viele Böse Stimmen gibt, wird reverted. Wie siehst Du das? -- RE rillke questions? 13:07, 13 October 2011 (UTC)
Dacht halt weil du ja schon vorher auf der VP gefragt hattest. Ist mir egal, ich schiebs gleich rüber--DieBuche (talk) 16:08, 13 October 2011 (UTC)