mofu_ameblo

    @@ -1,5 +1,4 @@ // ==UserScript== -// @title mofu_ameblo // @name mofu_ameblo // @namespace http://tampermonkey.net/ // @version 0.1 @@ -7,23 +6,36 @@ // @author You // @match https://ameblo.jp/mofu-everyday/entry* // @match https://ameblo.jp/mofu-everyday/theme* -// @grant none +// @grant GM_addStyle +// @grant GM_getResourceText // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js +// @require https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js +// @resource style https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css +// @resource style2 https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.css // ==/UserScript== -var result = document.evaluate('//div[@class="skin-entryBody"][.//a[@href="https://ameblo.jp/mofu-everyday/entry-12413675351.html" or @href="http://lo.ameba.jp/v1/VLJjwlwDDTuoDCbzJXre"]]//a/img', document, null, 7, null); -var tmp = []; -for (var i = 0; i < result.snapshotLength; i++) { - tmp[i] = result.snapshotItem(i).src; -} -if (i > 0) { - var result2 = document.evaluate('//div[@class="skin-entryBody"]//*', document, null, 7, null); - for (var j = 0; j < result2.snapshotLength; j++) { - result2.snapshotItem(j).remove(); +var style = GM_getResourceText('style'); +GM_addStyle(style); +var style2 = GM_getResourceText('style2'); +GM_addStyle(style2); +var result2 = document.evaluate('//div[./a[@href="https://html.co.jp/ha_chu"]]', document, null, 7, null); +result2.snapshotItem(0).insertAdjacentHTML('afterbegin', '<input type="button" value="画像のみ表示" id="gazou">'); +document.getElementById("gazou").addEventListener('click', sample, false); + +function sample() { + var result = document.evaluate('//div[@class="skin-entryBody"][.//a[@href="https://ameblo.jp/mofu-everyday/entry-12413675351.html" or @href="http://lo.ameba.jp/v1/VLJjwlwDDTuoDCbzJXre"]]//a/img', document, null, 7, null); + var tmp = []; + for (var i = 0; i < result.snapshotLength; i++) { + result.snapshotItem(i).src = result.snapshotItem(i).src.replace("?caw=800", "?caw=600"); + tmp[i] = result.snapshotItem(i).src; } - var result3 = document.evaluate('//div[@class="skin-entryBody"]', document, null, 7, null); - result3.snapshotItem(0).classList.add("mofu_div") - for (i = 0; i < tmp.length; i++) { - result3.snapshotItem(0).insertAdjacentHTML('beforeend', '<img src=' + tmp[i] + '>'); + if (i > 0) { + document.body.innerHTML = '<div id="slick-box">'; + for (i = 0; i < tmp.length; i++) { + document.getElementById("slick-box").insertAdjacentHTML('beforeend', '<figure><img src=' + tmp[i] + ' title=' + (i + 1) + '/' + tmp.length + '></figure>'); + } + $(function () { + $('#slick-box').slick(); + }); } } $(function () {
  • // ==UserScript==
    // @name         mofu_ameblo
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  try to take over the world!
    // @author       You
    // @match        https://ameblo.jp/mofu-everyday/entry*
    // @match        https://ameblo.jp/mofu-everyday/theme*
    // @grant        GM_addStyle
    // @grant        GM_getResourceText
    // @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
    // @require      https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js
    // @resource style https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css
    // @resource style2 https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.css
    // ==/UserScript==
    var style = GM_getResourceText('style');
    GM_addStyle(style);
    var style2 = GM_getResourceText('style2');
    GM_addStyle(style2);
    var result2 = document.evaluate('//div[./a[@href="https://html.co.jp/ha_chu"]]', document, null, 7, null);
    result2.snapshotItem(0).insertAdjacentHTML('afterbegin', '<input type="button" value="画像のみ表示" id="gazou">');
    document.getElementById("gazou").addEventListener('click', sample, false);
    
    function sample() {
      var result = document.evaluate('//div[@class="skin-entryBody"][.//a[@href="https://ameblo.jp/mofu-everyday/entry-12413675351.html" or @href="http://lo.ameba.jp/v1/VLJjwlwDDTuoDCbzJXre"]]//a/img', document, null, 7, null);
      var tmp = [];
      for (var i = 0; i < result.snapshotLength; i++) {
        result.snapshotItem(i).src = result.snapshotItem(i).src.replace("?caw=800", "?caw=600");
        tmp[i] = result.snapshotItem(i).src;
      }
      if (i > 0) {
        document.body.innerHTML = '<div id="slick-box">';
        for (i = 0; i < tmp.length; i++) {
          document.getElementById("slick-box").insertAdjacentHTML('beforeend', '<figure><img src=' + tmp[i] + ' title=' + (i + 1) + '/' + tmp.length + '></figure>');
        }
        $(function () {
          $('#slick-box').slick();
        });
      }
    }
    $(function () {
      $('.skin-borderQuiet img').hover(function () {
        $(this).attr('src', $(this).attr('src').replace('?cpd=100', '?cpd=200'));
      }, function () {
        if (!$(this).hasClass('currentPage')) {
          $(this).attr('src', $(this).attr('src').replace('?cpd=200', '?cpd=100'));
        }
      });
    });
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/12/10 22:06:35 - 2018-12-10
  2. 2018/12/10 21:52:15 - 2018-12-10
  3. 2018/12/10 12:12:31 - 2018-12-10
  4. 2018/12/09 14:10:30 - 2018-12-09
  5. 2018/12/09 13:01:28 - 2018-12-09
  6. 2018/12/07 19:25:56 - 2018-12-07
  7. 2018/11/28 22:29:18 - 2018-11-28
  8. 2018/11/28 20:41:24 - 2018-11-28