// ==UserScript== // @title nishino_lineblog // @name nishino_lineblog // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://lineblog.me/nishino/* // @grant none // ==/UserScript== var result5 = document.evaluate('//div[@class="article-body"]//text()', document, null, 7, null); for (var b = 0; b < result5.snapshotLength; b++) { if (/^\s+$/g.test(result5.snapshotItem(b).nodeValue)) { if (/ /g.test(result5.snapshotItem(b).nodeValue)) { result5.snapshotItem(b).nodeValue = " "; } else { result5.snapshotItem(b).nodeValue = result5.snapshotItem(b).nodeValue.replace(/^\s+/g, ""); } } } var result6 = document.evaluate('//div[@class="article-body"]//div[./text()=" "][not(./*)]', document, null, 7, null); for (var c = 0; c < result6.snapshotLength; c++) { result6.snapshotItem(c).classList.add("div_br"); } $('.article-body span>br').parent().contents().unwrap(); var result = document.evaluate('//div[@class="article-body"]//*[self::div or self::p]/br[not(./preceding-sibling::node())]', document, null, 7, null); for (var x = 0; x < result.snapshotLength; x++) { result.snapshotItem(x).classList.add("br_first"); } $(".article-body div+br,.br_first").wrap("
"); $('.article-body div>div').parent().contents().unwrap(); $('#ad2').remove(); var result2 = document.evaluate('//div[@class="article-body"]/*[not(@class="div_br")][last()]', document, null, 7, null); result2.snapshotItem(0).classList.add("node_last");