Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner

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