Skip to content

Instantly share code, notes, and snippets.

@eral
Created February 23, 2014 08:37
Show Gist options
  • Save eral/9168769 to your computer and use it in GitHub Desktop.
Save eral/9168769 to your computer and use it in GitHub Desktop.
javascript:(function(){
var w = window;
var d = document;
var u;
var h = d.location.href;
if (-1 != h.search(/^http:\/\/ext\.nicovideo\.jp\/api\/getthumbinfo\/\w{2}\d+/)) {
var v = d.getElementsByTagName("video_id")[0].innerHTML;
h = d.getElementsByTagName("title")[0].innerHTML;
var t = d.getElementsByTagName("length")[0].innerHTML;
w.alert('今日の作業BGM #nowplaying / ' + h + ' (' + t + ') #' + v + ' http://nico.ms/' + v);
} else if (-1 != h.search(/^http:\/\/www\.nicovideo\.jp\/watch\/(\w{2}\d+)/)) {
u = RegExp.$1;
} else if (-1 != h.search(/((?:sm|nm|lv|so)\d+)/)) {
u = RegExp.$1;
} else if (-1 != h.search(/(\w{2}\d+)/)) {
u = RegExp.$1;
} else {
w.alert("動画の特定に失敗しました。");
}
if (null != u) {
w.open('http://ext.nicovideo.jp/api/getthumbinfo/' + u,null,'');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment