User:Dlrohrer2003/portlet-toggle

From wikishia
User script
Portlet Toggle
DescriptionMakes the portlets on the side collapsible.
AuthorDlrohrer2003
StatusStable
UpdatedNovember 23, 2015; Lua error in package.lua at line 80: module 'Module:Date' not found. (2015-11-23)
Skin supportMonoBook, Modern, and Cologne Blue
SourceUser:Dlrohrer2003/portlet-toggle.js, User:Dlrohrer2003/portlet-toggle.css

This Portlet Toggle script makes each portlet's heading clickable so that the respective portlet body can be collapsed leaving only the portlet's heading shown.

Usage

To use this script you should add the following line of code to your Special:MyPage/skin.js:

importScript('User:Dlrohrer2003/portlet-toggle.js');

Configuration

The configuration settings, all of which are optional, may be included should the you wish to customize some part of the script. The values used here are the defaults and are shown as an example of how to configure the script.

var collapsiblePortletsConfig = {

    // List of portlet IDs to not be collapsible
    persistent: ['#p-navigation','#p-search','#p-cactions','#p-personal'],

    // Time in milliseconds for the portlets to slide open or closed
    slideTime: 400
};

Compatibility

This script works with the all skins without much problem. The might cause a conflict with the Collapsible Nav Gadget when both are in use.

I have tested this script in Linux versions of several browsers including Mozilla Firefox, Opera, and Google Chrome. If you use a different browser, please leave a note about your experience.

This script also uses cookies so that each portlet can remain in a given state during the normal navigation of Wikipedia.

To do list

  • Periodically test this script's compatibility with various browsers and skins