fCSDNck

屏蔽百度搜索结果中 CSDN 相关搜索结果

当前为 2022-02-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name fCSDNck
  3. // @namespace https://github.com/tempestLXC/fCSDNck
  4. // @version 0.0.2
  5. // @description 屏蔽百度搜索结果中 CSDN 相关搜索结果
  6. // @author tempestlxc
  7. // @match *://www.baidu.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var CSDN='-(csdn)';
  15. var button = document.createElement("button");
  16. button.className = "btn self-btn bg s_btn";
  17. button.textContent = "fCSDNck";
  18. button.style.background = "#e33e33";
  19.  
  20. button.addEventListener("click", clickBotton);
  21.  
  22. function clickBotton(){
  23. var kw =document.getElementById('kw');
  24. if( !isEmpty(kw.value) && !kw.value.includes(CSDN) ){
  25. kw.value = kw.value + ' ' +CSDN;
  26. }
  27. }
  28.  
  29. var like_comment = document.getElementById('s_btn_wr');
  30. like_comment.appendChild(button);
  31.  
  32. function isEmpty(obj){
  33. if(typeof obj == "undefined" || obj == null || obj == ""){
  34. return true;
  35. }else{
  36. return false;
  37. }
  38. }
  39. })();