Bing stop now

锁定Bing,不自动到顶端

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        Bing stop now
// @namespace   Bing页面锁定
// @description 锁定Bing,不自动到顶端
// @author      girl
// @icon        https://favicon.yandex.net/favicon/v2/bing.com
// @include     *://cn.bing.com/*
// @version     0.0.1
// @license     GPL-3.0-only
// @home-url    https://greasyfork.org/zh-CN/scripts/430997
// ==/UserScript==
//
 
(function() {
    'use strict';
     //====================================================================================
    // 禁止Bing烦人的自动返回页面顶部
    // https://greasyfork.org/zh-CN/scripts/461790-fix-for-bing-search-returns-to-the-top
    // Disable the scroll to top functionality
    function disableScrollToTop() {
        let originalFunc = window.scrollTo;
        window.scrollTo = function(x, y) {
            if (y !== 0) {
                originalFunc(x, y);
            }
        };
    }
 
    // Listen for 'focus' events on the window
    window.addEventListener('focus', disableScrollToTop);
    //====================================================================================
})();