@@ -10,7 +10,7 @@ */ /* Referred from: http://let.hatelabo.jp/wakabatan/let/gYC-x9zd--KOWg */-Hatena.Haiku.Pager.addEventListener('loadedEntries', aaSintax);+unsafeWindow.Hatena.Haiku.Pager.addEventListener('loadedEntries', aaSintax); aaSintax(document.body); void(0);
/*
* @title AA Sintax for Hatena Haiku
* @description はてなハイクでAA記法を使えるようにする
* @include http://h.hatena.ne.jp/*
* @exclude http://h.hatena.ne.jp/help/*
* @exclude http://h.hatena.ne.jp/setting/*
* @exclude http://h.hatena.ne.jp/settings/*
* @exclude http://h.hatena.ne.jp/album/*
* @license MIT License.
*/
/* Referred from: http://let.hatelabo.jp/wakabatan/let/gYC-x9zd--KOWg */
unsafeWindow.Hatena.Haiku.Pager.addEventListener('loadedEntries', aaSintax);
aaSintax(document.body);
void(0);
function aaSintax(doc) {
var startSintax = /^>\;\|aa\|$/;
var endSintax = /^\|\|<\;$/;
var sintaxFlag = false;
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 (startSintax.test(lines[l]) == true) {
sintaxFlag = true;
out += '<div style="font-family:IPAMonaPGothic,'+
"'" + 'MS Pゴシック' + "'" +
',sans-serif;font-size:16px;line-height:18px;">';
} else if (endSintax.test(lines[l]) == true && sintaxFlag == true) {
sintaxFlag = false;
out += '</div>';
} else {
out += lines[l];
}
if (l != last) {
out += '<br>';
}
}
if (sintaxFlag == true) {
sintaxFlag = false;
out += lines[l];
}
entry[i].innerHTML = out;
}
}
}