Tumblr Archive Reblog Remover

Make browsing Tumblr archives easier.

当前为 2016-12-04 提交的版本,查看 最新版本

// ==UserScript==
// @name        Tumblr Archive Reblog Remover
// @author      Arnold François Lecherche
// @namespace   gf.qytechs.cn
// @icon        https://www.tumblr.com/favicon.ico
// @version     0.1.1
// @description Make browsing Tumblr archives easier.
// @include     http://*.tumblr.com/archive/*
// @include     https://*.tumblr.com/archive/*
// @include     http://*.tumblr.com/archive
// @include     https://*.tumblr.com/archive
// @exclude     http://www.tumblr.com/*
// @exclude     https://www.tumblr.com/*
// @grant       none
// @run-at      document-start
// @copyright 2016 Arnold François Lecherche
// ==/UserScript==
/* jshint -W097 */
;(function setup(D, E, undefined) {
  'use strict';
  var remove = function (node) {
    if (typeof E.prototype.remove === 'function') remove = function remove(node) {return node.remove();};
    else remove = function remove(node) {return node.parentNode.removeChild(node);};
    return remove(node);
  }, observerConfig = {
    attributes: false,
    characterData: false,
    childList: true,
    subtree: true
  }, observer = new MutationObserver(removeReblogs), d = {value: true}, archive, r;
  function clearChildren(node) {
    var nod;
    node.style.display = 'none!important';
    while ((nod = node.firstChild)) remove(nod);
  }
  function removeReblogs(mutations) {
    observer.stop();
    var i = mutations.length, nodes, node, j, nc;
    while (i--) {
      nodes = mutations[i].addedNodes;
      j = nodes.length;
      while (j--) {
        node = nodes[j];
        nc = node.className;
        if (nc.indexOf('not_mine') > -1 && nc.indexOf('is_reblog') > -1) clearChildren(node);
      }
    }
    observer.start();
  }
  function init() {
    D.removeEventListener('DOMContentLoaded', init, false);
    archive = D.querySelector('.l-content');
    observer.start();
  }
  observer.start = function () {
    observer.start = observer.observe.bind(observer, archive, observerConfig);
    observer.start();
  };
  observer.stop = observer.disconnect.bind(observer);
  r = D.readyState;
  if (r === 'complete' || r === 'loaded' || r === 'interactive') init();
  else D.addEventListener('DOMContentLoaded', init, false);
})(document, Element);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址