Greasy Fork is available in English.

FIX for "Bing Search returns to the top" !

Stop doing weird things, Bing ;)

< Feedback on FIX for "Bing Search returns to the top" !

Question/comment

§
Posted: 07.08.2023.

(function() {
'use strict';

// Disable the scroll to top functionality
function disableScrollToTop() {
window.scrollTo = function(x, y) {
if (y !== 0) {
window.scrollTo.originalFunc(x, y);
}
};
window.scrollTo.originalFunc = window.scrollTo;
}

// Listen for 'focus' events on the window
window.addEventListener('focus', disableScrollToTop);
})();

作者,你好,以上是你的源码。
window.scrollTo.originalFunc = window.scrollTo;这一行代码写在这里会有些问题,导致window.scrollTo.originalFunc并没有存储源scrollTo方法,而是你修改后的方法,那么脚本生效之后,调用window.scrollTo会导致堆栈溢出。
希望可以修复该bug。

Post reply

Sign in to post a reply.