User:Polygnotus/Scripts/SectionLinks.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2:
(function() {
function addLinkIcons() {
if (mw.config.get('wgIsMainPage')) {
return;
}
const headers = document.querySelectorAll('h2[id]');
headers.forEach(header => {
// Skip the table of contents heading
if (header.id === 'mw-toc-heading') {
return;
}
 
const isCurrentVersion = !window.___location.search.match(/[?&]oldid=(\d+)/) && !document.querySelector('.diff-currentversion-title');
Line 13 ⟶ 23:
} else {
// Add single icon for old revision or diff
addIcon(header, '�', true, 'Copy link to this section of this specific revision');
}
});