// ==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();
var reg = /[\u3040-\u30ff]/;
var reg2 = /[a-zA-Z0-9]/;
var tmp3 = [];
for (var k = 0; k < $("#entryBody a").length; k++) {
var tmp2 = $("#entryBody a:not(.i_pic)").eq(k).attr("href");
if (reg.test(tmp2)) {
$("#entryBody a:not(.i_pic)").eq(k).addClass("akan");
} else if (reg2.test($("#entryBody a:not(.i_pic)").eq(k).text())) {
$("#entryBody a:not(.i_pic)").eq(k).parent().addClass("zen");
}
tmp3[k] = $("#entryBody a:not(.i_pic)").eq(k).attr("href");
}
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 < 70) {
$("#entryBody>*:not(.div_br)").eq(j).addClass("e");
} else if ($("#entryBody>*:not(.div_br)").eq(j).text().length < 75) {
$("#entryBody>*:not(.div_br)").eq(j).filter('.zen').addClass("e");
};
} else {
if ($("#entryBody>*:not(.div_br)").eq(j).text().length < 60) {
$("#entryBody>*:not(.div_br)").eq(j).addClass("e");
}
}
}
$('.i_pic.e,iframe.e,.waku.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(/(={2,})/g, '<span class="line">$1</span>');
});
$(".skin-entryBody *:contains('=')").html(function (_, html) {
return html.replace(/(={2,})/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][.//span[@class="line"]]', 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[@class="mark"]]', document, null, 7, null);
for (var e = 0; e < result8.snapshotLength; e++) {
result8.snapshotItem(e).classList.add("l_tate");
}
$('.l_yoko,.l_tate').prev().filter('.div_br').prev().addClass("sun");
$('.l_yoko.l_tate').removeClass("l_tate");
$('.div_br+.e:not(.sun)+.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");
$('.solo_ren+.waku').prev().removeClass("solo_ren");
$('.solo_ren').not('.solo_ren+.solo_ren').each(function () {
$(this).nextUntil(':not(.solo_ren)').andSelf().wrapAll('<div class="solo_wrap"></div>');
});
$('.zen:not(.solo)').removeClass("zen");
$('a.i_pic').on('focus', function () {
$(this).css('display', 'none');
$(this).after('<span class="revert"><a href="javascript:void(0)">この画像を元に戻す</a> <a href="javascript:void(0)">画像の右半分を表示</a></div>');
});
$(document).on('click', '.revert>a:first-child', function () {
$(this).parent().prev().css('display', 'inline-block');
$(this).parent().prev().css('width', $(this).parent().prev().children('img').attr("width"));
$(this).parent().prev().children('img').css('object-fit', 'fill');
$(this).parent().prev().children('img').css('object-position', '50% 50%');
$(this).parent().remove();
});
$(document).on('click', '.revert>a:nth-child(2)', function () {
$(this).parent().prev().css('display', 'inline-block');
$(this).parent().prev().css('width', $(this).parent().prev().children('img').attr("width") / 2);
$(this).parent().prev().children('img').css('height', $(this).parent().prev().children('img').attr("height"));
$(this).parent().prev().children('img').css('object-fit', 'cover');
$(this).parent().prev().children('img').css('object-position', '100% 0%');
$(this).parent().remove();
});
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(function (index) {
return "dup" + n;
});
}
}
}
var c = 0;
while (sameArr.length > 0) {
$('.dup' + c).eq(0).removeClass("dup" + c);
c++;
sameArr.shift();
}
$('.i_pic>table a').removeClass();
var result5 = document.evaluate('id("entryBody")//a[contains(@class,"dup")][not(starts-with(@href,"https://ameblo.jp/nishino-akihiro/"))]', document, null, 7, null);
for (var f = 0; f < result5.snapshotLength; f++) {
result5.snapshotItem(f).classList.add("dup");
}
var result6 = document.evaluate('id("entryBody")//a[string-length(@href)<18 or contains(@href,"/alu") or contains(@href,"/obara")]', document, null, 7, null);
for (var g = 0; g < result6.snapshotLength; g++) {
result6.snapshotItem(g).classList.add("tomeo");
}
function size_origin() {
$('.div_iframe').toggleClass("iframe-wrap");
}
$('#blogSearchInputHeader')[0].addEventListener('focus', size_origin, false);
$('.skin-blogBody')[0].addEventListener('dblclick', size_origin, false);