Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AmazonからTwitterへのシェアの文面を整形するUserScript。Tampermonkeyで動作確認
// ==UserScript==
// @name AmazonShare
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Fwww.amazon.co.jp*
// @grant none
// @require https://code.jquery.com/jquery-3.4.1.slim.min.js
// ==/UserScript==
(function() {
'use strict';
var obj = $("#status")[0];
var text = obj.textContent;
text = text.replace(" を Amazon でチェック! ", "");
text = text.replace(/@(.+)?さんから/, "");
text = text.replace(/^.+ の /, "");
text = text.replace(/(.+)(https:\/\/amzn.to\/.+) /, " \"$1\" $2");
obj.textContent = text;
obj.focus();
obj.setSelectionRange(0, 0);
})();
@moyashi

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.