Tampermonkey is a userscript manager. It lets you install scripts written by other people, or write your own JavaScript, to change how a web page behaves, clean up its interface, or automate repetitive actions. It works in the major browsers and includes script updates, cloud sync, and a built-in editor.
Sites such as Greasy Fork make thousands of scripts easy to find. There are scripts for removing ads, skipping video intros, working around page restrictions, and helping with downloads. The real appeal is that the browser becomes a tool shaped around your own habits rather than someone else's defaults.
For anyone who likes tinkering, it is hard to ignore. But the point is not to break rules or bypass lawful restrictions. The more useful lesson is the one behind the old line about doing things yourself: keep learning, build your own solution, stay adaptable, and develop judgment and experience. That is what remains valuable in the age of AI.
At its core, a userscript is an external JS file. It usually starts with a block of metadata comments that tell the script manager what the script is called, where it should run, and what permissions it needs:
// ==UserScript==
// @name New Userscript
// @namespace https://viayoo.com/nf2t7f
// @version 0.1
// @description try to take over the world!
// @author You
// @run-at document-end
// @match https://*/*
// @grant none
// ==/UserScript==
One script I have used for a while translates pages into Chinese automatically. It checks the page language, collects visible text nodes, sends the text to Microsoft Edge's translation endpoint, and replaces the original text with the returned translation. I have run it for a while without obvious problems.
// ==UserScript==
// @name 词渡
// @namespace https://zooyoo.top/
// @version 1.0
// @description 页面自动翻译为中文
// @grant none
// ==/UserScript==
(function() {
if (window._translated) return;
window._translated = true;
function getLang() {
var lang = (document.documentElement && document.documentElement.getAttribute('lang')) ||
(document.head && document.head.getAttribute('lang')) || '';
return lang.toLowerCase();
}
function isForeign(lang) {
return lang && !lang.startsWith('zh');
}
function translate() {
if (!isForeign(getLang())) return;
var nodes = [];
var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, {
acceptNode: function(node) {
var parent = node.parentElement;
if (!parent || parent.tagName === 'SCRIPT' || parent.tagName === 'STYLE')
return NodeFilter.FILTER_REJECT;
return node.nodeValue.trim() ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
}
});
while (walker.nextNode()) nodes.push(walker.currentNode);
if (!nodes.length) return;
var texts = nodes.map(function(n) { return n.nodeValue; });
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://edge.microsoft.com/translate/translatetext?from=' + (getLang().split('-')[0] || 'en') + '&to=zh-CHS', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
try {
var data = JSON.parse(xhr.responseText);
var results = [];
if (Array.isArray(data)) {
for (var i = 0; i < data.length; i++) {
results.push(data[i] && data[i].translations ? data[i].translations[0].text : data[i]);
}
}
for (var i = 0; i < nodes.length && i < results.length; i++) {
if (results[i]) nodes[i].nodeValue = results[i];
}
} catch(e) {}
}
};
xhr.send(JSON.stringify(texts));
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', translate);
} else {
translate();
}
})();
To run it in Via browser, open the script installation prompt and accept it. If no prompt appears, go to Settings → Scripts → Add script and paste the code in manually.