1300

移行用のテストです

西野ブログ対策改訂版

// ==UserScript==
// @name         nishino_ameblo_kdiv
// @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
// ==/UserScript==
while (document.getElementById("test2") == null) {
  var result = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]//*[not(./*)][not(self::br) and  not(self::img) and  not(self::iframe)]', 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)]/text()', document, null, 7, null);
  for (var i = 0; i < result5.snapshotLength; i++) {
    //ゼロ幅スペース削除
    result5.snapshotItem(i).nodeValue = result5.snapshotItem(i).nodeValue.replace(/\u200B/g, "");
    //連続スペースを全角スペースに
    result5.snapshotItem(i).nodeValue = result5.snapshotItem(i).nodeValue.replace(/\s\s+/g, ' ');
    //全角スペース判定で改行とみなす
    if (/ /g.test(result5.snapshotItem(i).nodeValue)) {
      result.snapshotItem(i).classList.add("div_br");
    }
    //半角スペース判定でスペース削除
    else if (/ /g.test(result5.snapshotItem(i).nodeValue)) {
      result5.snapshotItem(i).nodeValue = result5.snapshotItem(i).nodeValue.replace(/\s/g, '');
    }
    result.snapshotItem(i).dataset.content = result5.snapshotItem(i).nodeValue;
    /*if(result.snapshotItem(i).dataset.content=="")
    {
        result.snapshotItem(i).remove();
    }*/
  }
  var result2 = document.evaluate('descendant::div[@data-content][1]', document, null, 7, null);
  result2.snapshotItem(0).id = "test2";
}
//改行クラスを持たずにスペースのあるタグ削除
var result4 = document.evaluate('//*[not(@class="div_br")][@data-content]', document, null, 7, null)
for (var k = 0; k < result4.snapshotLength; k++) {
  if (/\s/g.test(result4.snapshotItem(k).firstChild.nodeValue)) {
    result4.snapshotItem(k).remove();
  }
}
//テキスト中のスぺースの場合改行クラス削除
var result3 = document.evaluate('//*[@class="div_br"][string-length(@data-content)>1]', document, null, 7, null)
for (var j = 0; j < result3.snapshotLength; j++) {
  result3.snapshotItem(j).classList.remove("div_br");
}
// ==UserScript==
// @name         nishino_ameblo_br
// @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==
while (document.getElementById("test1") == null) {
  var result = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]//*[self::div or self::p][not(.//text() or .//img or .//iframe)]', document, null, 7, null);
  for (var i = 0; i < result.snapshotLength; i++) {
    result.snapshotItem(i).classList.add("div_br");
  }
  var result3 = document.evaluate('descendant::div[@class="div_br"][last()]', document, null, 7, null);
  result3.snapshotItem(0).id = "test1";
}
//消しきれない空div削除
var result2 = document.evaluate('//div[@class="div_br"][not(.//br)]', document, null, 7, null);
for (var z = 0; z < result2.snapshotLength; z++) {
  result2.snapshotItem(z).remove();
}
//生br処理
var listArray = document.querySelectorAll('div+br');
for (var a = 0; a < listArray.length; a++) {
  listArray[a].classList.add("div_and_n_br");
}
//lastdiv処理
var result4 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]/descendant::div[not(@class)][last()][./following-sibling::div[@class="div_br"] and ./preceding-sibling::div[@class="div_br"]]|descendant::div[@class="div_br"][last()]/preceding-sibling::div[not(@class)][1]', document, null, 7, null);
for (var k = 0; k < result4.snapshotLength; k++) {
  result4.snapshotItem(k).classList.add("div_last");
}
//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::*)]]', document, null, 7, null);
for (var x = 0; x < result5.snapshotLength; x++) {
  result5.snapshotItem(x).classList.add("child_br_last");
}
var result6 = document.evaluate('//div[contains(@class,"child_br_last")][not(./following-sibling::*)]/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クラスのdivのみ削除(子は維持)
$(function () {
  $("div.div_child_br_last").replaceWith(function () {
    return $(this).contents();
  });
});
//直下テキスト処理
var result8 = document.evaluate('//div[@class="skin-entryBody" or @class="entry-text"]/div[@class="div_br" or @class="child_br_last"][./following-sibling::text()][last()]',document, null, 7, null);
for(var j=0;j<result8.snapshotLength;j++)
   {
       result8.snapshotItem(j).insertAdjacentHTML("afterend","<div></div>")
   }
.div_br+.div_br{display:none;}
.div_br+*[data-content=" "] {display:none;}
*[data-content=" "]+.div_br{display:none;}
*[data-content=" "]+*[data-content=" "]{display:none;}
.div_br+.div_and_n_br{display:none;}

.div_br+:not(.div_br) .div_br:first-child{display:none;}
*[data-content=" "]+:not(.div_br)>.div_br:first-child{display:none;}
.div_br+:not(.div_br)>br:first-child{display:none;}
.child_br_last+.div_br{display:none;}
.child_br_last+:not(.div_br)>.div_br:first-child{display:none;}
.div_child_br_last+.div_br{display:none;}

.div_last>.div_br:last-child{display:none;}
.div_last+.div_br{display:none;}
/*.skin-entryBody *{font-size:medium !important;}
.hashtag-module__item {line-height:1;}
*/
.skin-entryBody *{margin:0 !important;padding:0;}
.div_br font{font-size:medium;}
font[size="7"]{line-height:1;}

.LazyLoad{display:none;}
.js-blogGenreRank{display:none;}
.skin-entryBody{margin:0;padding:0;}
.skin-entryHead{margin:0;padding:0;}
.hashtag-module-borderTop{margin:0;padding:0;}
.skin-entryThemes{margin:0;padding:0;}
#conversation-footer{height:auto !important;}

/*for gamp*/
article.entry{margin:0;padding:0;}
.i-amphtml-layout-container, .i-amphtml-layout-fixed-height, [layout="container"], [layout="fixed-height"][height]{height:35px !important;}
.entry amp-img[src*="/user_images/"][layout="responsive"]{margin:0;}
/*for novel*/
.skin-entryBody div:empty{display:none;}
/*font:last-child>br:only-child{display:none;}*/
.child_br_last>p.div_br:last-child{display:none;}
p+div{display:none;}
/*p+div .child_br_last .div_br:last-child{display:none;}*/
/*for img*/
[data-uranus-layout="columnB"] [data-uranus-layout="mainInner"]{padding-right:0;}
img[width="1080"][height="589"]{

    height: 200px !important;
    object-fit: none;
    object-position: 50% 80%;

}
img[width="720"][height="422"]{height:200px;object-fit:cover;}