Skip to content

Commit

Permalink
更新 sx.js
Browse files Browse the repository at this point in the history
  • Loading branch information
gitMFQ authored Apr 17, 2024
1 parent 7046206 commit 087c8be
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions js/sx.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
// ==UserScript==
// @name 搜索引擎切换功能条
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 在浏览器顶部添加一个功能条以切换搜索引擎
// @author Copilot
// @match *://*/*
// @grant none
// ==/UserScript==

(function() {
'use strict';

// 创建功能条容器
var searchSwitchBar = document.createElement('div');
searchSwitchBar.style.display = 'block';
searchSwitchBar.style.display = 'flex';
searchSwitchBar.style.fontSize = '15px';
searchSwitchBar.style.left = '0px';
searchSwitchBar.style.top = '0px';
Expand All @@ -15,13 +25,14 @@
searchSwitchBar.style.padding='0 10px'
searchSwitchBar.style.borderBottom='#ddd 1px solid'
searchSwitchBar.style.boxShadow='#eee 0 5px 5px 0'
document.getElementsByTagName('body')[0].style = "margin-top: 35px !important;";

// 添加百度搜索按钮
var baiduButton = document.createElement('a');
baiduButton.textContent = '百度';
baiduButton.style.fontWeight='bold'
baiduButton.style.padding = '8px';
baiduButton.href=''
baiduButton.href=`https://m.baidu.com/s?from=0/bd_page_type=1/ssid=0/uid=0/pu=usm@0,sz@1320_2001,ta@zbios_1_17.0_22_5.8/baiduid=9EE4A9514F34EC8945462A0772ED490C/w=0_10_A Thousand Years/t=zbios/l=1/tc?ref=www_zbios&order=2&fm=alop&isAtom=1&is_baidu=0&tj=sg_kg_entity_san_2_0_10_l1&word=${'测试'}&bdver=2_1&tcplug=1&dict=-1&bdenc=1`

// 添加搜狗搜索按钮
var sougouButton = document.createElement('a');
Expand All @@ -39,5 +50,5 @@
searchSwitchBar.appendChild(sougouButton);

// 将功能条添加到页面顶部
document.body.insertBefore(searchSwitchBar, document.body.firstChild);
document.getElementsByTagName('head')[0].after(searchSwitchBar);
})();

0 comments on commit 087c8be

Please sign in to comment.