/*
* @title Vine for Haiku
* @description Vineをハイクで見る
* @include http://h.hatena.ne.jp/*
* @include http://h.hatena.com/*
* @license MIT License
*/
(function() {
function vineSintax(doc) {
var vineurl = /https\:\/\/vine\.co\/v\/([0-1A-Za-z]+)/;
var entry = document.getElementsByClassName('entry-body-content');
for (i in entry) {
var out = '';
var body = entry[i].innerHTML;
if (body) {
var lines = body.split("<br>");
var last = lines.length - 1;
for (l in lines) {
if (l == 0) {
lines[l] = lines[l].replace("\n ", '');
}
if (vineurl.test(lines[l]) == true) {
out += 'OH!!!';
sintaxFlag = true
} else {
out += lines[l];
if (l != last) {
out += '<br>';
}
}
}
if (sintaxFlag == true) {
sintaxFlag = false;
out += lines[l];
}
entry[i].innerHTML = out;
}
}
}
vineSintax(document.body);
if (typeof unsafeWindow == 'undefined') {
/* Bookmarklet, etc... */
var TEN = Ten;
} else {
/* Greasemonkey */
var TEN = unsafeWindow.Ten;
}
TEN.AsyncLoader.executeWhenFragmentLoadedOrNow(function(frag) {
vineSintax(document.body);
}.bind());
})();