Jump to content

User:Markhurd/hidetopcontrib

From Wikipedia, the free encyclopedia
hidetopcontrib
Browsers *
Skins *
Languages en it
Code hidetopcontrib.js
Released March 26, 2009 (2009-03-26)
Updated May 8, 2022; 2 years ago (2022-05-08)
Developer   Mark Hurd

On any User's Contributions page, this script hides lines when that user has the top contribution for a page. Clicking again undoes the hiding.

If userHideAllSubsequent=true, all subsequent contributions are hidden too, more like watchlists.

Based on User:Ais523/hidetopcontrib.js

By a suggestion by User:Discospinster

Installation

[edit]

Add the following to your common.js:

importScript('User:Markhurd/hidetopcontrib.js');

Optionally also add the following, if you want it (see above):

userHideAllSubsequent=true;

Appearance

[edit]

This will create a new tab (not a new field or checkbox in the body of the page).

The Vector skin places the "Show/hide top" 'tab' in a drop down on the right hand side of the top line next to "Search".

Of course, as for anyone who cannot see the tab, you may need to refresh your cache the first time(s) after you change a .js file.

Alternatives

[edit]

These were used in the past or may be needed on other wikis:

Instead of importScript:

// [[:en:User:Markhurd/hidetopcontrib.js]]
mw.loader.load('//wiki.riteme.site/w/index.php?title=User:Markhurd/hidetopcontrib.js' 
              + '&action=raw&ctype=text/javascript');

or

// [[:en:User:Markhurd/hidetopcontrib.js]]
importScriptURI('http://wiki.riteme.site/w/index.php?title=User:Markhurd/hidetopcontrib.js' 
               + '&action=raw&ctype=text/javascript');


Instead of common.js, you can use your skin's .js, such as vector.js or monobook.js, but I have confirmed it (now) works in all skins.

Italians can use my it version direct rather than using this version remotely:

importScript('Utente:Markhurd/hidetopcontrib.js');

Known Bugs

[edit]

In IE8, at least, new articles and redirects where the edit summary does not contain a link are not removed whenever they should be. Don't have time to debug it fully now, but presumably the b index is wrong in this case. Mark Hurd (talk) 01:56, 9 July 2010 (UTC) IE uses capital tag names (i.e. <ABBR ...> instead of <abbr ...>), so I just made all Regex case independent. Mark Hurd (talk) 14:35, 6 February 2012 (UTC)

Currently it is removing some articles that are not the newest! At least it is for me in both Chrome and IE8. (For example, check my contributions and search for 2012 in Australia; note I am not the top contributor but it is removed.) Mark Hurd (talk) 01:06, 20 March 2012 (UTC) This was due to WP:AORC using <strong> for large changes. Mark Hurd (talk) 02:05, 21 March 2012 (UTC)

Not quite a bug, but the suggested changes from == to === actually break this code somehow, so they haven't been done. Mark Hurd (talk) 00:50, 21 January 2015 (UTC)

Revision History

[edit]

090325 MEH

  • Fixed where it is not hiding all (top)s, starting with redirects and continuing after any regex mismatch.

090615 MEH

  • Cater for new <span class="mw-uctop">
  • Add userHideAllSubsequent user setting.
  • Fix issue reported by Lenore.

100407 MEH

  • Use simplified regex that works on IE8.

100413 MEH

  • Cater for new pages.

100428 MEH

  • Cater better for new pages.

100519 Ale_jrb

  • Cater for Single-Revision Deletion, newly available to Admins

110520 Waldir

  • Better page check.

120206 MEH

  • Cater for IE renderer.

120207 MEH

  • Cater for all skins.

120321 MEH

  • Cater for WP:AORC by removing support for top not using the mw-uctop class.

121123 Waldir

  • Allow user configuration of link location and text.

150121 MEH

  • Remove legacy Javascript.