Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Created April 22, 2022 13:26
Show Gist options
  • Save Akkiesoft/8f3ef2ec1a590132b90e24a423b4cb5e to your computer and use it in GitHub Desktop.
Save Akkiesoft/8f3ef2ec1a590132b90e24a423b4cb5e to your computer and use it in GitHub Desktop.
override tweet button to the toot to mastodon.
// ==UserScript==
// @name birds gone somewhere
// @match https://twitter.com/intent/tweet*
// @version 0.1
// @description override tweet button to the toot to mastodon.
// ==/UserScript==
var base = "https://social.mikutter.hachune.net/share?text=";
var url = location.href.split('?')[1].split('&');
var twtext = "";
var twurl = "";
for (var i = 0; i < url.length; i++) {
var j = url[i].split('=');
if (j[0] == 'text') {
twtext = j[1];
}
if (j[0] == 'url') {
twurl = "%0D%0A" + j[1];
}
}
var newurl = base + twtext;
if (twurl) { newurl += twurl; }
location.href = newurl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment