// ==UserScript==
// @title nishino_ameblo_add
// @name nishino_ameblo_add
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://ameblo.jp/nishino-akihiro*
// @grant none
// ==/UserScript==
$('.div_br+.div_br+.div_br').addClass("triple");
$('.node_last~.triple').removeClass("triple");
$('.triple').remove();
$('.skin-entryBody iframe').addClass("i_pic");
$('.skin-entryBody a>img,.skin-entryBody>div>table').parent().addClass("i_pic");
$('.skin-entryBody table .i_pic').removeClass("i_pic");
$('.skin-entryBody *>.i_pic').parent().addClass("i_pic");
$('.skin-entryBody .i_pic>.i_pic').parent().contents().unwrap();
$(".skin-entryBody").contents().filter(function () {
return this.nodeType === 3;
}).wrap("<span class='n_text'></span>");
$('.skin-entryBody>br').remove();
$('.skin-entryBody>.i_pic+.div_br').addClass("i_pad");
$('.skin-entryBody>.i_pic').prev().addClass("i_pad");
$('.i_pad:not(.div_br)').removeClass("i_pad");
$('.i_pic+.i_pad+.i_pic').prev().removeClass("i_pad");
$('.i_pad+.div_br').addClass("kabuse");
$('.div_br+.i_pad').prev().addClass("furi");
$('a.i_pic+.i_pad+.kabuse').addClass("kabuse_a");
$("#entryBody>*>span").contents().unwrap();
$('.skin-entryBody>span,.skin-entryBody>a:not(.i_pic)').nextUntil('div,p,.i_pic').addBack().wrapAll("<span class='i_ren'></span>");
$("iframe.i_pic").wrap("<div class='iframe-wrap'></div>");
var result7 = document.evaluate('//a[contains(@class,"i_pic")]/preceding-sibling::*[not(contains(@class,"div_br") or contains(@class,"i_pic"))][1][not(self::div or self::p)]', document, null, 7, null);
for (var b = 0; b < result7.snapshotLength; b++) {
result7.snapshotItem(b).classList.add("kaigyo");
}
for (var j = 0; j < $("#entryBody>*:not(.div_br)").length; j++) {
if ($("#subA").width() / $("#subA").parent().outerWidth(true) < 0.357) {
if ($("#entryBody>*:not(.div_br)").eq(j).text().length < 72) {
$("#entryBody>*:not(.div_br)").eq(j).addClass("e");
}
} else {
if ($("#entryBody>*:not(.div_br)").eq(j).text().length < 62) {
$("#entryBody>*:not(.div_br)").eq(j).addClass("e");
}
}
}
$('.i_pic.e,.iframe-wrap.e').removeClass("e");
$(".skin-entryBody *:contains('━')").html(function (_, html) {
return html.replace(/(━+)/g, '<span class="line">$1</span>');
});
$(".skin-entryBody *:contains('▼')").html(function (_, html) {
return html.replace(/(▼)/g, '<span class="mark">$1</span>');
});
$(".skin-entryBody *:contains('|')").html(function (_, html) {
return html.replace(/(\|)/g, '<span class="mark">|</span>');
});
var result4 = document.evaluate('id("entryBody")//*[self::div or self::p][contains(text(),"━") or contains(text(),"==")]|id("entryBody")//*[self::div or self::p][./span[contains(text(),"━") or contains(text(),"==")]]', document, null, 7, null);
for (var a = 0; a < result4.snapshotLength; a++) {
result4.snapshotItem(a).classList.add("l_yoko");
}
var result8 = document.evaluate('id("entryBody")/*[self::div or self::p][./span[normalize-space(./text())="|" or ./text()="▼"]]', document, null, 7, null);
for (var e = 0; e < result8.snapshotLength; e++) {
result8.snapshotItem(e).classList.add("l_tate");
}
$('.l_yoko,.l_tate').prev().prev().addClass("sun");
$('.sun+*:not(.div_br)').prev().removeClass("sun");
$('.l_yoko.l_tate').removeClass("l_tate");
$('.div_br+.e+.div_br:not(.sun)').prev().addClass("solo");
$('.l_tate.solo,.l_yoko.solo,.node_last.solo').removeClass("solo");
$('.solo+.div_br+.div_br').remove();
$('.solo+.div_br').remove();
$('.solo+.solo+.solo').addClass("solo_ren");
$('a.i_pic').on('focus', function() {
$(this).css('display', 'none');
$(this).after('<div class="revert"><a href="javascript:void(0)">この画像を元に戻す</a></div>');
});
$(document).on('click', '.revert>a', function(){
$(this).parent().prev().css('display', 'inline-block');
$(this).parent().remove();
});
var reg = /[\u3040-\u30ff]/;
var tmp3 = [];
for (var k = 0; k < $("#entryBody a").length; k++) {
var tmp2 = $("#entryBody a").eq(k).attr("href");
if (reg.test(tmp2)) {
$("#entryBody a").eq(k).addClass("akan");
}
tmp3[k] = $("#entryBody a").eq(k).attr("href");
}
var sameArr = tmp3.filter(function (p, q, self) {
return self.indexOf(p) === q && q !== self.lastIndexOf(p);
});
for (var m = 0; m < $("#entryBody a").length; m++) {
for (var n = 0; n < sameArr.length; n++) {
if ($("#entryBody a").eq(m).attr("href") == sameArr[n]) {
$("#entryBody a").eq(m).addClass("dup");
}
}
}
$('table .dup').removeClass("dup");
if (sameArr.length - $('.i_pic>table').length == 1) {
$('.dup').eq(0).removeClass("dup");
}