|
|
(15 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| # Replace the JAVASCRIPT_CODE section with this updated version:
| |
|
| |
|
| /* Sidebar collapsible sections */ | | /* |
| .collapsible-header { | | #mw-panel.collapsed { |
| cursor: pointer; | | width: 0; |
| font-weight: bold;
| | overflow: hidden; |
| padding: 5px 8px;
| |
| background: #f8f9fa; | |
| border-radius: 4px;
| |
| margin-bottom: 2px;
| |
| } | | } |
|
| |
|
| .collapsible-content { | | #mw-panel.collapsed .portal, |
| | #mw-panel.collapsed .vector-menu-content { |
| display: none; | | display: none; |
| margin: 0;
| |
| padding-left: 15px;
| |
| }
| |
|
| |
| .collapsible-section.active .collapsible-content {
| |
| display: block;
| |
| } | | } |
| | */ |
|
| |
|
|
| |
|
|
| |
|
| /* | | /* |
| .tm-li {
| |
| list-style: none;
| |
| margin: 0;
| |
| padding: 0;
| |
| }
| |
|
| |
|
| .tm-li > .tm-branch { | | .vector-menu.mw-portlet li.collapsible-header, |
| cursor: pointer;
| | .vector-menu-portal li.collapsible-header { |
| padding-left: 15px;
| | cursor: pointer; |
| background: url("/w/resources/src/mediawiki.skinning/images/arrow-ltr.png") no-repeat 0 50%;
| | font-weight: 600; |
| | display: flex; |
| | align-items: center; |
| } | | } |
|
| |
|
| .tm-li.collapsed > .tm-branch { | | .mw-collapsible-arrow { |
| background: url("/w/resources/src/mediawiki.skinning/images/arrow-rtl.png") no-repeat 0 50%;
| | display: inline-block; |
| | width: 1em; |
| | margin-right: 4px; |
| | transform-origin: center; |
| | transition: transform 0.2s ease; |
| | user-select: none; |
| } | | } |
| */
| |
|
| |
|
| /*
| | li.collapsible-header.open > .mw-collapsible-arrow { |
| .portal.collapsible .body {
| | transform: rotate(90deg); |
| display: block;
| |
| }
| |
| .portal.collapsible.collapsed .body {
| |
| display: none;
| |
| } | | } |
| .portal.collapsible h3 {
| |
| cursor: pointer;
| |
| padding-left: 15px;
| |
| background: url("/w/resources/src/mediawiki.skinning/images/arrow-ltr.png") no-repeat 0 50%;
| |
| }
| |
| .portal.collapsible.collapsed h3 {
| |
| background: url("/w/resources/src/mediawiki.skinning/images/arrow-rtl.png") no-repeat 0 50%;
| |
| }
| |
|
| |
| */
| |
|
| |
| /*
| |
|
| |
| $(document).ready(function() {
| |
| // Function to make sidebar sections collapsible
| |
| function makeSidebarCollapsible() {
| |
| // Target the sidebar navigation
| |
| $('#mw-panel .portal').each(function() {
| |
| var $portal = $(this);
| |
| var $header = $portal.find('h3');
| |
| var $body = $portal.find('.body');
| |
|
| |
| // Skip certain sections that shouldn't be collapsible
| |
| var portalId = $portal.attr('id');
| |
| if (portalId === 'p-search' || portalId === 'p-tb' || portalId === 'p-lang') {
| |
| return;
| |
| }
| |
|
| |
| // Add toggle functionality only to specific sections
| |
| var collapsibleSections = ['Documentation', 'Tools & Utilities', 'Community', 'Administrative', 'External Resources'];
| |
| var headerText = $header.text().trim();
| |
|
| |
| if (collapsibleSections.includes(headerText)) {
| |
| // Add toggle button to header
| |
| var $toggleBtn = $('<span class="sidebar-toggle">[−]</span>');
| |
| $header.append(' ').append($toggleBtn);
| |
|
| |
| // Add click handler
| |
| $toggleBtn.click(function(e) {
| |
| e.preventDefault();
| |
| e.stopPropagation();
| |
|
| |
| if ($body.is(':visible')) {
| |
| $body.slideUp(200);
| |
| $toggleBtn.text('[+]');
| |
| $portal.addClass('collapsed');
| |
| } else {
| |
| $body.slideDown(200);
| |
| $toggleBtn.text('[−]');
| |
| $portal.removeClass('collapsed');
| |
| }
| |
| });
| |
|
| |
| // Start collapsed for some sections
| |
| if (['Administrative', 'External Resources'].includes(headerText)) {
| |
| $body.hide();
| |
| $toggleBtn.text('[+]');
| |
| $portal.addClass('collapsed');
| |
| }
| |
| }
| |
| });
| |
| }
| |
|
| |
| // Run the function
| |
| makeSidebarCollapsible();
| |
|
| |
| // Also run after any AJAX content loads
| |
| $(document).ajaxComplete(function() {
| |
| makeSidebarCollapsible();
| |
| });
| |
| });
| |
|
| |
| */
| |
|
| |
| /*
| |
| mw.loader.using('mediawiki.util', function() {
| |
| mw.util.addCSS(`
| |
| .sidebar-toggle {
| |
| cursor: pointer;
| |
| font-weight: bold;
| |
| color: #0645ad;
| |
| margin-left: 5px;
| |
| font-size: 12px;
| |
| user-select: none;
| |
| }
| |
|
| |
| .sidebar-toggle:hover {
| |
| text-decoration: underline;
| |
| color: #0b0080;
| |
| }
| |
|
| |
| #mw-panel .portal.collapsed .body {
| |
| display: none;
| |
| }
| |
|
| |
| #mw-panel .portal h3 {
| |
| cursor: default;
| |
| }
| |
|
| |
| /* Style improvements for collapsible sections */
| |
| #mw-panel .portal {
| |
| margin-bottom: 0.5em;
| |
| }
| |
|
| |
| #mw-panel .portal .body ul {
| |
| margin: 0;
| |
| padding: 0;
| |
| }
| |
|
| |
| #mw-panel .portal .body li {
| |
| margin: 0.2em 0;
| |
| }
| |
| `);
| |
| });
| |
|
| |
| */ | | */ |