必应 Bing 搜索添加今日热榜,Microsoft Rewards点击赚积分
当前为
// ==UserScript==
// @name 必应-今日热榜
// @namespace https://gf.qytechs.cn/zh-CN/users/1513778-chris-lu
// @version 2025.09.17.03
// @description 必应 Bing 搜索添加今日热榜,Microsoft Rewards点击赚积分
// @author Chris Lu
// @match *://*.bing.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bing.com
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js#sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==
// @license The MIT License (MIT); http://opensource.org/licenses/MIT
// @grant unsafeWindow
// @grant GM_getResourceText
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle(`
#rebang{
//margin: 11px 0 0 var(--lgutter);
padding:0px 22px;
margin-bottom:30px;
}
#ex-search-keywords{
border:solid silver 1px;
border-radius:5px;
padding:10px;
}
.col-form-label{
line-height:30px;
margin-right:10px;
}
.form-select{
margin-right:10px;
}
.row{
display: flex;
flex-wrap: wrap;
margin-bottom:10px;
}
.col-sm-3{
width:25%;
}
@media only screen and (max-width: 600px) {
.col-12{
width:100%;
}.col-6{
width:50%;
}
}
.rebang-link {
font-size:14px;
overrlow:hidden;
white-space:nowrap;
margin-bottom:3px;
}
`);
this.$ = this.jQuery = jQuery.noConflict(true);
this.$doc = window.top===window.self? $(document):$(window.top.document);
function truncateText(str, maxlength) {
if (str.length > maxlength) {
return str.slice(0, maxlength - 1) + '…';
}
return str;
}
function fetchKeywordsBySource(){
var cacheKey = `RebangChannel_${(localStorage.getItem('SelectedRebangChannel')??'微博')}`;
if(sessionStorage.getItem(cacheKey)){
renderKeywordsBySource(sessionStorage.getItem(cacheKey)?JSON.parse(sessionStorage.getItem(cacheKey)):null);
console.log(`hit ${cacheKey} cache`);
}else{
$.ajax( {
"url": "https://api.pearktrue.cn/api/dailyhot/?title="+(localStorage.getItem('SelectedRebangChannel')??'微博'),
"method": "GET",
"timeout": 0,
}).done(function (response) {
if(response.code==200 && response.data){
sessionStorage.setItem(cacheKey,JSON.stringify(response.data))
renderKeywordsBySource(response.data);
console.log(`fetched ${cacheKey}`);
}
});
}
}
function initChannels(channels, selectedChannel){
channels?.forEach(function(element){
var opt= new Option(element, element);
opt.selected= element== selectedChannel;
$doc.find('#ext-search-channels').append(opt);
});
$doc.find('#ext-search-channels').change(function(e){
localStorage.setItem('SelectedRebangChannel',$(this).val());
fetchKeywordsBySource();
});
$doc.find('#ext-search-link-type').change(function(e){
fetchKeywordsBySource();
});
$doc.find('#ext-search-refresh').click(function(e){
sessionStorage.removeItem(`RebangChannel_${(localStorage.getItem('SelectedRebangChannel')??'微博')}`);
fetchKeywordsBySource();
});
if(localStorage.getItem('SelectedRebangChannel') == null){
localStorage.setItem('SelectedRebangChannel',"微博");
}
fetchKeywordsBySource();//第一次加载
}
function renderKeywordsBySource(topics){
$doc.find('#ex-search-keywords').empty();
topics.forEach(function(element,index){
if($doc.find('#ext-search-link-type').val() =='搜索')
$doc.find('#ex-search-keywords').append(`<a target='_self' class='col-sm-3 col-12 rebang-link rebang-link-search' title='${element.title}' href='javascript:void();'>${index+1}.${truncateText(element.title,16)}</a>`);
else
$doc.find('#ex-search-keywords').append(`<a target='_blank' class='col-sm-3 col-12 rebang-link' title='${element.title}' href='${element.url??element.mobileUrl}'>${index+1}.${truncateText(element.title,16)}</a>`);
});
$doc.find('#ex-search-keywords').append(`<a target='_blank' class='col-12 rebang-link' href='https://rewards.bing.com/welcome?rh=3D3F7F7&ref=rafsrchae'>👉加入Microsoft Rewards点击🔥热🔥点🔥赚取积分!👈</a>`);
$doc.find('#b_content').css('padding-top','10px');
$doc.find('#ex-search-keywords .rebang-link-search').click(function(e){
$doc.find('#sb_form_q').val($(this).attr('title'));
$doc.find('#sb_form_go').click();
});
}
function renderRebang(){
if(window.top!==window.self){
console.log('run in an iframe.');
}
if($doc.find('#rebang').length==0 && $doc.find('#b_content').length>0){
$doc.find('#b_content').prepend("<div id='rebang'><div class='row'><label class='col-form-label'><strong>今日热榜: </strong></label><select id='ext-search-channels' class='form-select' title='平台'></select><label class='col-form-label'><strong>点击操作: </strong></label><select id='ext-search-link-type' class='form-select' title='操作'><option value='搜索' selected>搜索</option><option value='打开'>打开</option></select><button id='ext-search-refresh' type='button'>刷新</button></div><div class='row' id='ex-search-keywords'></div></div>");
if(sessionStorage.getItem("RebangChannels")!==null){
initChannels(JSON.parse(sessionStorage.getItem("RebangChannels")),localStorage.getItem('SelectedRebangChannel')??'微博');
console.log('hit RebangChannels cache.');
}else{
$.ajax( {
"url": "https://api.pearktrue.cn/api/dailyhot",
"method": "GET",
"timeout": 0,
}).done(function (response) {
if(response.code==200 && response.data && response.data.platforms){
sessionStorage.setItem("RebangChannels",JSON.stringify(response.data.platforms))
initChannels(response.data.platforms,localStorage.getItem('SelectedRebangChannel')??'微博');
console.log('fetched RebangChannels.');
}
});
}
}
}
(function() {
'use strict';
if(window.top===window.self){
renderRebang();
setTimeout(function(){
if($doc.find('#rebang').length==0){
console.log('document delay found, recheck.');
renderRebang();
}},3000);
}
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址