Skip to content

Instantly share code, notes, and snippets.

@SSubPPaRR
Last active October 30, 2025 08:31
Show Gist options
  • Select an option

  • Save SSubPPaRR/29134d4e1431a8f4276f8af0767c7273 to your computer and use it in GitHub Desktop.

Select an option

Save SSubPPaRR/29134d4e1431a8f4276f8af0767c7273 to your computer and use it in GitHub Desktop.
twitter/X auto embed url on copy url
// ==UserScript==
// @name Twitter URL Switcher
// @namespace tampermonkey
// @version 0.1
// @description Switches the domain of Twitter URLs to vxtwitter when copied
// @author SSubPPaRR
// @match https://twitter.com/*
// @match https://x.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.addEventListener('copy', function(event) {
var clipboardContent = document.getSelection().toString();
console.log("copied link:", clipboardContent)
if (clipboardContent.match(/https?:\/\/x\.com\/\w+\/status\/\d+(\?s=\d+)?/)) {
var newURL = clipboardContent.replace('https://x', 'https://vxtwitter');
event.clipboardData.setData('text/plain', newURL);
event.preventDefault();
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment