MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/*PLEASE DON'T MESS WITH*/
$(function() {
var homeTab = document.querySelector('#ca-talk a');
if (homeTab) {
homeTab.setAttribute('href', 'https://wiki.jcraft-eoe.com/index.php?title=Main_Page');
// Ensure the link is physically clickable
homeTab.style.pointerEvents = 'auto';
homeTab.style.display = 'inline-block';
}
});
mw.hook('wikipage.content').add(function($content) {
$content.find('#toc li').has('ul').each(function() {
var $li = $(this);
if ($li.children('.fandom-toc-toggle').length === 0) {
// Insert a purple clickable arrow before the link
$li.prepend('<span class="fandom-toc-toggle" style="cursor:pointer; display:inline-block; width: 16px; text-align:center; color:#a862ea; margin-right:4px; font-size:10px; transition: transform 0.2s;">▼</span>');
}
});
$content.find('.fandom-toc-toggle').off('click').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
var $toggle = $(this);
var $sublist = $toggle.siblings('ul');
$sublist.slideToggle(200, function() {
if ($sublist.is(':visible')) {
$toggle.css('transform', 'rotate(0deg)');
} else {
$toggle.css('transform', 'rotate(-90deg)');
}
});
});
});