MediaWiki talk:Gadget-popups.js/Archive 1
This is an archive of past discussions about MediaWiki:Gadget-popups.js. 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. |
Archive 1 | Archive 2 | Archive 3 |
Crash
LOL. I can't view this in Firefox without freezing. Perhaps I need to download more RAM? --- RockMFR 19:44, 5 December 2007 (UTC)
- It works for me...if I be absolutely still while it is loading. :P FunPika 02:19, 9 December 2007 (UTC)
About the CSS
- This section was moved here from MediaWiki talk:Gadget-navpop.css, so that talkpage can be redirected here. --David Göthberg (talk) 06:44, 29 November 2009 (UTC)
{{editprotected}}
Please create this page with the text found in User:Lupin/navpop.css. FunPika 02:32, 9 December 2007 (UTC)
Change request
{{editprotected}}
Please remove the following section from the page (as MediaWiki:Gadget-navpop.css should be able to handle that part's functions if I understand the code correctly):
//////////////////////////////////////////////////////////////////// // Import stylesheet(s) // if ( window.localCSS ) { document.write('<link rel="stylesheet" type="text/css" href="http://localhost:8080/js/navpop.css">'); } else { document.write('<link rel="stylesheet" type="text/css" href="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/navpop.css' + '&action=raw&ctype=text/css&dontcountme=s">'); }
FunPika 03:56, 9 December 2007 (UTC)
- Done - I may not technically know JavaScript, but the purpose of that code is obvious. Nihiltres{t.l} 13:45, 9 December 2007 (UTC)
Fixes for various bugs
{{editprotected}}
This is a list of several issues that have been found in Lupin's code, since it was made a gadget. Lupin seems mostly MIA lately, so little has been done with these things so far. However they all fix important and annoying issues or spelling bugs, and all have been tested by multiple people. --TheDJ (talk • contribs) 15:07, 29 February 2008 (UTC)
- Security fix implemented by Krimpet diff
- Spelling error diff
- Avoid including full copies of images in contributions and histories when these images are mentioned in the edit summary. solution. (changes [[Image:]] into [[:Image:]] in those cases)
- getParamValue uses decodeURI(), but should use decodeURIComponent() explanation by Lupo
- Safari workaround for some (un)escaping issue. diff explanation by Makotoy.
I think it is important to have these fixes applied and since some of this has been lingering since December, without much action by Lupin, I think it is best if they are tackled here. --TheDJ (talk • contribs) 15:07, 29 February 2008 (UTC)
- Could you point me to the code to copy over the current code? (I'm aware of that security problem as well, and agree that it, in particular, needs fixing.) --ais523 19:50, 3 March 2008 (UTC)
- I have made this version which has all of the above suggestions applied. This is the diff with the currently installed Gadget code. --TheDJ (talk • contribs) 20:29, 3 March 2008 (UTC)
References preview
{{editprotected}}
This diff should fix previewing references. A while ago this broke because the ids for the notes were changed in the cite extension. --TheDJ (talk • contribs) 14:04, 26 March 2008 (UTC)
- Done Implemented by MZMcBride in this diff --TheDJ (talk • contribs) 19:44, 26 March 2008 (UTC)
Porting to another mediawiki installation
I'm a total n00b at JS (give me Ruby any day!) and I am a little overwhelmed by the amount of code here. I run my own wiki using the same software as Wikipedia and this gadget would be cool to have. The problem is that I use the short URL scheme (i.e. mywiki.com/Article). I can find the url/regex that does that here. Any advice on porting popup? --Aquatiki (talk) 07:47, 10 April 2008 (UTC)
- Have you tried the methods in WP:POPFAQ? —mjb (talk) 02:31, 22 April 2008 (UTC)
Enhancement to disable popups on certain elements
There was already a built-in function that removes popups from an article's table of contents (i.e., from all anchors under the HTML element with ID 'toc'), but this wasn't generalized so that it could be used with other elements. I really didn't like popups appearing on the special character links under the edit box on article edit pages, so I experimented a bit to figure out what could be done. I found I couldn't disable the popups via code in my monobook.js, so I resorted to patching popups.js directly.
Patches, along with original and patched versions of popups.js, are available here (click). Here are direct links to the patches themselves (identical code in all of them):
- popups.js.diff, made against User:Lupin/popups.js version "Sat Mar 10 21:40:16 UTC 2007"
- gadget-popups.js.diff, made against Mediawiki:Gadget-popups.js version "Sat Mar 3 20:18:00 UTC 2008 en:MediaWiki:Gadget-popups.js" (though the other diff will work just as well)
- apipopups.diff, made against User:TheDJ/apipopups.js version "DJ Fork Sun Mar 30 14:03:00 UTC 2008"
Once the patch is applied and you've edited your monobook.js to load the patched file (such as User:Mjb/popups.js, which is what I use, instead of User:Lupin/popups.js or User:TheDJ/apipopups.js), you can further test it by adding noPopupElements=['editpage-specialchars'];
to your monobook.js. Then go to an edit page, shift-reload or do whatever you need to do to clear your cache, and now you should observe no popups when you mouseover the special character links under the edit box.
Peer review appreciated. If it works for people, perhaps this could be incorporated into the official scripts? —mjb (talk) 03:02, 22 April 2008 (UTC); updated 06:58, 27 August 2008 (UTC)
- This is interesting. Can you give a recipe for disabling popups when hovering over a rollback link when viewing a diff? Philip Trueman (talk) 10:30, 1 May 2008 (UTC)
- The revision, edit, and undo links at the top of each column on a diff page are all in a pair of divs with ID "mw-diff-otitle1" and "mw-diff-ntitle1". You could disable popups on that set of links by adding those IDs to your noPopupElements array.
noPopupElements=['editpage-specialchars', 'mw-diff-otitle1', 'mw-diff-ntitle1'];
- —mjb (talk) 21:00, 1 May 2008 (UTC)
- I like the idea. I'm reluctant to add more functionality to popups in general, but I do see this like a potential thing that we ought to consider. --TheDJ (talk • contribs) 19:07, 1 May 2008 (UTC)
Broken
{{editprotected}}
Popups is broken since the last change. I believe it's the missing comma at the end of the following line:
"hu": [ "Média", "Speciális", "Vita", "Szerkesztő", "Szerkesztővita", "Wikipédia", "Wikipédia-vita", "Kép", "Képvita", "MediaWiki", "MediaWiki-vita", "Sablon", "Sablonvita", "Segítség", "Segítségvita", "Kategória", "Kategóriavita", "Portál", "Portálvita"]
Can someone fix that please? --AmaltheaTalk 21:52, 22 October 2008 (UTC)
- Also at User talk:Lupin/popups.js please. --AmaltheaTalk 21:58, 22 October 2008 (UTC)
Credit
Who gets credit for writing Popups? Lupin? Are there other major contributors? ☺Coppertwig(talk) 13:57, 23 November 2008 (UTC)
Auto-save option
{{editprotected}}
As there is an option to auto-save when "fixing" a redirect, there should also be an option to auto-save when disambiguating a link (which is usually a more important task). This option would be easy to add, just make these changes:
In the "// redirs, dabs, reversion" section, add this line:
newOption('popupDisambigAutoClick', 'wpDiff');
And change three remaining instances of:
clickButton: "wpDiff" |
or | clickButton: 'wpDiff' |
to
clickButton: getValueOf('popupDisambigAutoClick')
This way it will still do 'wpDiff' but people can over-ride it to 'wpSave' if they want to.
P.S. Why are we maintaining two versions of this tool? Seems like we should merge these and add whatever configuration settings are needed to preserve any intentional differences between the two. — CharlotteWebb 17:04, 11 March 2009 (UTC)
- Hmm, is this really a good idea? With redirects it makes sense since there is only one way to "fix" them. With DAB, as BrownHairedGirl said, a link might need different disambiguations.
As to why the versions are seperated, I have no idea. There's no reason I know of, and would support merging them. --Amalthea 17:27, 11 March 2009 (UTC)- Well, users are liable for their own mistakes, and nobody has to use this feature. I just figured it would make editing more efficient for some. Anyway a wrong choice isn't going to be any more obvious when you look at the diff than it is in the previous step where you select which button to push. — CharlotteWebb 17:59, 11 March 2009 (UTC)
- Right. So we're looking at this change, for both gadget and User:Lupin/popups.js? One of the wpDiff's was for automatic redlink removal, so I made that configurable with its own option.
Haven't tested it yet.
Cheers, Amalthea 18:52, 11 March 2009 (UTC)
- Right. So we're looking at this change, for both gadget and User:Lupin/popups.js? One of the wpDiff's was for automatic redlink removal, so I made that configurable with its own option.
- Well, users are liable for their own mistakes, and nobody has to use this feature. I just figured it would make editing more efficient for some. Anyway a wrong choice isn't going to be any more obvious when you look at the diff than it is in the previous step where you select which button to push. — CharlotteWebb 17:59, 11 March 2009 (UTC)
Foreign 'pedia
Some namespaces have changed on it.wiki. Can someone add this line
"it": [m, "Speciale", "Discussione", "Utente", "Discussioni utente", "Wikipedia", "Discussioni Wikipedia", "File", "Discussioni file", "MediaWiki", "Discussioni MediaWiki", "Template", "Discussioni template", "Aiuto", "Discussioni aiuto", "Categoria", "Discussioni categoria", "Portale", "Discussioni portale", "Progetto", "Discussioni progetto"]
please? Lenore (talk) 19:27, 17 April 2009 (UTC)
- Done. Cheers, Amalthea 20:14, 17 April 2009 (UTC)
Some updates for pl.wiki:
- namespaces
"pl": [m, "Specjalna", "Dyskusja", "Wikipedysta", "Dyskusja wikipedysty", "Wikipedia", "Dyskusja Wikipedii", "Plik", "Dyskusja pliku", "MediaWiki", "Dyskusja MediaWiki", "Szablon", "Dyskusja szablonu", "Pomoc", "Dyskusja pomocy", "Kategoria", "Dyskusja kategorii", "Portal", "Dyskusja portalu","Wikiprojekt","Dyskusja Wikiprojektu"],
- redirects
'pl': [ R, 'PATRZ', 'PRZEKIERUJ', 'TAM' ],
Thanks. Invisible Idiot (talk) 15:19, 3 July 2009 (UTC)
- Done. Cheers, Amalthea 15:51, 3 July 2009 (UTC)
Update italian alias for redirect
{{editprotect}} Can anyone add this line to "function setRedirs()"?
'it': [ R, 'RINVIA', 'Rinvia'],
See this for example. Thank you --Melos (talk) 14:03, 9 July 2009 (UTC)
- Done. Please report if it didn't work. —TheDJ (talk • contribs) 14:31, 9 July 2009 (UTC)
Image namespace renamed
"File" (de: Datei, sv: Fil) should be recognized as a synonym to the "Image" (de,sv: Bild) namespace. --LA2 (talk) 13:58, 1 October 2009 (UTC)
- It already should be recognized. Unfortunately per language only 1 non-english translation is supported however. (namespace aliases predate the design of navigation popups). —TheDJ (talk • contribs) 19:03, 1 October 2009 (UTC)
German redirect alias
{{editprotected}} Could someone add the German alias for redirects ("#WEITERLEITUNG") to the code? Thank you, --The Evil IP address (talk) 23:17, 29 March 2010 (UTC)
- Did that, but: de-wikipedia uses their own copy of popups, and doesn't pull it from here. That means that if you wanted it for there, you'll have to ask for it on de:MediaWiki Diskussion:Gadget-navigation-popups.js.
Amalthea 23:35, 29 March 2010 (UTC)
de.wikipedia now directly uses the en.wikipedia version. --Leyo 08:16, 29 March 2012 (UTC)
Namespace renaming and file issue
Hi, we Esperanto Wikipedians have some problems with this tool:
- Namespaces should be updated because they changed: see there for updated names
- If an image is inserted with Esperanto namespace "Dosiero:" ("File:") aŭ "Bildo:" ("Image:") the popup links to Commons uncorrectly (example the Image of the Day, Dosiero:Wildpferde Tripsdrill.jpg: the popup links to http://commons.wikimedia.org/wiki/Dosiero:Wildpferde_Tripsdrill.jpg)
Please, could someone fix these errors? Thank you! Friendly, --Airon90 (talk) 14:54, 4 August 2010 (UTC)
- As noted 2 threads higher up "Unfortunately per language only 1 non-english translation is supported". To change that is a bit of work, which is on my todo list, but it is a rather large list unfortunately. —TheDJ (talk • contribs) 15:34, 4 August 2010 (UTC)
- I have updated the table for the eo namespaces. Only the User namespaces were incorrect as far as I can see. I think I also fixed the Commons link issue, but please leave a message if it is still broken. —TheDJ (talk • contribs) 15:50, 4 August 2010 (UTC)
- Sorry for the double req :S I didn't see it before. Don't worry and take your time! --Airon90 (talk) 16:28, 4 August 2010 (UTC)
- I have updated the table for the eo namespaces. Only the User namespaces were incorrect as far as I can see. I think I also fixed the Commons link issue, but please leave a message if it is still broken. —TheDJ (talk • contribs) 15:50, 4 August 2010 (UTC)
Is it possible to localize 'History preview failed :-(' text
Hi. now I'm translating navigation popups in Japanese wikipedia(draft). Only 'History preview failed :-(' text looks impossible to be replaced by local text(pop up this page, and try to show tokyo and paris article's history. It will needs this text). Is it possible to localize that text? thank you. --Was a bee (talk) 04:39, 15 August 2010 (UTC)
- I tested below
return 'History preview failed :-(';
- changed to
return popupString('History preview failed :-(');
- and add
'History preview failed :-(': 'History preview failed :-(',
- to the "article-related actions and info" section of pg.string[1]. After that, edit local file. This solved problem. Somebody help to edit... Thanks! --Was a bee (talk) 05:02, 15 August 2010 (UTC) add more info--Was a bee (talk) 05:46, 15 August 2010 (UTC)
- It's an error. In general i don't make error and debug messages translatable, since they should not normally be user visible. And if they do appear, you will need English to get them fixed :D —TheDJ (talk • contribs) 12:16, 15 August 2010 (UTC)
- Hi TheDJ. yes... your explanation is perfectly rational and reasonable. The error message should be like that. I got it. Thank you for your reply :> --Was a bee (talk) 22:33, 15 August 2010 (UTC)
- It's an error. In general i don't make error and debug messages translatable, since they should not normally be user visible. And if they do appear, you will need English to get them fixed :D —TheDJ (talk • contribs) 12:16, 15 August 2010 (UTC)
Namespaces in gl.wp
{{editprotected}}
Please, add this line with the translation for the namespaces in Galician Wikipedia:
"gl": [m, "Especial", "Conversa", "Usuario", "Conversa usuario", "Wikipedia", "Conversa Wikipedia", "Ficheiro", "Conversa ficheiro", "MediaWiki", "Conversa MediaWiki", "Modelo", "Conversa modelo", "Axuda", "Conversa axuda", "Categoría", "Conversa categoría"],
Thanks! --Toliño (talk) 15:48, 30 August 2010 (UTC)
- Done. Also added in support for "REDIRECCIÓN" and "REDIRECIONAMENTO" redirect markers. Amalthea 16:13, 30 August 2010 (UTC)
"Editors" button not working
{{editprotected}}
The link to Tim's WP Stats is outdated, and as such is no longer available. Instead of this, how about that (from Soxred's Tools)? --Slgrandson (How's my egg-throwing coleslaw?) 10:03, 30 September 2010 (UTC)
- Done The current version of popups uses Soxred's tools for edit counter and article stats. AxelBoldt (talk) 13:52, 3 June 2011 (UTC)
Enabling support for IE9
Currently the script does not work in IE9. Some debugging traces the cause of the problem to the setSiteInfo
function. IE9 (Platform Preview 7) seemingly reports location.port == '80'
regardless of whether the port number appears in location.href
. That causes pg.wiki.sitebase
to undesirably contain ':80'
. This malformed pg.wiki.sitebase
is then used to construct the regular expression pg.re.basenames
in the setTitleBase
function, which causes the test pg.re.basenames.test(h)
to fail in the isPopupLink
function. That failure causes the addTooltip
function to abandon prematurely without creating any popups. When this problem is worked around, Navpopup will work in IE9 as it does in other browsers.
Furthermore, in the setBrowserHacks
function, it is probably better to treat IE9 (and possibly IE8) just like other modern browsers and leave useOriginal
as false
. This will allow a better look for Navpopup in IE9 (and IE8). Kxx (talk | contribs) 05:50, 11 December 2010 (UTC)
- Thx for the tip, when I have access to a Windows machine (might take a while), I'll try to take a look at these issues. —TheDJ (talk • contribs) 20:59, 13 December 2010 (UTC)
- It seems that Microsoft has fixed the location.port problem as of IE 9.0.8112; it correctly reports "" instead of "80". However all IE versions currently have problems with popups--previews of IP user contributions and image pages don't show up. The reason is that the API currently doesn't work for these browsers if the request contains a period, the result of circumventing some security issue in IE6 (bug 288840). It's a high priority bug and supposedly a partial fix is in the works. AxelBoldt (talk) 17:42, 3 June 2011 (UTC)
- Thanks for the fix. The behavior with
location.port
seems to be specific to the Platform Previews and intentional/by design. IE9 Beta, RC and RTM return an emptylocation.port
, but IE10 PP1 again returns":80"
. Hope that bug 28840 gets fixed soon. It is impacting much more than just navpopups. Kxx (talk | contribs) 21:24, 4 June 2011 (UTC)
- Thanks for the fix. The behavior with
Portuguese
{{editprotected}} Please replace the following line:
"pt": [m, "Especial", "Discussão", "Usuário", "Usuário Discussão", "Wikipedia", "Wikipedia Discussão", "Imagem", "Imagem Discussão", "MediaWiki", "MediaWiki Discussão", "Predefinição", "Predefinição Discussão", "Ajuda", "Ajuda Discussão", "Categoria", "Categoria Discussão"],
with this line:
"pt": [m, "Especial", "Discussão", "Utilizador", "Utilizador Discussão", "Wikipédia", "Wikipédia Discussão", "Ficheiro", "Ficheiro Discussão", "MediaWiki", "MediaWiki Discussão", "Predefinição", "Predefinição Discussão", "Ajuda", "Ajuda Discussão", "Categoria", "Categoria Discussão"],
Francisco talk-contribs 22:52, 17 February 2011 (UTC)
- Done —TheDJ (talk • contribs) 13:01, 18 February 2011 (UTC)
{{editprotected}}
- "Utilizador" namespace is now again "Usuário". Consider reupdating pt namespaces by replacing "Utilizador" with "Usuário". Francisco talk-contribs 16:38, 19 February 2011 (UTC)
- Done — Martin (MSGJ · talk) 17:36, 21 February 2011 (UTC)
- "Utilizador" namespace is now again "Usuário". Consider reupdating pt namespaces by replacing "Utilizador" with "Usuário". Francisco talk-contribs 16:38, 19 February 2011 (UTC)
Trying to import to another wiki
Gday. I am trying to import this script to another wiki, though while I can get the script fine, the stylesheet is missing, and it is not evident (to me) which css stylesheet is being called to make it function. Previously I have just copied the script, however, I would prefer to just call it as then it collects new stuff. Some advice around this would be very helpful. Thanks. billinghurst sDrewth 13:20, 7 March 2011 (UTC)
- CSS is at MediaWiki:Gadget-navpop.css; You can also import User:Lupin/popups.js instead, which will append the CSS automatically. Amalthea 13:36, 7 March 2011 (UTC)
- Found that out as I poked around, and found that I needed to import it and to make sure that it was added to Gadgets-definition, though still I cannot get the style to function. I was looking to import a mw controlled version (though I know that both are effectively similarly controlled), though that may be useful at least as a test. billinghurst sDrewth 14:19, 7 March 2011 (UTC)
Hovering over author||discussion thows error on firefox 4
I come from commons and since the recent changes, hovering over userpagelink does not work properly. Here is the error:
Error: text.replace is not a function Sourcefile: http://bits.wikimedia.org/commons.wikimedia.org/load.php?debug=false&lang=de&modules=ext.gadget.popups%7Cjquery.autoEllipsis%7Cjquery.checkboxShiftClick%7Cjquery.client%7Cjquery.collapsibleTabs%7Cjquery.cookie%7Cjquery.delayedBind%7Cjquery.highlightText%7Cjquery.placeholder%7Cjquery.suggestions%7Cjquery.tabIndex%7Cmediawiki.language%7Cmediawiki.legacy.ajax%7Cmediawiki.legacy.ajaxwatch%7Cmediawiki.legacy.mwsuggest%7Cmediawiki.legacy.wikibits%7Cmediawiki.util&skin=vector&version=20110414T075236Z Line: 61
Symptoms: Popup opens only one time; hovering again does not recreate the popup. Edit count is not shown.
It is a bit annoying: Either the server has problems, my internet connection crashes or somebody is playing with the .js. Can you please fix it. This script is excellent work and it's a pity when I can't use it. I hope I traced it back correctly. If not I am sorry for disturbing. -- Rillke (talk) 21:00, 14 April 2011 (UTC)
- Was my fault, and I fixed it about fifty minutes ago. Can you try bypassing your browser cache, please? Amalthea 21:12, 14 April 2011 (UTC)
- Thanks. Works now. -- Rillke (talk) 21:14, 14 April 2011 (UTC)
Redirect alias for 'uk'
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add to redirLists
array the row:
'uk': [ R, 'ПЕРЕНАПРАВЛЕННЯ', 'ПЕРЕНАПР' ],
--Anatoliy (Talk) 11:17, 24 May 2011 (UTC)
Namespaces for id.wiki
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
old:
- "id": [m, "Istimewa", "Bicara", "Pengguna", "Bicara Pengguna", "Wikipedia", "Pembicaraan Wikipedia", "Gambar", "Pembicaraan Gambar", "MediaWiki", "Pembicaraan MediaWiki", "Templat", "Pembicaraan Templat", "Bantuan", "Pembicaraan Bantuan", "Kategori", "Pembicaraan Kategori"],
new
- "id": [m, "Istimewa", "Pembicaraan", "Pengguna", "Pembicaraan Pengguna", "Wikipedia", "Pembicaraan Wikipedia", "Berkas", "Pembicaraan Berkas", "MediaWiki", "Pembicaraan MediaWiki", "Templat", "Pembicaraan Templat", "Bantuan", "Pembicaraan Bantuan", "Kategori", "Pembicaraan Kategori"],
Bennylin (talk) 11:59, 14 July 2011 (UTC)
- Done, also localized Portal/Portal talk. Amalthea 12:41, 14 July 2011 (UTC)
i18 for Special:Contributions
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Hi!
A user noticed that the popup is not shown on Portuguese Wikipedia when the mouse is over a "contribs" link (e.g. on histories). I can confirm that changing "Contributions" to "Contribui%C3%A7%C3%B5es" would solve the problem there, but I would like to request that some of the maintainers provide a general fix for this, which would also work for wikis in other languages. Maybe it could get the translated name of the special page and then use it instead of hardcoding "Contributions" in the regex?
Would that be possible? Helder 17:08, 22 August 2011 (UTC)
- The translated name can be obtained from "My Contributions" link, using something like
var href = $('#pt-mycontris').find('a').attr('href'),
reContr = new RegExp(
mw.config.get('wgArticlePath').replace(
'$1',
mw.config.get('wgFormattedNamespaces')['-1'] + ':' + '(.+?)/'
)
),
match = href.match( reContr ),
pageName = (match && match[1]) || 'Contributions';
- See also this request: Wikipedia_talk:Tools/Navigation popups/Archive 8#Localization_for_Special:Contributions_and_Special:WhatLinksHere. Helder 18:19, 22 August 2011 (UTC)
- Sorry I am not qualified to check your code. Perhaps you could ask someone who is familiar with javascript? Please reactivate when you're sure it will work! — Martin (MSGJ · talk) 19:55, 29 August 2011 (UTC)
- Someone simply (well not that simple actually) should build in support for wgFormattedNamespaces. Web scraping should not be used. No time here though :D. —TheDJ (talk • contribs) 21:06, 30 August 2011 (UTC)
- Sorry I am not qualified to check your code. Perhaps you could ask someone who is familiar with javascript? Please reactivate when you're sure it will work! — Martin (MSGJ · talk) 19:55, 29 August 2011 (UTC)
I went back to get this to work and I managed to. There are two problems for it to work in ptwiki, but I figure one probably is very localized.
- First there is the problem that "Contributions" is used as a string literal three times in the text. Changing it to popupString('Contributions') and setting 'Contributions': 'Contributions' as one of the pg.strings is enough to actually make it work on most languages.
Note, however that Contributions must be encoded in % notation: 'Contributions': 'Contribui%C3%A7%C3%B5es' in pt; 'Contributions': 'Beitr%C3%A4ge' in de and so on and so forth. Encoding the strings shouldn't be very hard tough, but I've spent enough time on this already. - The second problem actually baffled me for quite some time, in pt.wiki when the regex is run in line 2301 (after I fixed the localization problem) the result included a undefined result where the username should be(contribs[3]) and placed the user name in the next spot (contribs[4]) it took me a while to notice that the "user" namespace in ptwiki uses parenthesis to denote a neutral gender "usuário(a)" so that spot was the absence of the a.
I again did a very dirty hack checking if contribs[3] was empty and using contribs[4] if that is the case. But if the namespace is escaped there is no need for it.
- I don't know if other wikis use parenthesis in the user namespace
, if it is used a single time my hack will work just fine.
- I don't know if other wikis use parenthesis in the user namespace
So here is the code I got User:Chicocvenancio/popups-test.js. The changes from the original are:
In lines 4417, 5847, 6254 I changed "'Contributions'" for "popupString('Contributions')".In line 7585 I placed "'Contributions': 'Contributions'" as one of the pg.strings so that the script remains functional in English projects.In line 2303 I placed the very ugly hack to get around the extra group when "usuário(a)" is in the regex.
Chico Venancio (talk) 09:06, 28 April 2012 (UTC) (edited to strike)
Actually there is a very simple way to do it. I just put encode()mw.util.rawurlencode() arround the areas I needed to encode and Voila! Since this is a very simple change now and the request for this feature to be present in other languages is pretty old I am reopening the edit request. The change needed is this. The full file with these changes can be found at User:Chicocvenancio/popups-test.js and a "show changes" confirm these are the only changes made.
With these changes, all the translators will have to do is add a 'Contributions':'Contribuitions in whatever language (all unicode characters allowed)'. Chico Venancio (talk) 10:55, 28 April 2012 (UTC)
- I trust that you've tested this thoroughly. deployed — Martin (MSGJ · talk) 19:06, 14 May 2012 (UTC)
- Perhaps not, navpops now seem to be broken. Revert? — Richardguk (talk) 19:19, 14 May 2012 (UTC)
- I think perhaps the topmost change was unintended...? I don't have long so I've just reverted for now. - Jarry1250 [Deliberation needed] 19:25, 14 May 2012 (UTC)
- Yes, that wasn't my best move. Tried again, hopefully all working this time? — Martin (MSGJ · talk) 19:37, 14 May 2012 (UTC)
- Seems good now, thanks all! Salutary to be reminded how useful popups are when they were momentarily gone. — Richardguk (talk) 19:43, 14 May 2012 (UTC)
- Yes, that wasn't my best move. Tried again, hopefully all working this time? — Martin (MSGJ · talk) 19:37, 14 May 2012 (UTC)
- I think perhaps the topmost change was unintended...? I don't have long so I've just reverted for now. - Jarry1250 [Deliberation needed] 19:25, 14 May 2012 (UTC)
- Perhaps not, navpops now seem to be broken. Revert? — Richardguk (talk) 19:19, 14 May 2012 (UTC)
Sorry to reactivate such an old request, but I have been inactive for some time...
@MSGJ: It wasn't clear to me if the edit was reverted in error or if my changes caused trouble for some people. Contributions are still not working on ptwiki without my changes. Has someone reported an error with it or was it Krinkle's edit that caused the problem and it was all reverted? I'll test things again but I don't see how this can cause problems... Chico Venancio (talk) 13:34, 2 December 2015 (UTC)
- For what it's worth, I notice the same behaviour (described above for pt:Especial:Contribuições) at de:Spezial:Beiträge. The obvious conclusion is that diacritics are not handled correctly for this type of popups. I don't use this function a lot, so I'm not much bothered by its failure. -- Michael Bednarek (talk) 18:04, 2 December 2015 (UTC)
- Sorry I have no idea. You could try WP:VPT perhaps? — Martin (MSGJ · talk) 14:27, 7 December 2015 (UTC)
Namespaces changed in es:wiki
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please can anybody change the "es" line in var nsLists
From current existing line:
"es": [m, "Especial", "Discusión", "Usuario", "Usuario Discusión", "Wikipedia", "Wikipedia Discusión", "Imagen", "Imagen Discusión", "MediaWiki", "MediaWiki Discusión", "Plantilla", "Plantilla Discusión", "Ayuda", "Ayuda Discusión", "Categoría", "Categoría Discusión"],
To this new actualized line:
"es": [m, "Especial", "Discusión", "Usuario", "Usuario discusión", "Wikipedia", "Wikipedia discusión", "Archivo", "Archivo discusión", "MediaWiki", "MediaWiki discusión", "Plantilla", "Plantilla discusión", "Ayuda", "Ayuda discusión", "Categoría", "Categoría discusión"],
Differences are:
- lowercase Discusión → discusión (except for main Talk, which remains Discusión)
- Imagen → Archivo
Thanks in advance, Gustronico (talk) 16:25, 12 September 2011 (UTC)
- Done — Martin (MSGJ · talk) 15:54, 14 September 2011 (UTC)·
Patch for watch/unwatch action
I have created a patch regarding Unwatching with Popups now has additional (unwelcome) prompt. I have already applied this change on all Polish projects.
--- MediaWiki:Gadget-Popups.js 2012-01-15 09:27:08.000000000 +0100
+++ MediaWiki:Gadget-Popups.js 2012-01-15 12:03:51.317596960 +0100
@@ -6219,7 +6220,9 @@
case 'deletelog': this.print=specialLink; this.specialpage='Log'; this.sep='&type=delete&page='; break;
case 'userSpace': this.print=specialLink; this.specialpage='PrefixIndex'; this.sep='&namespace=2&prefix='; break;
case 'search': this.print=specialLink; this.specialpage='Search'; this.sep='&fulltext=Search&search='; break;
- case 'history': case 'historyfeed': case 'unwatch': case 'watch':
+ case 'unwatch': case 'watch':
+ this.print=magicWatchLink; this.action=this.id; break;
+ case 'history': case 'historyfeed':
case 'unprotect': case 'protect':
this.print=wikiLink; this.action=this.id; break;
@@ -6837,6 +6840,35 @@
title: title, text: l.text, noPopup: l.noPopup});
}
+function magicWatchLink( l ) {
+ var jsUrl = simplePrintf( 'javascript:modifyWatchlist(\'%s\',\'%s\')', [l.article.toString( true ).split( "'" ).join( "\\'" ), this.id] );
+
+ return generalNavLink( {
+ url: jsUrl,
+ // can't have new windows with JS links, I think
+ newWin: false,
+ title: l.title,
+ text: l.text,
+ noPopup: l.noPopup
+ } );
+}
+
+function modifyWatchlist( title, action ) {
+ var request = {
+ action: 'watch',
+ title: title,
+ token: mw.user.tokens.get( 'watchToken' ),
+ format: 'json'
+ };
+ if ( action == 'unwatch' ) {
+ request.unwatch = true;
+ }
+
+ jQuery.post( mw.util.wikiScript( 'api' ), request, function( response ) {
+ mw.util.jsMessage( response.watch.message, 'ajaxwatch' );
+ }, 'json' );
+}
+
function popupMenuLink(l) {
var jsUrl=simplePrintf('javascript:%s()', [l.id]);
var title=popupString(simplePrintf('%sHint', [l.id]));
I hope this helps. Beau.pacynka (talk) 11:16, 15 January 2012 (UTC)
- Thanks for the patch! I've now added code to do that, more or less yours, with some modifications to avoid code injection, and to still allow opening the (un)watch link in a new window if one so desires. Amalthea 19:02, 25 January 2012 (UTC)
A fix for the "roadindex" set index renaming
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
{{roaddis}} was renamed to {{roadindex}} a while ago:
So please update the dab regex. I'm pretty sure its as simple as:
Old
newOption('popupDabRegexp', '([{][{]\\s*disambig|disambig\\s*[}][}]|disamb\\s*[}][}]|dab\\s*[}][}])|[{][{]\\s*(((geo|hn|road?|school|number)dis)|[234][lc][acw]|shipindex)(\\s*[|][^}]*)?\\s*[}][}]|is a .*disambiguation.*page');
New
newOption('popupDabRegexp', '([{][{]\\s*disambig|disambig\\s*[}][}]|disamb\\s*[}][}]|dab\\s*[}][}])|[{][{]\\s*(((geo|hn|road?|school|number)dis)|[234][lc][acw]|(ship|road)index)(\\s*[|][^}]*)?\\s*[}][}]|is a .*disambiguation.*page');
in other words
s,ship,(ship|road),
KelleyCook (talk) 17:06, 25 January 2012 (UTC)
- Done, thanks! Amalthea 17:21, 25 January 2012 (UTC)
- Worked like a charm, thanks for the quick response -- KelleyCook (talk) 17:50, 25 January 2012 (UTC)
Documentation for gadget authors
We're trying to start a library for gadget authors to use. Please check it out and post any questions or comments there. -- ☠MarkAHershberger☢(talk)☣ 00:53, 9 March 2012 (UTC)
"/" in front of page names?
I copied this script to the mediawiki pages of another wiki (Omegawiki.org). The script has nearly the same behavior there as here in Wikipedia, except that the namespace is preceded with a "/" character. For example my user page looks like "/User:InfoCan" when I hover over my name, rather than "User:InfoCan", and if I click on it it takes me to an non-existant page. What might be the cause of this problem? --İnfoCan (talk) 20:29, 15 March 2012 (UTC)
- I asked the developer who set up the wiki whether his setup was any different from wikipedia. He says:
It's just a guess, but it might be because of the format of what MediaWiki calls "short URLs" ( i.e. www.omegawiki.org/User:Kipcool instead of www.omegawiki.org/index.php?title=User:Kipcool ). OmegaWiki uses a different short URL, namely www.omegawiki.org/User:Kipcool instead of www.omegawiki.org/wiki/User:Kipcool. I have $wgArticlePath = "/$1";
- If this is indeed the reason, how can I modify the javascript to handle this situation? Or could you modify the code here so it is more universally usable? --İnfoCan (talk) 10:51, 16 March 2012 (UTC)
I got exactly the same problem on my website http://ribewiki.dk and I use short pretty URL's as well.
Please let me know, if you find the solution. --Ribewiki (talk) 16:56, 15 April 2012 (UTC)
- Fixed now, there was special code for such short URLs that actually made it break now, removing it fixed it. Amalthea 18:38, 16 April 2012 (UTC)
image alignment on rtl wikis
so the code has (around line #3686) the following line:
function imageHTML(article, idNumber) {
return simplePrintf('<a id="popupImageLink$1">' +
'<img align="right" valign="top" id="popupImg$1" style="display: none;"></img>' +
'</a>', [ idNumber ]);
}
it would work better for RTL sites if the align="right"
could be changed, either by some use of css, or by calculating the "right" : "left" yourself with conditional alignment.
one way to determine whether the page is rtl or ltr is by use of something like
(document.body.currentStyle || getComputedStyle(document.body)).direction
of course, it's much easier to just ask $('body').is('.ltr')
if you allow jquery use.
probably the simplest thing would be to just use CSS instead of setting the alignment directly in the code, and let rtl wikis worry about their own navpopup css overrides.
anywhoo, it would be nice if there was some way for RTL wikis to have the image on the left.
peace - קיפודנחש (talk) 13:52, 26 March 2012 (UTC)
EmailuserHint
Because of the lowercase u in EmailuserHint the string 'Send an email to %s' is never shown in the menu, instead there shows "EmailUserHint". Capitalizing U should fix it. Tried with the German translation, works there. --Ivla (talk) 13:32, 21 April 2012 (UTC)
Disambiguations on frwiki
Hi,
I have activated this gadget on frwiki, and I'm trying to make it correctly detect links to disambiguation pages. Currently, it only detects some of them, depending on the template used in the disambiguation page (works for {{Homonymie}} but not for {{Batailles homonymes}} for example). Is there a way to configure it for detecting all dab links correctly ? If it helps, every disambiguation page in frwiki is directly in the category "Homonymie".
--NicoV (talk) 20:45, 2 May 2012 (UTC)
A link that breaks the Popups gadget
Go here, and then hover over the third link the editor added (just before the text "where I replace hyphens in the intro"). When I hover over this link, I don't get a popup box, and my JavaScript error console logs the following error:
- Error: malformed URI sequence
- Source File: http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.js&action=raw&ctype=text/javascript&493031562
- Line: 2342
Line 2342 appears to be inside the Title.prototype.decodeNasties function.
Additionally, when I click on the link in question, I get
- Error: malformed URI sequence
- Source File: http://en.wikipedia.org/w/index.php?title=Special:BannerController&cache=/cn.js&303-4
- Line: 149
which appears to involve a decodeURIComponent call within a function called getQueryStringVariables.
Even more strangely, when I try to include the link here in my talk page report via a fullurl call — [{{fullurl:Charles_Andr%A9_Julien|diff=495291312&oldid=494889006}}] — the fullurl doesn't work, and I get yet another error:
- Error: invalid regular expression flag n
- Source File: http://en.wikipedia.org/w/index.php?title=MediaWiki_talk:Gadget-popups.js&action=submit
- Line: 1, Column: 4
- Source Code:
- /w/index.php?title=MediaWiki_talk:Gadget-popups.js&action=submit
I suspect there is something amiss with the link in question — but I would have expected/hoped that the problem would have been caught cleanly rather than having it break popups and fullurl.
I'm running Firefox 12.0 on an Ubuntu Natty system.
Does anyone else see this same problem on their system? Any ideas? — Richwales 18:20, 1 June 2012 (UTC)
- I've seen this before, but not with popups: Bug 25846. Helder 21:12, 1 June 2012 (UTC)
Blank spaces in popups display
Suddenly, today, all popups are displaying with a blank line before and after the title of the page that is being previewed. For example, if I hover my cursor over the link Fubar, instead of seeing this:
Fubar ⋅ actions ⋅ popups 9.4kB, 43 wikiLinks, 0 images, 1 category, 3 days 1 hour old
I see this:
Fubar ⋅ actions ⋅ popups 9.4kB, 43 wikiLinks, 0 images, 1 category, 3 days 1 hour old
Further investigation suggests that this is happening because the "⋅" characters have had extra padding or line-spacing added above and below them. This is puzzling, since neither of the gadget files seems to have been changed recently. How could the display have changed when the CSS hasn't changed? --R'n'B (call me Russ) 11:07, 22 June 2012 (UTC)
- After further investigation this seems to be an issue caused by Firefox 13.0.1, which I just installed today; it doesn't occur on Chrome. The "⋅" character is U+22C5, or
⋅
, and Firefox for some unknown reason wants to display this character as being three lines high. It happens in some but not all contexts, too, which is even stranger. Probably a corrupted font file; anyway, nothing we can do about it here, so never mind. --R'n'B (call me Russ) 11:23, 22 June 2012 (UTC)
CSS class for the popup box
Would it be possible to assign a distinctive CSS class name for the popup box (for example, MediaWikiPopup) so that it can be re-styled by user-side stylesheets such as my stylesheets for low vision? Silas S. Brown (talk) 18:17, 15 August 2012 (UTC)
Ah, I see it has class "navpopup", and you can style it in your browser's preferences by addressing it as:
body.mediawiki > div.navpopup
My stylesheets for low vision were setting all elements to position static to work around layout problems on sites that try to do pixel-based layouts without being aware of larger font sizes; I have now added an exception for MediaWiki nav popups. (The simpler "Reference Tooltips" extension can also be styled via "body.mediawiki .referencetooltip".) Silas S. Brown (talk) 19:22, 15 August 2012 (UTC)
Split into smaller JS pages
Hi!
During the presentation about Gadgets and ResourceLoader on Berlin Hackathon 2012, Krinkle suggested this file should be splitted into smaller ones, which would be loaded together by the Gadgets extension (in a single request as it is right now). I believe this would make it easier to load the source code (which currently takes a while), edit and/or debug it. Helder 00:48, 2 October 2012 (UTC)
- One problem is that lots of external wikis are hot-loading this script, e.g. de:MediaWiki:Gadget-navigation-popups.js. This script would thus need to be replaced by a loader of all the parts (which needs to work with parallel loading), and all external wikis would then have to pull multiple scripts.
An alternative would be to move any development of the script to github, and combine it to this gadget page through a synch script. That's what we do with WP:Twinkle (gadget/repo).
Amalthea 09:36, 2 October 2012 (UTC)
New feature proposal: lead only
popupPreviewFirstParOnly
limits the popup to the first paragraph. It would be useful if we could tell the script to present the whole lead, using something like popupPreviewLeadOnly
. Coupled to this, a popupMaxPreviewParagraphs
would limit the size of the lead (as opposed to popupMaxPreviewSentences
, which might cut a paragraph in half). I suggest three things:
- that support for
popupPreviewLeadOnly
is added, defaulting to false to preserve current behavior; - that support for
popupMaxPreviewParagraphs
is added, defaulting to 3 (allowing a value offalse
for unlimited) - that
popupMaxPreviewSentences
andpopupMaxPreviewCharacters
are changed to support thefalse
value, and default to that
Below I offer a proposed implementation for #1 and #2. Line changes are marked with + (added), * (changed) or > (moved). I haven't written javascript in a while so please take a look to see if there are any errors.
...
newOption('popupSummaryData', true);
+ newOption('popupPreviewLeadOnly', false);
+ newOption('popupMaxPreviewParagraphs', 3);
newOption('popupMaxPreviewSentences', 5);
...
...
Previewmaker.prototype.firstBit = function () {
> var d=this.data;
+
+ if (getValueOf('popupPreviewLeadOnly')) {
+ // Remove everything from the first heading onwards
+ // Here we use [\s\S]+ instead of .+ because Javascript doesn't support the s (dotall) modifier,
+ // See http://stackoverflow.com/a/1068308/266309
+ this.data=this.data.replace(RegExp('\\s*^\\s*==[\s\S]+'), '');
* } else if (getValueOf('popupPreviewCutHeadings')) {
> /// first we "normalize" section headings, removing whitespace after, adding before
this.data=this.data.replace(RegExp('\\s*(==+[^=]*==+)\\s*', 'g'), '\n\n$1 ');
/// then we want to get rid of paragraph breaks whose text ends badly
this.data=this.data.replace(RegExp('([:;]) *\\n{2,}', 'g'), '$1\n');
this.data=this.data.replace(RegExp('^[\\s\\n]*'), '');
stuff=(RegExp('^([^\\n]|\\n[^\\n\\s])*')).exec(this.data);
if (stuff) { d = stuff[0]; }
if (!getValueOf('popupPreviewFirstParOnly')) { d = this.data; }
/// now put \n\n after sections so that bullets and numbered lists work
d = d.replace(RegExp('(==+[^=]*==+)\\s*', 'g'), '$1\n\n');
}
// Split sentences. Superfluous sentences are RIGHT OUT.
// note: exactly 1 set of parens here needed to make the slice work
d = d.parenSplit(RegExp('([!?.]+["'+"'"+']*\\s)', 'g'));
// leading space is bad, mmkay?
d[0] = d[0].replace(RegExp('^\\s*'), '');
var notSentenceEnds=RegExp('([^.][a-z][.] *[a-z]|etc|sic|Dr|Mr|Mrs|Ms|St|no|op|cit|\\[[^\\]]*|\\s[A-Zvclm])$', 'i');
d = this.fixSentenceEnds(d, notSentenceEnds);
+
> // dont't be givin' me no subsequent paragraphs, you hear me?
+ var popupMaxPreviewParagraphs = getValueOf('popupMaxPreviewParagraphs');
+ if (typeof popupMaxPreviewParagraphs == 'number') {
+ d = d.slice(0, popupMaxPreviewParagraphs);
+ }
this.fullLength=d.join('').length;
var maxChars=getValueOf('popupMaxPreviewCharacters') + this.extraCharacters;
var n=this.maxSentences;
var dd=this.firstSentences(d,n);
do {
dd=this.firstSentences(d,n); --n;
} while ( dd.length > this.maxCharacters && n != 0 );
this.data = dd;
};
...
What do you think? --Waldir talk 15:31, 8 October 2012 (UTC)
- Strong support, this seems like a great idea. I'm curious, and I don't mean to sidetrack the discussion, but could you think of a way to remove the actions menu from popups? There has been some discussion of creating a form of popups that unregistered readers to use and it wouldn't be beneficial if they were accidentally reverting edits. Ryan Vesey 00:30, 18 October 2012 (UTC)
- I believe
popupStructure = 'lite';
does that. update: even more appropriate seems to bepopupNavLinks=false
. --Waldir talk 00:40, 18 October 2012 (UTC)
- I believe
page size discrepancy
so the gadget displays the page size. way it calculates the page size, is to read the data in raw format, and display data.length (with some rudimentary formatting of the number).
however, this number can largely disagree with the page size as seen in version history or reading the page size through the API (query prop 'revisions'). i am not sure what causes this discrepancy, but i suspect it has something to do with encoding: javascript uses utf16 encoding, while the DB and the display are using utf8. whatever the reason, this can be very significant diff in languages where almost all characters use 2 or more bytes.
foe example, for this page in hewiki: he:ויקיפדיה:דלפק ייעוץ/ארכיון157, popup shows 159.3 KB, while history page shows 254,215 bytes. this is some 40% error. if i go to this page, and enter editing mode, and then in the console i check for $('#wpTextbox1').val().length
, i get a value of 159,277. it is possible to find pages in enwiki with discrepancy also, but i doubt you'll find 40% error.
i am not sure if this problem is worth fixing, but maybe it is worth noting somewhere, e.g., indicate somewhere that the "page size" is not the same as the page size one sees in history, esp. for languages with multibyte characters.
peace - קיפודנחש (talk) 00:26, 6 November 2012 (UTC)
- i think i understand it now: when you look at "data.length", you get the string length, where the "string" is the content of the page as a string. this means that each character is counted as 1. however, in multibyte strings (i.e., practically in all languages with non-latin character set), a character typically weighs between 2 and 4 bytes. the simplest fix would be just to change the string that report the weight of the page from "kB" to something that will signal "kilo character". another fix would be to use
$.byteLength(data)
instead ofdata.length
(this is a mediawiki extension that teaches jquery to give you the weight of a string in bytes. it's somewhat recent, so you may want to test that it's a function before calling it) - peace - קיפודנחש (talk) 17:04, 6 November 2012 (UTC)
- i think i understand it now: when you look at "data.length", you get the string length, where the "string" is the content of the page as a string. this means that each character is counted as 1. however, in multibyte strings (i.e., practically in all languages with non-latin character set), a character typically weighs between 2 and 4 bytes. the simplest fix would be just to change the string that report the weight of the page from "kB" to something that will signal "kilo character". another fix would be to use
Opera popups menu fix
Hi. I managed to fix actions menu for Opera browser and seem to also work fine at least for latest Firefox and Chrome. You'll find the fixed CSS at pl.wiki [2]. The first block/rule is not needed bu I think it works better when you have all menus below. As for JS the fix is needed in setBrowserHacks [3]
Regards, Nux (talk) 18:30, 7 January 2013 (UTC)
Reference Tooltips
Gadget Reference Tooltips doesn't turn on when popups are turned on. Yes, because there's a conflict. We could disable attaching Popup event to reflinks by simply checking if(a.parentElement.className!='reference'){…}. Please, please, add it. Kaligula (talk) 22:40, 12 June 2013 (UTC)
small bug that affects some users
so function autoClickToken calls mw.user.sessionId();
however, this functionality is not necessarily always available. one needs to explicitly load mediawiki.user for all the "mw.user" functionality to be available. please add somewhere mw.loader.using('mediawiki.user')
. peace - קיפודנחש (aka kipod) (talk) 14:43, 13 June 2013 (UTC)
Use the 'wikipage.content' hook
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
A user reported on bugzilla:51565#c12 that this gadget is not working after the page is saved using the Visual Editor. Since bugzilla:30713 was fixed, MW core calls the 'wikipage.content' hook, which should be used by scripts which need to run then the content of the page is loaded. Moreover, there was a change in Visual Editor extension to also call this hook, allowing gadgets like this to work also with the new editing system (for another example of a script which needs a similar fix, see mw:Talk:Snippets/Last revision action). For more information, see the documentation of this hook system.
Could someone update this gadget to work with the new hook? Helder 00:21, 24 August 2013 (UTC)
- Not done: Sorry, but I'd need the actual code to enact this request. Actually, not many of the admins who answer protected edit requests know JavaScript. Maybe you could ask at WP:VPT to see if anyone could work up the code? — Mr. Stradivarius ♪ talk ♪ 07:02, 24 August 2013 (UTC)
Heh, I came here to post an editprotected request where I implemented this exact thing coming from T55291, and I see there's already one.
Please replace the entire code on the gadget page with code copied from here: http://pastebin.com/LHhkyZ3S (there's a copy-pasteable textbox at the bottom). The changes are small, but spread across the file, so I just pasted it there.
This will simplify and make better the code used to make MediaWiki's live preview work, make popups work with VisualEditor (related to T53565) and with Notifications flyout (T55291). Matma Rex talk 20:52, 27 August 2013 (UTC)
- Actually, wait a second, this won't work with VE yet. Lemme just fix it. Matma Rex talk 20:58, 27 August 2013 (UTC)
- Fixed code: http://pastebin.com/Snzvgd1X Matma Rex talk 21:06, 27 August 2013 (UTC)
- Done. Thanks for taking the time to code this up. Let me know if there are any issues with it. — Mr. Stradivarius ♪ talk ♪ 10:53, 28 August 2013 (UTC)
- Fixed code: http://pastebin.com/Snzvgd1X Matma Rex talk 21:06, 27 August 2013 (UTC)
setupPopups called with something that looks like a load event
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
function setupPopups( callback ) { ----------------------^
which will in turn throw an error when attempted being called:
if ( callback ) { callback(); --------^ ERROR: callback is not a function.
Issue observed at Commons. -- Rillke (talk) 14:41, 28 August 2013 (UTC)
- Ughhh… I guess this should use
if ( $.isFunction( callback ) )
instead. Matma Rex talk 14:44, 28 August 2013 (UTC)
It possibly comes from there:
hookEvent('load', setupPopups);
-- Rillke (talk) 14:45, 28 August 2013 (UTC)
- Again, I will need some actual code in order to enact this request. Or if you want me to revert the latest change, that can be done as well. As it stands, though, this is more of a conversation than an edit request. What action would you like performed? — Mr. Stradivarius ♪ talk ♪ 15:05, 28 August 2013 (UTC)
-if ( callback ) {
+if ( $.isFunction( callback ) ) {
is was Matma suggested, I think. -- Rillke (talk) 15:31, 28 August 2013 (UTC)
- Ok, Done. Thanks for spelling it out for me. :) — Mr. Stradivarius ♪ talk ♪ 15:45, 28 August 2013 (UTC)
Redirect alias for Japanese
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add the following line to redirLists
.
'ja': [ R, '転送' ],
See this for example. Thank you. --Atysn (talk) 10:37, 19 September 2013 (UTC)
deprecation
hi.
this gadget uses some deprecated calls, such as getElementsByClassName, hookEvent, addOnloadHook, and prolly some more. it's my understanding that very soon these will not be supported, so i think it's about time to clean it up. while doing so, the gadget code can become more streamlined. e.g.,
// example of existing function in current code:
function fixVectorMenuPopups() {
var vmenus = getElementsByClassName( document, 'div', 'vectorMenu');
for( i= 0; vmenus && i<vmenus.length; i++ ) {
var h5 = vmenus[i].getElementsByTagName('h5')[0];
if( h5) var a = h5.getElementsByTagName('a')[0];
if( a ) a.inNopopupSpan=true;
}
}
// using jquesry, this becomes:
function fixVectorMenuPopups() {
$('div.vectorMenu h5:first a:first').attr('inNopopupSpan', true);
}
as a side, vector menus switched some time ago (maybe a year or so) from "h5" to "h3" - this function is completely useless since, and the fact that nobody noticed is strange. peace - קיפודנחש (aka kipod) (talk) 22:16, 9 November 2013 (UTC)
- That should be
.prop('inNopopupSpan', true)
instead of.attr('inNopopupSpan', true)
. The old code uses a property (a.inNopopupSpan = true
), not an attribute (a.setAttribute('inNopopupSpan', 'true')
. Mixing them up will likely break something. Krinkle (talk) 21:46, 13 November 2013 (UTC)- thanks for the clarification - i stand corrected. of course, this error would break nothing - as i mentioned above, the selector will find nothing - vectorMenu does not have any "h5" elements for quite some time now (don't remember exactly when they were switched to "h3" - prolly over a year ago). i wrote the snippet above mainly to demonstrate how Doing The Right Thing® would make the code shorter and clearer.
- in the meantime, i'd like to point that even though references to getElementsByClassName were removed, there are still calls to deprecated stuff - cursory view revealed hookEvent() and addOnloadHook(), but i doubt very much these are the only two. this page contains a short and sweet explanation how to use "grep" to find all the uses of deprecated functions in some arbitrary JS source file. peace - קיפודנחש (aka kipod) (talk) 16:16, 14 November 2013 (UTC)
- The whole script is one big example of 'old code'. If you want to fix it, please do. Below I suggested opening up a github to facilitate collaboration. Personally, as long as it works, i'm still good with it. peace —TheDJ (talk • contribs) 23:24, 14 November 2013 (UTC)
- in its current state (some 7.7KLocs, over 30 different editors over the years, very few of which are still actively involved with it), it would be a nice surprise if there'll be significant activity on this github project. personally, i think it would be easier to start from scratch a new codebase, rather than modernize this one. FWIW, i created a gadget on hewiki that implements a small fraction of what this gadget does (only show the popup with a summary of the intro - without any frills whatsoever. i used some relatively new APIs and JS - i use "prop=extract" query to get the text, which was developed as part of the mobile project, and jquery.tipsy to show the popup. the whole thing is about 50 lines - you can see it here, if you're interested: he:Mediawiki:Gadget-showIntroOnHover.js). peace - קיפודנחש (aka kipod) (talk) 19:07, 24 November 2013 (UTC)
- The whole script is one big example of 'old code'. If you want to fix it, please do. Below I suggested opening up a github to facilitate collaboration. Personally, as long as it works, i'm still good with it. peace —TheDJ (talk • contribs) 23:24, 14 November 2013 (UTC)
Localisation
Last week popups broke on nl-wiki, probably due to the same reason as the previous topic, using obsoleted methods. We could have dived into bug fixing, but there are not a lot of coders on nl-wiki, so instead I proposed to use the English version instead, now that it is possible to include javascript crosswiki. The first thing we noticed however that we have the English text again in the interface. Instead of making a copy again and translating everything, it seems beneficial to look at localizing the code. All the text should already be available as mediawiki messages so it should only be a matter of calling the correct messages. Are people willing to look into this? Once done, it could be included on more wiki's and also, for users on en-wiki using another language for the interface, it would be in there prefered language.
Second problem we saw was that the disambiguation feature doesn't work anymore. That also seems to relate back to translation. I am told that can also be solved using the api, via MediaWiki:Disambiguationspage, you can find the relevant templates. Are people willing to look into this as well? Akoopal (talk) 20:31, 13 November 2013 (UTC)
- Does anyone think it might be a good idea to setup a github for popups, just as there is for Twinkle ? The script needs a lot of work, but I can't do it, and it's so much work that many people are somewhat put off to start to it as well I guess. Perhaps setting up a github might create the momentum that might be required. —TheDJ (talk • contribs) 21:52, 13 November 2013 (UTC)
- @Akoopal: You can already localize popups, have a look at the dewiki setup (localization in de:MediaWiki:Gadget-navigation-popups.js/de, loaded via de:MediaWiki:Gadget-navigation-popups.js). Amalthea 10:20, 15 November 2013 (UTC)
- Well that doesn't work 100% reliable of course, since there is no load order guarantee. —TheDJ (talk • contribs) 12:51, 15 November 2013 (UTC)
- That should only show if you /use/ popups before the loca script is loaded, and the texts could always be moved to the loader script. Amalthea 17:21, 15 November 2013 (UTC)
- @Amalthea, yes, that can work, but if I set my language on for example en-wiki to dutch, I also expect popups to be in dutch. I think it is really worth the effort to look into this, and seeing this, it is basically only this procedure you need to change. But for now, I will look into this as it is probably quicker. Will this also solve the disambiguation problem, or is more needed for that? Akoopal (talk) 22:26, 15 November 2013 (UTC)
- That should only show if you /use/ popups before the loca script is loaded, and the texts could always be moved to the loader script. Amalthea 17:21, 15 November 2013 (UTC)
- Well that doesn't work 100% reliable of course, since there is no load order guarantee. —TheDJ (talk • contribs) 12:51, 15 November 2013 (UTC)
Redirect alias for greek
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add the following line to redirLists
.
'el': [ R, 'ΑΝΑΚΑΤΕΥΘΥΝΣΗ'],
Thank you. --geraki TL 13:50, 13 March 2014 (UTC)
- done —TheDJ (talk • contribs) 13:20, 23 March 2014 (UTC)
Problem with comments and new line in lists
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Hi, sorry for my English! A problem was reported in the German Wikipedia. If the source code for a list element ends with a HTML comment, this comment and also the following new line are deleted for the preview and the next list element appears with a leading star on the same line and not with a bullet or number on a new line. I suggest to change the code in line 3832 to
this.data=this.data.replace(RegExp('^<!--[^$]*?-->\\n|\\n<!--[^$]*?-->(?=\\n)|<!--[^$]*?-->', 'g'), '');
This would delete lines including a new line, if they only consist of a HTML comment, and delete the HTML comment in other cases without joining lines together. Thank you --Wiegels (talk) 23:41, 24 January 2016 (UTC)
- Added a template to call an admin :-) --nenntmichruhigip (Diskussion) 23:47, 12 February 2016 (UTC)
- Done . No other comments so I have deployed this code — Martin (MSGJ · talk) 11:03, 16 February 2016 (UTC)
- Thank you MSGJ! The line 3833 can be omitted now, it was replaced by the code in the new line 3832.
- Another problem occurred after solving the first one. Could you please replace lines 1939 to 1943 by the following lines?
// [[Common links]] replace(/\[\[([^[|]*?)\]\](\w*)/g, function($0,$1,$2){return f("<a href='?'>?</a>", Insta.conf.paths.articles + htmlescape_attr($1), htmlescape_text($1) + htmlescape_text($2)); }). // [[Replaced|Links]] replace(/\[\[([^[]*?)\|([^\]]+?)\]\](\w*)/g, function($0,$1,$2,$3){return f("<a href='?'>?</a>", Insta.conf.paths.articles + htmlescape_attr($1), htmlescape_text($2) + htmlescape_text($3)); }).
- This explicitly prevents the regular expression from matching opening brackets in the first match in each case. The new code was tested successfully. Thanks again --Wiegels (talk) 19:26, 19 February 2016 (UTC)
- Done — Martin (MSGJ · talk) 14:51, 22 February 2016 (UTC)