// ==UserScript== // @title nishino_ameblo_easy // @name nishino_ameblo_easy // @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 result = document.evaluate('//div[@class="skin-entryBody"]//br/ancestor::*[./ancestor::div[@class="skin-entryBody"] and not(self::a)]', document, null, 7, null); for (var i = 0; i < result.snapshotLength; i++) { result.snapshotItem(i).classList.add("anc"); } var result2 = document.evaluate('//div[@class="skin-entryBody"]//*[./text()]/ancestor::*[./ancestor::div[@class="skin-entryBody"] and not(self::a)]', document, null, 7, null); for (var j = 0; j < result2.snapshotLength; j++) { result2.snapshotItem(j).classList.add("anc"); } $('.anc').replaceWith(function () { return $(this).contents(); }); //空div処理 var result4 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]//*[not(./*)][not(self::br) and not(self::img) and not(self::iframe) and not(self::amp-img)]/text()', document, null, 7, null); var result5 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]//*[not(./*)][not(self::br) and not(self::img) and not(self::iframe) and not(self::amp-img)][./text()]', document, null, 7, null); for (var x = 0; x < result4.snapshotLength; x++) { if (/\s/g.test(result4.snapshotItem(x).nodeValue)) { result5.snapshotItem(x).remove(); } } var result6 = document.evaluate('//div[@class="skin-entryBody"]//*[not(./node())][not(self::br) and not(self::img) and not(self::iframe) and not(self::amp-img)]|//div[@class="skin-entryBody"]//*[not(./node())][not(self::br) and not(self::img) and not(self::iframe) and not(self::amp-img)]/ancestor::*[./ancestor::div[@class="skin-entryBody"] and not(self::a)]', document, null, 7, null); for (var y = 0; y < result6.snapshotLength; y++) { result6.snapshotItem(y).remove(); } //lastbr処理 $(".skin-entryBody>br").wrap("
"); var result3 = document.evaluate('//div[@class="skin-entryBody"]/div[not(@class="div_br")][last()]', document, null, 7, null); for (var k = 0; k < result3.snapshotLength; k++) { result3.snapshotItem(k).classList.add("div_last"); } //first_text処理 var result10 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]/descendant::*[self::div or self::td][1]', document, null, 7, null); result10.snapshotItem(0).classList.add("div_second"); result10.snapshotItem(0).insertAdjacentHTML("afterbegin", " "); var tmp = []; var e_text = $(".skin-entryBody").text(); tmp = e_text.split(" "); var n_text = tmp[0]; var result12 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]', document, null, 7, null); result12.snapshotItem(0).insertAdjacentHTML("afterbegin", "