More actions
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
// Discord link | // Discord link | ||
$(document).ready(function() { | $(document).ready(function() { | ||
var discordLink = $('<a href="https://discord.gg/your-invite-code | // Create the Discord link element | ||
$('#p- | var discordLink = $('<li id="discord-link"><a href="https://discord.gg/your-invite-code">Join Discord</a></li>'); | ||
// Prepend it as the first item in the overflow menu | |||
$('#p-vector-user-menu-overflow .vector-menu-content-list').prepend(discordLink); | |||
}); | }); | ||
$(document).ready(function() { | $(document).ready(function() { |
Revision as of 13:02, 30 March 2025
/* Any JavaScript here will be loaded for all users on every page load. */ // Discord link $(document).ready(function() { // Create the Discord link element var discordLink = $('<li id="discord-link"><a href="https://discord.gg/your-invite-code">Join Discord</a></li>'); // Prepend it as the first item in the overflow menu $('#p-vector-user-menu-overflow .vector-menu-content-list').prepend(discordLink); }); $(document).ready(function() { var $sections = $('.accordion-section'); // Initialize: disable links in all headers by default (since all start collapsed) $sections.find('.accordion-header a').css('pointer-events', 'none'); // Handle header clicks $('.accordion-header').on('click', function(e) { var $section = $(this).closest('.accordion-section'); var $content = $section.find('.accordion-content'); var isHidden = $content.is(':hidden'); if (isHidden) { // Collapse all other sections $sections.not($section).find('.accordion-content').slideUp(200); $sections.not($section).removeClass('expanded'); $sections.not($section).find('.accordion-header a').css('pointer-events', 'none'); // Expand this section $content.slideDown(200); $section.addClass('expanded'); $section.find('.accordion-header a').css('pointer-events', 'auto'); } else { // Collapse this section $content.slideUp(200); $section.removeClass('expanded'); $section.find('.accordion-header a').css('pointer-events', 'none'); } // Prevent link click if content is hidden if (e.target.tagName === 'A' && $content.is(':hidden')) { e.preventDefault(); } }); });