// ==UserScript==
// @title nishino_ameblo_only
// @name nishino_ameblo_only
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://ameblo.jp/nishino-akihiro*
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
// ==/UserScript==
var listArray = document.querySelectorAll('.skin-entryBody *[style]');
for (var i = 0; i < listArray.length; i++) {
listArray[i].removeAttribute("style");
}
var listArray2 = document.querySelectorAll('.skin-entryBody font[color],.skin-entryBody font[face]');
for (var j = 0; j < listArray2.length; j++) {
listArray2[j].removeAttribute("color");
listArray2[j].removeAttribute("face");
}
var result5 = document.evaluate('id("entryBody")//text()', document, null, 7, null);
for (var b = 0; b < result5.snapshotLength; b++) {
if (/^(\s| )+$/g.test(result5.snapshotItem(b).nodeValue)) {
if (/ |\u00A0/g.test(result5.snapshotItem(b).nodeValue)) {
result5.snapshotItem(b).nodeValue = " ";
} else {
result5.snapshotItem(b).nodeValue = result5.snapshotItem(b).nodeValue.replace(/^\s+/g, "");
}
}
}
$('.skin-entryBody a:not([href])').contents().unwrap();
$('.skin-entryBody a.ogpCard_link,.skin-entryBody article.ogpCard_wrap').remove();
$('.skin-entryBody section,.skin-entryBody article,.skin-entryBody blockquote,.skin-entryBody h1,.skin-entryBody h2,.skin-entryBody h3,.skin-entryBody h4,.skin-entryBody h5,.skin-entryBody h6').wrap("<div></div>");
$('.skin-entryBody section,.skin-entryBody article,.skin-entryBody blockquote,.skin-entryBody h1,.skin-entryBody h2,.skin-entryBody h3,.skin-entryBody h4,.skin-entryBody h5,.skin-entryBody h6').contents().unwrap();
$('.skin-entryBody b,.skin-entryBody i,.skin-entryBody font,.skin-entryBody u').addClass("fbi");
$('.fbi,.skin-entryBody span').contents().unwrap();
var result = document.evaluate('id("entryBody")//*[self::div or self::p]/br[not(./preceding-sibling::*) or string-length(./preceding-sibling::text()>0)]', document, null, 7, null);
for (var x = 0; x < result.snapshotLength; x++) {
result.snapshotItem(x).classList.add("br_first");
}
$(".br_first").wrap("<div class='div_br'></div>");
$('.skin-entryBody div>div,.skin-entryBody p>div,.skin-entryBody div>p').parent().contents().unwrap();
$(".skin-entryBody").contents().filter(function () {
return this.nodeType === 3;
}).wrap("<span class='n_text'></span>");
$('.skin-entryBody span:empty,.skin-entryBody a:empty').remove();
$('.skin-entryBody div:empty,.skin-entryBody p:empty').remove();
for (var k = 0; k < $("#entryBody *:contains(' ')").length; k++) {
if ($("#entryBody *:contains(' ')").eq(k).text().length < 2) {
$("#entryBody *:contains(' ')").eq(k).addClass("div_br");
}
}
$('span.div_br,a.div_br').remove();
$('.skin-entryBody span:has(span),.skin-entryBody span:has(a),.skin-entryBody span:has(br)').contents().unwrap();
$('.skin-entryBody>span,.skin-entryBody>a:not(:has(img)),.skin-entryBody>br').addClass("in_ele");
$('.in_ele').not('.in_ele+.in_ele').each(function () {
$(this).nextUntil(':not(.in_ele)').andSelf().wrapAll('<span class="i_ren"></span>');
});
$('.i_ren>br+br').remove();
$('.i_ren:has(br.in_ele:only-child)').wrap("<div class='div_br'></div>");
$('.in_ele').removeClass("in_ele");
$('.skin-entryBody>p:not(.div_br):has(br),.skin-entryBody>div:not(.div_br):has(br)').addClass("sand");
$(".sand").contents().filter(function () {
return this.nodeType === 3;
}).wrap("<span class='sand_text'></span>");
for (var l = 0; l < $(".sand_text:contains(' ')").length; l++) {
if ($(".sand_text:contains(' ')").eq(l).text().length < 2) {
$(".sand_text:contains(' ')").eq(l).addClass("tmp");
}
}
$('.tmp').remove();
$('.i_ren .div_br,.i_ren>a>br').remove();
$('.i_ren a:empty').remove();
$('.i_ren:empty,.sand_text:empty,.div_br:empty').remove();
$('.sand:not(:has(*:nth-child(3)))').removeClass("sand");
$('.i_ren>span:first-of-type,.sand>span:first-of-type').addClass("sand_span_first");
$('.i_ren>span:last-of-type,.sand>span:last-of-type').addClass("sand_span_last");
$('.i_ren>a,.sand>a').addClass("sand_a");
$('.sand_a~.sand_span_first').removeClass("sand_span_first");
$('.i_ren:has(.sand_span_last~.sand_a),.sand:has(.sand_span_last~.sand_a)').addClass("sand_last_a");
$('.sand_last_a>.sand_span_last').removeClass("sand_span_last");
$('.sand_span_first').prevAll('br').remove();
$('.div_br').not('.div_br+.div_br').each(function () {
$(this).nextUntil(':not(.div_br)').andSelf().wrapAll('<div class="div_ren"></div>');
});
$('.skin-entryBody>*:not(.sand):has(a:has(img)),.skin-entryBody>*:not(.sand):has(iframe),.skin-entryBody>*:not(.sand):has(table)').contents().unwrap();
$('.skin-entryBody>*:has(img),.skin-entryBody>iframe,.skin-entryBody>table').addClass("i_pic");
$('a.i_pic:has(img:nth-child(2)),a.i_pic:has(img[alt="リンク"])').addClass("card");
$('a.i_pic').each(function () {
$(this).attr('width', $(this).children('img').attr('width'));
});
$('a.i_pic[width="104"]>img').remove();
$('a.i_pic[width="104"]').addClass("card");
var result2 = document.evaluate('//a[contains(@class,"card")]/text()[1]/following-sibling::node()', document, null, 7, null);
for (var y = 0; y < result2.snapshotLength; y++) {
result2.snapshotItem(y).remove();
}
$('.i_pic').prev().filter('.div_ren').addClass("waku");
$('.i_pic').next().filter('.div_ren').addClass("waku");
$(".i_pic:not(.card)+.waku+.i_pic:not(.card)").prev().addClass("frame_pad");
$("iframe.i_pic").wrap("<div class='div_iframe'></div>");
$('.i_pic+.i_ren,.i_pic+.card').prev().addClass("rail");
$('.i_pic+.waku+.i_ren,.i_pic+.waku+.card').prev().prev().addClass("rail");
$('.i_pic+.i_pic,.div_iframe+.i_pic,.card+.i_pic,.card+.waku+.i_pic,.i_ren+.i_pic,.i_ren+.waku+.i_pic').addClass("rail");
$('.skin-entryBody>*:has(a)').each(function () {
if ($(this).text().length - $(this).children('a').text().length < 3) {
$(this).addClass("solo_a");
}
});
$('.div_ren:not(.waku)').contents().unwrap();
$('.div_ren').removeClass("div_ren");
$(".skin-entryBody>*:not(.div_br):not(.waku)").last().addClass("node_last");
$(".skin-entryBody>*:not(.div_br):not(.waku)").first().addClass("node_first");
$('.node_first').prevAll().addClass("cork");
if ($(".node_last").text().length == 1) {
$('.node_last').remove();
$(".skin-entryBody>*:not(.div_br):not(.waku)").last().addClass("node_last");
}
$('.node_last+.waku').contents().unwrap();
$('.skin-entryBody figure div').contents().unwrap();
$('.skin-entryBody figure>a:first-child').text("オンラインサロン | 西野亮廣エンタメ研究所");
$('a.i_pic[href="http://twitter.com/nishinoakihiro"]').removeClass("i_pic");