Bing Simplify

Simplify the Bing

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         Bing Simplify
// @namespace    http://tampermonkey.net/
// @version      2024-06-22
// @description  Simplify the Bing
// @license      MIT
// @author       Sokranotes
// @match        *://*/*
// @match        https://cn.bing.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==


// *://*/* to match the default new tab
// ref: https://stackoverflow.com/questions/45300745/can-i-run-a-userscript-on-the-new-tab-page

function click(){
    //console.log("click");
    document.querySelector('.sb_form_placeholder_query').setAttribute('style','display:none');
    document.getElementById('sa_hd').setAttribute('style','display:none');
};

(function () {
    'use strict';
    if((document.URL == 'https://cn.bing.com/chrome/newtab' || document.domain == 'cn.bing.com' || document.domain == 'bing.com') && document.title == '必应'){
        simplifyBingCN();
    }
})();

function simplifyBingCN(){
    console.log("Simplify the Bing");
    document.getElementById('vs_cont').parentElement.setAttribute('style','display:none');
    document.getElementById('sb_form_q').addEventListener = click;
    document.getElementById('id_h').setAttribute('style','display:none');
    document.getElementById('images').setAttribute('style','display:none');
    document.getElementById('video').setAttribute('style','display:none');
    document.getElementById('dots_overflow_menu_container').setAttribute('style','display:none');
    document.getElementById('est_switch').setAttribute('style','display:none');
    //cleanSearch();
}

function cleanSearch() {
    const el = document.querySelector('.SearchBar-input > input');
    const observer = new MutationObserver((mutationsList, observer) => {
        if (mutationsList[0].attributeName === 'placeholder' && mutationsList[0].target.placeholder != '') mutationsList[0].target.placeholder = '';
    });
    el.placeholder = '';
    observer.observe(el, { attributes: true });
    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;}';
}