-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter-embeds.user.js
39 lines (34 loc) · 1.06 KB
/
twitter-embeds.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ==UserScript==
// @name Fix twitter embed
// @namespace http://tampermonkey.net/
// @version 2023-12-17
// @description Fix twitter embeds to use a different share url
// @author pnicto
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
(function () {
"use strict";
var btn = document.createElement("button");
btn.innerHTML = "Change clipboard";
btn.id = "embed-share";
btn.style.position = "fixed";
btn.style.padding = "10px";
btn.style.bottom = "10px";
btn.style.right = "10px";
document.body.appendChild(btn);
btn.addEventListener("click", function () {
navigator.clipboard
.readText()
.then((contents) => {
const URL = contents.replace("https://x", "https://fixupx");
navigator.clipboard.writeText(URL).catch((err) => {
console.error("Failed to copy: ", err);
});
})
.catch((err) => {
console.error("Failed reading contents", err);
});
});
})();