User:GhostInTheMachine/FoldSections
|
GhostInTheMachine • Talk • Barnstars • Help • Misc • Modules • Other • Layout • Photos • Projects • Scripts — UBX • drafts • t • test • wip • 2024-08-11 12:46:49 |
Purpose
This script adds an icon in front of each section header.
- for a section that is expanded — fully displayed
- for a section that is collapsed — everything below the heading is hidden
Use
The icon acts as a toggle button — collapsing or "folding" the text of a displayed section or displaying the text of a currently collapsed section.
The icon is added to all headings from H2 down.
Prerequisites
The script probably only works on Vector. I have not tried it on other skins or on Evil Vector.
Installing
Add the following line to your common.js file.
{{subst:Lusc|User:GhostInTheMachine/FoldSections.js}}
Add the following line for elsewhere
mw.loader.load( '/w/index.php?title=User:GhostInTheMachine/FoldSections.js&action=raw&ctype=text/javascript' ); // Backlink: User:GhostInTheMachine/FoldSections.js
Notes
This script was shamelessly stolen from User:BrandonXLF/CollapseSections.
I then changed the CSS to change the icons from up/down chevrons to down/right chevrons
- See the collection of possible "standard" OOUI icons.
The script is active for articles, talk pages and (now) user contribution pages.
Contributions list
In March 2022, T298638 added daily date headings into the user contributions page. Rather than have the code test for which skin was in use and only output them for the mobile skin, on the desktop skins the dates are just hidden.
This script adds CSS to cause the daily dates to be also displayed for desktop skins, so that it is possible to collapse individual days in the list.
Talk pages
The script no longer works on talk pages (and such pages as the Village Pump) due to the Discussion Tools changes. Talk pages no longer show the section headings in H2 tags as nature intended, but in a div tag which has a mw-heading2 class.
As of January 2023[update], I am working to alter this script to cope with the change.
Alternatives
- User:BrandonXLF/CollapseSections — the original — puts icons in front of all section headings
- User:BethNaught/hideSectionDesktop — puts links after the section headings — only H2 headings
Bugs
June 2024
Damage due to a series of changes to the HTML created for headings.
- see
T365736 and more details in mw:Heading HTML changes
Possible improvements
Replace the icons with characters
- This might avoid any extra load dependency
- This would allow them to be styled to a different colour
- Maybe — ↑ and ↓
- Have different jQuery filters for articles and the contributions page
See also
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.