User talk:Lupin/recent2.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Please go to User talk:Lupin/Anti-vandal tool to discuss this script.


Editing this[edit]

Lupin, do you mind if I edit this to add some more keywords/change the code a little? I can test it on my own user account first so as not to mess everyone else up, but do you mind? -Mysekurity(have you seen this?) 09:50, 11 December 2005 (UTC)[reply]

I don't have any huge objection, although my preference would be for you to explain the changes you want to make and show me the version you want to change to. Lupin|talk|popups 16:53, 11 December 2005 (UTC)[reply]


Warn[edit]

linkmaker(wikiBase + 'User_talk:' + bundle.editor + '?action=edit' + 
'&autoedit=s#$#\{{subst:test1-n|' + bundle.articleTitle +
'}}%20~~~~#&autosummary=Your%20recent%20edits','warn')

Lupin, What do you think about replacing the code-piece above with the one below

linkmaker(wikiBase + 'User_talk:' + bundle.editor + '?action=edit' +
            '&autoedit=s#$#\n==%20Regarding%20your%20edits%20on%20[[' + bundle.articleTitle + 
']]\n\n{{subst:test1-n|' + bundle.articleTitle + 
'}}%20~~~~#&autosummary=Your%20recent%20edits%20on%20' + bundle.articleTitle,'warn')

I feel this would make a better talk entry. --kkailas 12:24, 18 May 2006 (UTC)[reply]

New vandalism templates[edit]

This code should add 3 new links to the test, vandalism and delete templates defined in WP:UTM. That would be nice if you could support these, since they are real nice :) -- lucasbfr talk 21:46, 22 January 2007 (UTC)[reply]

  linkmaker(wikiBase + 'User_talk:' + bundle.editor + '?action=edit' +
	    '&autoedit=s#$#\{{sub'+'st:uw-test1|' + bundle.articleTitle +
	    '}}%20#&autosummary=Your%20recent%20edits',
	    'test')     + ' | ' +
  linkmaker(wikiBase + 'User_talk:' + bundle.editor + '?action=edit' +
	    '&autoedit=s#$#\{{sub'+'st:uw-vandalism1|' + bundle.articleTitle +
	    '}}%20#&autosummary=Your%20recent%20edits',
	    'vand')     + ' | ' +
  linkmaker(wikiBase + 'User_talk:' + bundle.editor + '?action=edit' +
	    '&autoedit=s#$#\{{sub'+'st:uw-delete1|' + bundle.articleTitle +
	    '}}%20#&autosummary=Your%20recent%20edits',
	    'del')     + ' | ' +

Recent IP edits etc.[edit]

Shouldn't 'Recent IP edits' be implemented by adding an '&hideliu=1' to the 'feed' string, rather than by requesting all edits and then filtering out those whose editors match a RegExp? The same applies to hiding one's own edits ('&hidemyself=1'). Or doesn't the RSS feed work that way? Philip Trueman 10:35, 14 May 2007 (UTC)[reply]

Edit[edit]

{{editprotected}} Please replace
'Reverted edits by [[Special:Contributions/' + escape(bundle.editor) + '|' + escape(bundle.editor) + ']] to last version by ' + escape(prevEditor);
with
'Reverted edits by [[Special:Contributions/' + escape(bundle.editor) + '|' + escape(bundle.editor) + ']] ([[User talk:' + escape(bundle.editor) + '|talk]]) to last version by ' + escape(prevEditor);
For consistency with the edit summary of the admin rollback tool (see e.g. [1]). Melsaran (talk) 16:22, 2 October 2007 (UTC)[reply]

I assume Lupin can do this, so admin help isn't required. — Carl (CBM · talk) 17:25, 2 October 2007 (UTC)[reply]

Small fixes[edit]

Hi!

Could someone please replace the current code by this fixed version from my common.js? Here is what I changed:

  • Fixed the watchlist monitoring, which was broken since rev:84718 was merged into MediaWiki (see also User talk:Lupin/Anti-vandal tool/Archive 4#watchlist, and the related fix from 2007);
  • Fixed the error handling of the two requests (broken in this edit), by replacing one occurrence of "getWatchlist" by "recent2.getWatchlist", and "getSpelldict" by "recent2.getSpelldict"
  • Replaced the "parseJavascript" from this edit by "recent2.parseJavascript"
  • Used mw.config.get to access the MediaWiki variables (they are not global if $wgLegacyJavaScript = false, as in Translatewiki.net, and in the future on Wikipedia)
  • Removed deprecated "ta" code
  • Used jQuery instead of the old addOnloadHook
  • Added the configuration to make it possible to validate the code using the tool recommended by MediaWiki developers (jsHint)
  • Fixed a few comparisons and declared a few variables suggested by the validator

Helder 17:04, 20 October 2013 (UTC)[reply]

Can you confirm if you have been able to fully test the requested code? — Martin (MSGJ · talk) 08:22, 22 October 2013 (UTC)[reply]
MSGJ, I tested, and now I noticed also an old bug which will be fixed by this new version of the script. Helder 18:40, 22 October 2013 (UTC)[reply]
Okay,  deployed — Martin (MSGJ · talk) 09:41, 23 October 2013 (UTC)[reply]

A few simplifications[edit]

Hi!

I simplified the script a little and made a few other updates:

  • Use mw.util.wikiGetlink to get the value of the href attributes
  • Use protocol relative URLs
  • Escape strings with $.escapeRE before using them as part of a regex
  • Fixed another regex
  • Use <span> instead of the deprecated <font> element
  • Do not duplicate values which are already available through wgNamespaceIds
  • Remove unused global function window.clickDetails;
  • Use $.inArray to check if 'sysop' is in the array wgUserGroups
  • Use the standard mw.util.addPortletLink instead of a custom recent2.addToolboxLink
  • Use the standard mw.util.getParamValue instead of a custom recent2.getParamValue
  • Use (a shortcut for) the standard $( document ).ready( handler ) instead of a custom recent2.runOnLoad
  • Compare page names with wgPageName instead of calling a function to build a regex which detects variations in the usage of spaces and underscores
  • Rename a two variables to make it clear they contain a page name (not an URL)
  • Add missing semicolons;
  • Add FIXME comments to highlight parts of the code which still needs improvements
  • Fix trailing comments
  • Use dot notation for objects (this.that) instead of strings (this['that'])
  • Make sure all dependencies are loaded before using them
  • Also load the module "mediawiki.action.history.diff" to improve the formatting of the diffs (related to bugzilla:34798 / bugzilla:34800)
  • Update jsHint config to match this improved version

Could someone merge these changes? Helder 16:21, 23 October 2013 (UTC)[reply]

Okay I'll take it for granted that everything is tested :)  Done — Martin (MSGJ · talk) 19:24, 23 October 2013 (UTC)[reply]

IPv6 compatibility (and minor fixes)[edit]

Hello again!

I improved the script a little more:

  • Added IPv6 compatibility
  • Added missing new operators and curly braces around blocks
  • Converted some expressions to more understandable if statements
  • Converted some RegExp constructors to literals
  • Used $.escapeRE to escape regular expressions characters
  • Removed unused global recent2.testPage
  • Indicated the license of the script
  • Formatted some multiline comments
  • Updated jsHint configuration, to better match the config used on MediaWiki

Could someone merge the new code? Helder 16:29, 24 October 2013 (UTC)[reply]

 Done — Martin (MSGJ · talk) 11:25, 25 October 2013 (UTC)[reply]

Separation of logic and interface[edit]

I would like someone to make this update to the code:

  • Move the interface messages into an object and use mw.msg to access them (this makes it easier to adapt the script to wikis in other languages)
  • Fix a bug I introduced in a previous update: the spellchecker links were not automatically fixing the text. This was because recent2.getParamValue considered the character "#" as part of the parameters while mw.util.getParamValue doesn't. I've replaced "#" by another character ("♫").

Helder 18:30, 25 October 2013 (UTC)[reply]

DoneMr. Stradivarius ♪ talk ♪ 03:51, 27 October 2013 (UTC)[reply]

Replace "wikiGetlink" by "getUrl"[edit]

Hello!

Please replace the 5 occurrences of "wikiGetlink" by "getUrl" (as I did on Portuguese Wikipedia), per bugzilla:55764 / gerrit:94270). Helder 21:37, 11 November 2013 (UTC)[reply]

done —TheDJ (talkcontribs) 14:10, 13 November 2013 (UTC)[reply]

window.AVTAutoEdit[edit]

TheDJ, are you sure the old window.AVTAutoEdit and window.autoEdit can be merged into a single window.AVTAutoEdit? Helder.wiki 13:26, 2 April 2014 (UTC)[reply]

@Helder.wiki: Good point. fixed now. I needed to get this split off, it was clashing with the globals from navpopups. my god our old gadgets are a mess. —TheDJ (talkcontribs) 14:13, 2 April 2014 (UTC)[reply]

Change to non-admin rollback edit summary[edit]

Please change the line 'avt-reverted-edits': 'Reverted edits by [[Special:Contributions/$1|$1]] to last version by $2', to 'avt-reverted-edits': 'Reverted edits by [[Special:Contributions/$1|$1]] ([[User talk:$1|talk]]) to last version by $2', in order to provide a link to the talk page of the user whose edits are being reverted and ensure consistency between edit summaries generated by the various rollback tools on Wikipedia. — Preceding unsigned comment added by My Chemistry romantic (talkcontribs)

Done seems uncontroversial — Martin (MSGJ · talk) 10:04, 21 December 2016 (UTC)[reply]

jquery.mwExtension[edit]

Hi! Could you do a change like this to migrate from the deprecated module to "mediawiki.RegExp"? Helder 03:31, 18 August 2017 (UTC)[reply]

Done by TheDJ — Martin (MSGJ · talk) 19:39, 30 August 2017 (UTC)[reply]

Needed mw.loader change[edit]

I propose to change line 1223 from "mw.loader.using( 'mediawiki.action.history.diff', function(){" to "mw.loader.using( 'mediawiki.diff.styles', function(){" -- the location of the diff CSS styles having recently changed. I'm posting this first in case anyone has an objection (if not, go ahead and do it!). --R'n'B (call me Russ) 18:08, 23 January 2018 (UTC)[reply]

+1. See WP:Village pump (technical)#mediawiki.action.history.diff. Helder 20:13, 23 January 2018 (UTC)[reply]

 Done --R'n'B (call me Russ) 20:58, 23 January 2018 (UTC)[reply]

Ah - that would explain why my version of Lupin's spellchecker with my own tweaked .js file has stopped working. The change at line 1223 got it back functioning again. Thanks for posting this. Regards from the UK, Nick Moyes (talk) 22:36, 12 February 2018 (UTC)[reply]