lingbopro / lingbopro/AlwaysBing
改版
Open
@lingbopro is already working on this.
Since Feb 15, 2025.
enhancement
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
// ==UserScript==
// @name Baidu Search tool Add a hint
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Baidu View Hints
// @author Mbilse
// @match *://*.baidu.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 检查是否是百度全家桶的页面
if (window.location.href.includes('m.baidu.com')) {
// 获取搜索关键词(如果有)
const searchQuery = new URLSearchParams(window.location.search).get('wd') || '';
// 弹出确认框
const result = confirm('要继续使用百度搜索吗?\n点击\nA. 确定:用百度\nB. 取消:用必应');
// 如果用户选择“取消”,跳转到必应搜索
if (!result) {
window.location.href = `https://www.bing.com/search?q=${encodeURIComponent(searchQuery)}`;
}
}
})();
// 创建一个按钮用于显示黑幕
const showButton = document.createElement('button');
showButton.textContent = '显示黑幕';
showButton.style.position = 'absolute';
showButton.style.top = '10px';
showButton.style.left = '10px';
showButton.style.zIndex = '10000'; // 确保按钮在黑幕之上
document.body.appendChild(showButton);
// 创建一个按钮用于隐藏黑幕
const hideButton = document.createElement('button');
hideButton.textContent = '隐藏黑幕';
hideButton.style.position = 'absolute';
hideButton.style.top = '50px';
hideButton.style.left = '10px';
hideButton.style.zIndex = '10000'; // 确保按钮在黑幕之上
document.body.appendChild(hideButton);
// 创建黑幕元素
const blackScreen = document.createElement('div');
blackScreen.style.position = 'fixed'; // 固定定位
blackScreen.style.top = '0';
blackScreen.style.left = '0';
blackScreen.style.width = '100%'; // 宽度和高度覆盖全屏
blackScreen.style.height = '100%';
blackScreen.style.backgroundColor = 'black'; // 黑色背景
blackScreen.style.zIndex = '9999'; // 确保它在最上层
document.body.appendChild(blackScreen);
// 添加事件监听器
showButton.addEventListener('click', () => {
blackScreen.style.display = 'block'; // 显示黑幕
});
hideButton.addEventListener('click', () => {
blackScreen.style.display = 'none'; // 隐藏黑幕
});
可以试试这一个
改匹配之后来试
用手机(m.baidu.com)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.