Greasy Fork

来自缓存

Greasy Fork is available in English.

Keylol_手机版优化

移除一些元素

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name:zh-CN      Keylol_手机版优化
// @name            Keylol_Mobile_Tweaker
// @namespace       https://blog.chrxw.com
// @supportURL      https://blog.chrxw.com/scripts.html
// @contributionURL https://afdian.com/@chr233
// @version         1.0
// @description     移除一些元素
// @description:zh-CN  移除一些元素
// @author          Chr_
// @match           https://keylol.com/*
// @license         AGPL-3.0
// @icon            https://blog.chrxw.com/favicon.ico
// ==/UserScript==


(() => {
  "use strict";

  const isPc = !!document.querySelector('a[href="forum.php?mobile=yes"]')

  if (!isPc) {
    const replay = document.getElementById('fastpostform');
    if (replay) {
      replay.style.display = "none";
    }
  }

  tweakerBtns();

  const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
      if (mutation.addedNodes.length > 0) {
        tweakerBtns();
      }
    });
  });

  observer.observe(document.body, { childList: true, subtree: true });

  function tweakerBtns() {
    const rateBtns = document.querySelectorAll('div[id^="dppf"]>a');
    if (rateBtns.length > 0) {
      for (let btn of rateBtns) {
        const span = document.createElement('span');
        span.innerHTML = btn.innerHTML;
        span.style.margin = "0 3px";
        btn.parentNode.replaceChild(span, btn);
      }
    }

    const ratePcBtns = document.querySelectorAll('div.pob.cl>em>a');
    if (ratePcBtns.length > 0) {
      for (let btn of ratePcBtns) {
        const span = document.createElement('span');
        span.innerHTML = btn.innerHTML;
        span.className = btn.className;
        span.style.padding = "5px 10px 5px 25px";
        btn.parentNode.replaceChild(span, btn);
      }
    }
  }
})();