Page MenuHomePhabricator

Vector: Allow setting collapsiblenav state from user JS
Closed, DeclinedPublic

Description

For stewards who do lots of crosswiki stuff and have hacked up global user JS for themselves. Also allow disabling EditWarning this way.


Version: unspecified
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=55905

Details

Reference
bz23807

Event Timeline

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

+1

being able to set something like this:

VectorPreferences.editwarning.enable = 0;

in my @meta global.js would be great

Just add to your file:
wgVectorEnabledModules.collapsiblenav = 0;

and for editwarning:
wgVectorEnabledModules.editwarning = 0;

(In reply to comment #2)

Just add to your file:
wgVectorEnabledModules.collapsiblenav = 0;

and for editwarning:
wgVectorEnabledModules.editwarning = 0;

This works in vector.js itself, but not in files included with importScriptURI() because of script loading order.

Just thought I'd explain this for others to read:

The Vector extension / Vector preferences, in contrary to other extensions and preferences, dont have an effect the enable/disable state directly.

Instead it echo'es something like the following on the page:

<code>
<script type="text/javascript">var wgVectorPreferences = {
"collapsiblenav": {

		"enable": 1

},
"editwarning": {

		"enable": 1

}
};
var wgVectorEnabledModules = {
"collapsiblenav": true,
"collapsibletabs": true,
"editwarning": true,
"footercleanup": false,
"simplesearch": true
};</script>
</code>

And somewhere after this the actual extension is loaded via javascript and when it initialises it checks these variables.

Because of this it is possible to override the above by putting something in the local user-custom vector.js file because it is loaded in the head-section.

However, functions like onloadHook and importScriptURI() aren't excecuted untill after the page has finished loading (and the extention is initialized) - so toggling some variable switches isn't having any effect anymore then.

Krinkle

[Moving Vector stuff to Vector extension]

Andre: did you mean to mark this bug as unconfirmed?

[Moving back as collapsibleNav is now part of core]

(In reply to comment #6)

Andre: did you mean to mark this bug as unconfirmed?

Probably mass-reset to UNCONFIRMED due to fixing bug 52943.
Feel free to reconfirm.

The ability to override the collapsing of the sidebar items should be restored to a user preference (or a gadget). Users shouldn't have to cobble together a custom CSS or JS solution to counteract this rudeness.

I don't know why anyone thought "hiding" user interface items was a good idea the first place....