Bing Simplify

Simplify the Bing

  1. // ==UserScript==
  2. // @name Bing Simplify
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-06-22
  5. // @description Simplify the Bing
  6. // @license MIT
  7. // @author Sokranotes
  8. // @match *://*/*
  9. // @match https://cn.bing.com/*
  10. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14.  
  15. // *://*/* to match the default new tab
  16. // ref: https://stackoverflow.com/questions/45300745/can-i-run-a-userscript-on-the-new-tab-page
  17.  
  18. function click(){
  19. //console.log("click");
  20. document.querySelector('.sb_form_placeholder_query').setAttribute('style','display:none');
  21. document.getElementById('sa_hd').setAttribute('style','display:none');
  22. };
  23.  
  24. (function () {
  25. 'use strict';
  26. if((document.URL == 'https://cn.bing.com/chrome/newtab' || document.domain == 'cn.bing.com' || document.domain == 'bing.com') && document.title == '必应'){
  27. simplifyBingCN();
  28. }
  29. })();
  30.  
  31. function simplifyBingCN(){
  32. console.log("Simplify the Bing");
  33. document.getElementById('vs_cont').parentElement.setAttribute('style','display:none');
  34. document.getElementById('sb_form_q').addEventListener = click;
  35. document.getElementById('id_h').setAttribute('style','display:none');
  36. document.getElementById('images').setAttribute('style','display:none');
  37. document.getElementById('video').setAttribute('style','display:none');
  38. document.getElementById('dots_overflow_menu_container').setAttribute('style','display:none');
  39. document.getElementById('est_switch').setAttribute('style','display:none');
  40. //cleanSearch();
  41. }
  42.  
  43. function cleanSearch() {
  44. const el = document.querySelector('.SearchBar-input > input');
  45. const observer = new MutationObserver((mutationsList, observer) => {
  46. if (mutationsList[0].attributeName === 'placeholder' && mutationsList[0].target.placeholder != '') mutationsList[0].target.placeholder = '';
  47. });
  48. el.placeholder = '';
  49. observer.observe(el, { attributes: true });
  50. document.documentElement.appendChild(document.createElement('style')).textContent = '.AutoComplete-group > .SearchBar-label:not(.SearchBar-label--history), .AutoComplete-group > [id^="AutoComplete2-topSearch-"], .AutoComplete-group > [id^="AutoComplete3-topSearch-"] {display: none !important;}';
  51. }