Page MenuHomePhabricator

A button on the page to toggle hidden categories
Open, LowPublicFeature

Description

Sometimes you want to see hidden categories of the article you're reading just for a moment. You don't want to navigate away to the preferences to change the hidden category setting then navigate back to the page you were reading.

This especially happens for people that mostly just read but sometimes edit.

Since the hidden categories are there just hidden by CSS it would be trivial to add a checkbox in JavaScript to toggle between display:none and display:block


Version: unspecified
Severity: enhancement

Details

Reference
bz21119

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:55 PM
bzimport set Reference to bz21119.
bzimport added a subscriber: Unknown Object (MLST).

I, too, would welcome our new hidden-category overlords.

Andrew, maybe this would fit in with the category editing widget you were experimenting with?

(In reply to comment #1)

I, too, would welcome our new hidden-category overlords.

Andrew, maybe this would fit in with the category editing widget you were
experimenting with?

Possibly, although it'd be just as easy to add this separately.

chughakshay16 wrote:

It makes a link in the bottom of the page for the hidden category links

Two changes have been made to achieve this effect :

  1. Skin.php

if ( isset( $allCats['hidden'] ) ) {
....
.....
$s.='<a id="mw-toggle-cat" href="javascript:void(0)"><i>Show hidden categories</i></a>';
....
....
}
This statement adds an anchor element just below the div(#mw-normal-catlinks)

  1. Mediawiki.page.ready.js

....
...
var toggleCatBool = true;
$("#mw-toggle-cat").click(function(event){

			$("#mw-hidden-catlinks").toggle();
			var text='';
			if(toggleCatBool)
				text='Hide Hidden Category Links';
			else 
				text='Show Hidden Category Links';
			document.getElementById("mw-toggle-cat").innerHTML='<i>'+text+'</i>';
			toggleCatBool=!toggleCatBool;

});
....
....
This manages the toggling behavior of div(#mw-hidden-catlinks)

Attached:

sumanah wrote:

Akshay, please go ahead and submit this as a branch in Git.

https://www.mediawiki.org/wiki/Git/Workflow

That way it can get reviewed faster. Thanks.

Akshay, please go ahead and submit this as a branch in Git.

This patch would require a complete rewrite, no point in pushing it at the moment.

  • Unlocalised text.
  • Weird <a id="mw-toggle-cat" href="javascript:void(0)"><i>Show hidden

categories</i></a> that will not work with JS disabled. Instead, JS should generate such links completely.

  • Mix of jQuery and raw JS.
  • Code style.
  • Messages must use sentence case.

sumanah wrote:

Marking patch reviewed. Akshay, are you interested in rewriting to address Max's criticisms?

chughakshay16 wrote:

(In reply to comment #6)

Marking patch reviewed. Akshay, are you interested in rewriting to address
Max's criticisms?

Okay , I would address the issues pointed out by Max and submit a new patch.

chughakshay16 wrote:

(In reply to comment #5)

Akshay, please go ahead and submit this as a branch in Git.

This patch would require a complete rewrite, no point in pushing it at the
moment.

  • Unlocalised text.
  • Weird <a id="mw-toggle-cat" href="javascript:void(0)"><i>Show hidden

categories</i></a> that will not work with JS disabled. Instead, JS should
generate such links completely.

  • Mix of jQuery and raw JS.
  • Code style.
  • Messages must use sentence case.

I have committed the changes to gerrit.
changeset link - https://gerrit.wikimedia.org/r/3981
It takes care of all the issues you pointed out earlier.

I have abandoned change 3981 for now so it does not clutter people dashboards. IF there is really an interest in such a feature and someone willing to continue this change, feel free to reopen it.

matmarex set Security to None.
matmarex removed a subscriber: Unknown Object (MLST).

I can do this with a user script if it is still desired - assign it to me if a user script would be helpful

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM
Aklapper removed a subscriber: TrevorParscal.