Created
May 8, 2018 14:59
-
-
Save hyuki/18cd0b5ceaf95b34059855c57c090ad4 to your computer and use it in GitHub Desktop.
edit.js - いまいるURLの数字部分を切り出して、それに対応しているファイルを編集するためのコマンドを作って表示するブックマークレット
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
/* | |
* https://math.hyuki.net/20180508235800/ のようなページにアクセスしているとき、 | |
* "vi ~/Documents/doc/math.hyuki.net/txt/20180508235800.txt"というコマンド文字列を表示してくれる。 | |
*/ | |
function start() { | |
if (location.href.match(/math.hyuki.net\/(\d+)/)) { | |
prompt('Edit Me!', 'vi ~/Documents/doc/math.hyuki.net/txt/' + RegExp.$1 + '.txt'); | |
} else { | |
alert("math.hyuki.net/YYYYMMDDhhmmss is not found."); | |
} | |
} | |
start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bookmarkletへの変換は以下のようなサイトを使うと手軽。
https://mrcoles.com/bookmarklet/