Skip to content

Instantly share code, notes, and snippets.

@moyashi
Created February 16, 2020 11:32
Show Gist options
  • Save moyashi/43cde6136a317cc9de93859d4da8d302 to your computer and use it in GitHub Desktop.
Save moyashi/43cde6136a317cc9de93859d4da8d302 to your computer and use it in GitHub Desktop.
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
Copy link
Author

moyashi commented Feb 16, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment