Lightweight utility for Tampermonkey scripts to remove annoying CSS classes that block text selection and user interactions
// @require https://cdn.jsdelivr.net/gh/sterlingjf/tampermonkey-class-remover@main/class-remover-utility.jsconst CLASSES_TO_REMOVE = ['no-select', 'no-copy', 'unselectable'];
window.ClassRemoverUtility.removeClasses(CLASSES_TO_REMOVE);const options = {
logLevel: 'info', // 'silent', 'info', 'verbose'
watchDynamic: true, // Monitor for content added after page load
observerDelay: 100 // Delay before re-scanning (milliseconds)
};
window.ClassRemoverUtility.removeClasses(CLASSES_TO_REMOVE, options);Note
This list covers common accessibility-hindering classes. Use responsibly and respect content creators' rights.
no-select- Prevents text selectionno-copy- Blocks copy operationsnoselect- Alternative spellingunselectable- Descriptive variantdisable-select- Verbose versionreadonly- Form/code elements
Important
All examples require @run-at document-end in your userscript header.
News Sites:
const CLASSES = ['no-select', 'paywall-blur'];
window.ClassRemoverUtility.removeClasses(CLASSES, { logLevel: 'silent' });Documentation Sites:
const CLASSES = ['no-select', 'no-copy', 'readonly'];
window.ClassRemoverUtility.removeClasses(CLASSES);Social Media (dynamic content):
const CLASSES = ['unselectable-text', 'protected-content'];
window.ClassRemoverUtility.removeClasses(CLASSES, {
watchDynamic: true,
observerDelay: 50
});For debugging or custom workflows, the function returns an object:
const result = window.ClassRemoverUtility.removeClasses(classes);
console.log(`Removed ${result.removed} class instances`);
// Manually trigger another removal later
result.performRemoval();Returns:
removed(number) - Count of class instances removedperformRemoval(function) - Manually trigger another scan
MIT