// ==UserScript== // @name Mobile search engineer switcher // @namespace http://tampermonkey.net/ // @version 2023.10.27 // @description 搜索引擎切换 // @description:en switch search engineer // @author Andy Yuen // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.slim.min.js // @include *://*.bing.*/search* // @include *://*.google.*/search* // @include *://*.baidu.*/*word* // @include *://*.baidu.*/*wd* // @icon https://www.google.com/s2/favicons?sz=64&domain=bing.com // @noframes // @license MIT // @grant none // @downloadURL none // ==/UserScript== (function () { 'use strict'; console.log('mobile search engineer switcher') if (!/Mobi|Android|iPhone/i.test(navigator.userAgent)) return; // Disable the scroll to top functionality if (location.host.includes('bing.com')) { window.addEventListener('focus', function () { window.scrollTo = function (x, y) { if (y !== 0) { window.scrollTo.originalFunc(x, y); } }; window.scrollTo.originalFunc = window.scrollTo; }); } let selector = ''; if (location.host.includes('bing.com')) { selector = '[role="navigation"] ul'; } else if (location.host.includes('google.com')) { selector = '#hdtb-msb'; } else if (location.host.includes('baidu.com')) { selector = '.se-tab-lists'; } !function () { if ($(selector).length && !$('.injection-mses').length) { if (location.host.includes('bing.com')) { $(selector).prepend([ ['谷歌', 'google.com/search?q='], ['百度', 'baidu.com/s?wd='] ].map(([name, url]) => { return $(`