Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HaroldPetersInskipp/591329c8aafe54db7b90e10f9c1e44ff to your computer and use it in GitHub Desktop.
Save HaroldPetersInskipp/591329c8aafe54db7b90e10f9c1e44ff to your computer and use it in GitHub Desktop.
Change the GitHub Releases link to say Downloads
// ==UserScript==
// @name GitHub Releases to Downloads for people that aren't nerds
// @namespace https://github.com/HaroldPetersInskipp
// @homepage https://gist.github.com/HaroldPetersInskipp/591329c8aafe54db7b90e10f9c1e44ff
// @version 0.1
// @description Changes the "Releases" link on GitHub pages to say "Downloads"
// @author Inskipp
// @copyright 2024+, HaroldPetersInskipp (https://github.com/HaroldPetersInskipp)
// @license MIT
// @match https://github.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to replace text in a node
function replaceText(node) {
node.textContent = node.textContent.replace(/Releases/g, 'Downloads');
}
// Find all elements and text nodes containing "Releases"
const textNodes = document.evaluate("//text()[contains(., 'Releases')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
// Replace "Releases" with "Downloads"
for (let i = 0; i < textNodes.snapshotLength; i++) {
let currentNode = textNodes.snapshotItem(i);
replaceText(currentNode);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment