メール欄があるレスだけ表示

メール欄があるレスだけ表示するボタンを追加します

当前为 2018-09-08 提交的版本,查看 最新版本

// ==UserScript==
// @name     メール欄があるレスだけ表示
// @version  1
// @grant    none
// @include  https://*.2chan.net/*/res/*
// @description:ja メール欄があるレスだけ表示するボタンを追加します
// @namespace https://gf.qytechs.cn/users/114367
// @description メール欄があるレスだけ表示するボタンを追加します
// ==/UserScript==
(() => {
  document.styleSheets[0].insertRule('.has-mail-filter > .has-mail { display: table; }', 0);
  document.styleSheets[0].insertRule('.has-mail-filter > table { display: none; }', 0);
  document.styleSheets[0].insertRule('.mail-filter-btn { cursor: pointer; }', 0);
  document.styleSheets[0].insertRule('.mail-filter-on { color: blue; }', 0);
  var thre = document.getElementsByClassName('thre')[0];
  var toggle = false;
  var btn = document.createElement('SPAN');
  var exec = e => {
    toggle = ! toggle;
    console.log(toggle);
    btn.classList.toggle('mail-filter-on');
    if (toggle) {
      [].forEach.call(document.querySelectorAll('a[href^=mailto]'), a => {
        while (a) {
          if (a.tagName === 'TABLE') {
            a.classList.add('has-mail');
            return;
          }
          a = a.parentNode;
        }
      });
      thre.classList.add('has-mail-filter');
    } else {
      thre.classList.remove('has-mail-filter');
    }
		btn.scrollIntoView({ behavior: 'instant' });
  };
  btn.textContent = '[✉]';
  btn.classList.add('mail-filter-btn');
  btn.addEventListener('click', exec);
  var futakuroBorderArea = document.getElementById('border_area');
  if (futakuroBorderArea) {
    futakuroBorderArea.insertBefore(btn, null);
  } else {
    document.getElementById('contres').insertBefore(btn, document.getElementById('contdisp').nextSibling);
  }
})();

QingJ © 2025

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