百度知道 - 移除答案中多余的字符

移除答案中多余的字符,让复制的结果更干净

  1. // ==UserScript==
  2. // @name Baidu Zhidao - Remove redundant strings in answers
  3. // @name:zh-CN 百度知道 - 移除答案中多余的字符
  4. // @namespace https://greasyfork.org/zh-CN/users/193133-pana
  5. // @homepage https://www.sailboatweb.com
  6. // @version 1.0.0
  7. // @description Remove redundant strings in answers, make the copy result tidy
  8. // @description:zh-CN 移除答案中多余的字符,让复制的结果更干净
  9. // @author pana
  10. // @license GNU General Public License v3.0 or later
  11. // @match *://zhidao.baidu.com/question/*
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. function init() {
  18. document.querySelectorAll('.answer-text span, .best-text span').forEach((item) => {
  19. if (item.textContent.match(/^\d+$/)) {
  20. item.parentNode.removeChild(item);
  21. }
  22. });
  23. }
  24. init();
  25. })();