Created
May 13, 2020 03:08
-
-
Save hyuki/70f24af1e166d622cf66a14cd84d4b0e to your computer and use it in GitHub Desktop.
TwitterMarkdownCommand.js - Convert URL to Command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* TwitterMarkdownCommand.js | |
* | |
* When you see: | |
* https://twitter.com/hyuki/status/1079981317184315392 | |
* Then show the following line: | |
* twitter-markdown https://twitter.com/hyuki/status/1079981317184315392 | pbcopy | |
*/ | |
function start() { | |
let url = location.href; | |
if (url.match(/^(https?:\/\/twitter\.com\/.*)/)) { | |
let cmd = 'twitter-markdown ' + RegExp.$1 + ' | pbcopy'; | |
window.prompt("TwitterMarkdownCommand.js", cmd); | |
} else { | |
alert("Twitter URL is not found.\n" + url); | |
} | |
} | |
start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment