nishino_ameblo_br_a

    
      
  • // ==UserScript==
    // @title         nishino_ameblo_br_a
    // @name         nishino_ameblo_br_a
    // @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==
    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");
    }
    //消しきれない空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();
    }*/
    //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");
    }
    var result3 = document.evaluate('//div[@class="div_last"][./following-sibling::div[not(@class)]]', document, null, 7, null);
    for (var j = 0; j < result3.snapshotLength; j++) {
      result3.snapshotItem(j).classList.remove("div_last");
    }
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/11/05 20:48:41 - 2018-11-05