// ==UserScript== // @name nishino_ameblo_br_b // @description try to take over the world! // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js // ==/UserScript== // ==UserScript== // @name nishino_ameblo_br_b // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://ameblo.jp/nishino-akihiro/entry* // @match https://gamp.ameblo.jp/nishino-akihiro/entry* // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js // ==/UserScript== //div[./lastbr]にクラス付加 var result5 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]//div[not(@class) or @id][./*[contains(@class,"div_br") or contains(@class,"div_and_n_br")][last()][not(./following-sibling::node()[string-length(normalize-space())>1])]]', document, null, 7, null); for (var x = 0; x < result5.snapshotLength; x++) { result5.snapshotItem(x).classList.add("child_br_last"); } //child_br_lastクラスの祖先ノードにクラス付加 var result6 = document.evaluate('//div[contains(@class,"child_br_last")]/ancestor::div[not(@class)]', document, null, 7, null); for (var y = 0; y < result6.snapshotLength; y++) { result6.snapshotItem(y).classList.add("div_child_br_last"); } //エントリ外のdiv_child_br_lastクラス削除 var result7 = document.evaluate('//div[@class="div_child_br_last"][.//div[@class="skin-entryBody" or @class="entry-text"]]', document, null, 7, null); for (var c = 0; c < result7.snapshotLength; c++) { result7.snapshotItem(c).classList.remove("div_child_br_last"); } //div_child_br_lastのツリー構造を破壊 $(function () { $("div.div_child_br_last").replaceWith(function () { return $(this).contents(); }); }); var result8 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]//div[./text()[string-length(normalize-space())>1][./following-sibling::* or ./preceding-sibling::*]]', document, null, 7, null); for (var j = 0; j < result8.snapshotLength; j++) { //result8.snapshotItem(j).insertAdjacentHTML("afterbegin","
"); result8.snapshotItem(j).insertAdjacentHTML("beforeend", ""); }