Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Last active January 19, 2018 22:46
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 hyuki0000/3f06c7868ddaef6a228e02899276f728 to your computer and use it in GitHub Desktop.
Save hyuki0000/3f06c7868ddaef6a228e02899276f728 to your computer and use it in GitHub Desktop.
TipmonaTipBookmarklet.js - Pay monacoin via @tipmona
/*
* TipmonaTipBookmarklet.js
*
* When you see
* https://twitter.com/EXAMPLEUSER/...
* Then you jump to
* https://twitter.com/intent/tweet?text=@tipmona%20tip%20@EXAMPLEUSER%201%20Mona%20を贈ります。
* And when you see
* https://twitter.com/EXAMPLEUSER/status/xxxxxxxx
* Then you jump to
* https://twitter.com/intent/tweet?in_reply_to=xxxxxxxx&text=@tipmona%20tip%20@EXAMPLEUSER%201%20Mona%20を贈ります。
*
* Written by Hiroshi Yuki.
* Licensed under CC0.
* https://creativecommons.org/publicdomain/zero/1.0/
*
*/
function start() {
var url = location.href;
var ar = url.match(/^https:\/\/twitter\.com\/([^\/]+)\/status\/(\d+)/);
var br = url.match(/^https:\/\/twitter\.com\/([^\/]+)/);
if (br) {
var username = br[1];
var optional = '';
if (ar) {
var status_id = ar[2];
optional = 'in_reply_to=' + status_id + '&';
}
location = 'https://twitter.com/intent/tweet?' + optional + 'text=@tipmona%20tip%20@' + username + '%201%20Mona%20を贈ります。';
} else {
alert("Username is not found.");
}
}
start();
@hyuki0000
Copy link
Author

hyuki0000 commented Jun 16, 2017

0.39 Thank you! バージョン

function start() {
  var url = location.href;
  var ar = url.match(/^https:\/\/twitter\.com\/([^\/]+)\/status\/(\d+)/);
  var br = url.match(/^https:\/\/twitter\.com\/([^\/]+)/);
  if (br) {
    var username = br[1];
    var optional = '';
    if (ar) {
      var status_id = ar[2];
      optional = 'in_reply_to=' + status_id + '&';
    }
    location = 'https://twitter.com/intent/tweet?' + optional + 'text=@tipmona%20tip%20@' + username + '%200.39%20Thank you!%0D%0Amonacoin.hyuki.net';
  } else {
    alert("Username is not found.");
  }
}
start();

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