这是一个登录净化百度首页的脚本,个人使用
当前为
// ==UserScript==
// @name 清爽百度
// @version 0.2
// @description 这是一个登录净化百度首页的脚本,个人使用
// @author You
// @match https://www.baidu.com/
// @grant none
// @namespace https://greasyfork.org/users/597361
// ==/UserScript==
(function() {
'use strict';
var IsLogin = $('.s-top-login-btn').text() == '登录' ? "#lg" : "#s_fm";
var ClearVal = `#s_lg_img,.s-hotsearch-title,#hotsearch-content-wrapper,#s-top-left,#bottom_layer,#s_side_wrapper`;
if((window.location.href).split("/")[2] != "www.baidu.com") return false;
//body设置
//document.body.style.fontFamily = 'Quicksand,"游ゴシック","Yu Gothic","游ゴシック体",YuGothic,"Yu Gothic UI","ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro","Meiryo UI","メイリオ",Meiryo,sans-serif';
//document.body.style.background = 'url(https://api.ixiaowai.cn/mcapi/mcapi.php) no-repeat';
// if (window.location.href.length > 25) {
// $(".wrapper_new #head").css({
// "background": "transparent"
// });
// setTimeout(()=>{
// $(".bgcImg").css({
// "opacity": "0.3",
// "z-index":'-1',
// "width":"100%",
// "height":"100%"
// });
// $('.s_ipt').css({
// 'border': 'none'
// });
// },1000)
// }
// 全局背景
// var img = document.createElement('img');
//img.src = 'https://api.dongmanxingkong.com/suijitupian/acg/1080p/index.php';
// $(img).css({
// "position": "fixed",
// "top": "0",
// "left": "0",
// 'z-index':'-1',
// "width":"100%",
// "height":"100%"
// }).attr("class", "bgcImg")
// $('body').prepend(img)
$('#s_top_wrap').hide();
//一言模块
fetch('https://v1.hitokoto.cn/?c=a')
.then(function (response) {
return response.json();
}) .then(function (myJson) {
var myText = document.createElement('div');
myText.className = 'hitokoto';
$(myText).css({
'position': 'absolute',
'left': '50%',
'top': '50%',
'width': '100%',
'transform': 'translate(-50%,-50%)',
'textOverflow': 'ellipsis',
'whiteSpace': 'normal',
'textAlign': 'center',
'fontSize': '1.6rem',
'color': 'black'
})
myText.innerText = myJson.hitokoto;
//一言的作者 处理
var fromWho = '';
if (myJson.from_who == null) {
fromWho = ' ';
}
//时间处理
var CreateTime = new Date(parseFloat(myJson.created_at + '000'));
var CreatTime = CreateTime.toLocaleDateString() + CreateTime.toLocaleTimeString();
myText.innerHTML += '<span id="spanText" style="font-size:1rem;">' + '<br>' + '来自—' + myJson.from + ' ' + fromWho + ' ' + CreatTime + '</span>';
//插入
console.log("is",IsLogin);
$(IsLogin).append(myText);
});
//输入框清空事件
//$('.self-btn').click(()=>{ setTimeout(function(){ $('.s_ipt').val(''); $('.hitokoto').hide() },150) });
$(".s_ipt").bind("input propertychange",function(e){$(".bdsug").css({"background":"rgba(255, 255, 255, 0.77)"});$(".hitokoto").hide();$(".s_ipt").css({"border":"none"});$(".bgcImg").css({"opacity":"0.3","z-index":"-1","width":"100%"});$(".wrapper_new #head #page").css({"background":"transparent"});$("#page").css({"background":"transparent"})});
// 输入框输入改变事件
// $("input.s_ipt").bind("input propertychange",(e)=>{
// $("div.hitokoto").hide();
// $("input.s_ipt").css({
// "border":"none",
// })
// })
//搜索框颜色
$('.s_ipt').css({
'border': '#4e6ef2 solid 2px'
})
// 精简部分
var BaiduImgSIn = setInterval(()=>{
if($('#s_lg_img')[0]){
$(ClearVal).hide();
clearInterval(BaiduImgSIn)
}
},200)
})();