Greasy Fork

千图网隐藏企业专享

避免不需要使用企业素材的用户看到不需要的资源

目前为 2022-05-30 提交的版本。查看 最新版本

// ==UserScript==
// @name         千图网隐藏企业专享
// @namespace    https://www.52pojie.cn/home.php?mod=space&uid=508077
// @version      1.1
// @description  避免不需要使用企业素材的用户看到不需要的资源
// @author       未知的动力
// @match        *://www.58pic.com/*
// @run-at      document-end
// @grant       GM_addStyle
// @license     GPL
// ==/UserScript==

class MonitorDOM {
  constructor(t, o, n = null, e = "childList") {
    (this.ele = t),
      (this.callback = o),
      (this.config = null == n ? { attributes: !0, childList: !0, subtree: !0 } : n),
      (this.monitorType = e);
  }
  startMonitor() {
    let t = this;
    let o = new MutationObserver(function (o, n) {
      for (let n of o) n.type == t.monitorType && t.callback();
    });
    o.observe(t.ele, t.config), (t._monitorHandle = o);
  }
  stopMonitor() {
    this._monitorHandle.disconnect();
  }
}
!(function () {
  const t = new MonitorDOM(document.body, function () {
    const o = document.querySelectorAll("#qt-app .card-grid-box .qt-card-box");
    if (null != o) {
      t.stopMonitor();
      for (let t = 0; t < o.length; t++) {
        -1 != o[t].querySelector("a > div.card-img-box > div.right-top-icon > span")?.textContent.indexOf("企业专享") &&
          (o[t].style.display = "none");
      }
    }
  });
  t.startMonitor();
})();