Skip to content

Instantly share code, notes, and snippets.

@aiwas
Last active February 25, 2019 18:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aiwas/3777a9ca759daaa044d17b5db73bda87 to your computer and use it in GitHub Desktop.
Save aiwas/3777a9ca759daaa044d17b5db73bda87 to your computer and use it in GitHub Desktop.
/shareが自動で閉じないことに納得がいかないのを解消するスクリプト
// ==UserScript==
// @name Mastodon Share Page Auto-Closer
// @namespace https://github.com/aiwas/
// @version 0.2
// @description /shareが自動で閉じないことに納得がいかないのを解消するスクリプト
// @author aiwas
// @match https://yysk.icu/share*
// ==/UserScript==
(function() {
'use strict';
function cls() {
window.open('about:blank', '_self').close();
}
var wrp = document.getElementsByClassName("compose-form__publish-button-wrapper");
var btn = wrp[0].firstElementChild;
btn.addEventListener("click", cls, false);
})();
// ==UserScript==
// @name Twitter Share Page Replacer
// @namespace https://github.com/aiwas/
// @version 0.1
// @description /intent/tweetをMastodonの/shareに置き換えるスクリプト
// @author aiwas
// @match https://twitter.com/intent/tweet?text=*
// @match https://twitter.com/intent/tweet?url=*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var text = document.getElementById("status").innerHTML;
window.location.replace("https://yysk.icu/share?text="+encodeURIComponent(text.replace(/(@[A-Za-z0-9_]+)/g, "$1@twitter.com ")));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment