Content deleted Content added
Polygnotus (talk | contribs) ←Created page with '// Add link icons to h2 headers for current versions, old revisions, and diffs (function() { function addLinkIcons() { const headers = document.querySelectorAll('h2[id]'); headers.forEach(header => { const isCurrentVersion = !window.___location.search.match(/[?&]oldid=(\d+)/) && !document.querySelector('.diff-currentversion-title'); if (isCurrentVersion) { // Add two icons for cu...' |
Polygnotus (talk | contribs) No edit summary |
||
Line 1:
// Add link icons with tooltips to h2 headers for current versions, old revisions, and diffs
(function() {
function addLinkIcons() {
Line 9:
if (isCurrentVersion) {
// Add two icons for current version
addIcon(header, '🔗', false, 'Copy link to this section'); // Chain link emoji for section link
addIcon(header, '📌', true, 'Copy permalink to this section'); // Pushpin emoji for permalink
} else {
// Add single icon for old revision or diff
addIcon(header, '🔗', true, 'Copy link to this section of this specific revision');
}
});
}
function addIcon(header, iconText, isPermalink, tooltipText) {
const icon = document.createElement('span');
icon.innerHTML = iconText;
Line 24:
icon.style.marginRight = '5px';
icon.style.fontSize = '0.8em';
icon.title = tooltipText; // Add tooltip
icon.addEventListener('click', function(e) {
|