文心一言增强
// ==UserScript==
// @name 文心一言增强
// @namespace github.com/hmjz100
// @version 1.3.3
// @description 改自【温馨遗言】,文心一言 彻底去除&自定义水印、美化文心一言界面。目前比所有相关脚本都要强大。
// @author Hmjz100、涛之雨
// @match *://yiyan.baidu.com/*
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAPVklEQVR4Ad3BC7Dmd0Ee4Of9f985m102m92EhCRchACmSQgYCFFMLEglChlBbBkvo6gFRUCQIuNMO3UmmbF1aDWdgheqXNTOiKKiUgVF5KJxuEhKSLmJ0ZCQEGBDrrvJ7p7z/d6eswcVLH67uXb0eeIfaHsWno8L8TDs9E/bPlyLt+O1ST7qS8QXtV3FpXghJv88DfwCXp7kkA0zG9qu4m34DsQ/X8F5OP/iiy/+9UsuuWQxt+VSPNX9ZP8ar//4whs+UQ8+dvLjXxPfcErcj56KS/EjaXsWrsTkfvDu64efu3LhipvndCHTzLY5z3wYLzyLh+yM+8nAY+d4Pib3satvrdd8ZOF/XV1r04ouDolo1x3ozG9dO7nsc/W804dvPy12rsR9bMLz57jQfWjfWr3xL4c3fGTh82urLA7hIKE2hHRhjOEzi7mfvCL+4NrhJWfX+Q+aJO5LF87xMPeRd1278OorhituJDb0ToJEhBTRVmxYX9fwoZvnfug9w7MfUc87I0471n3lYXPsdC/7xBeG/3HFmrdePaxnxmJNg0SK0CAkDmswVRo9tGZtmvzmtZN3Xb/wb8+YPOc0jluNe9nOuXvRF+6o1334oF/72Lrb1ld0LLBOSEKoDROxoTQIsWFQG0I69MCwd77iv1zJ719TP3RGPeNhcW+auxesD9561UGv+sAhV90+pxgHSCQ2RBEloVXE3ysipIgixfq6ho/dOveK99YfXlcvPjNO3+1eMXcPfeiGda9+/53+5FPrzOaMA4QIoRNKUk1IJWEKsxVSFuuEBiFBqsJUET20Zm2a+aPrJx/4PN95Wn3f6bFnm3tk7m7au3947eV3+tUrDrij23RUeogEUZWgQVXEF81WZBzyyN2xb60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CYII=
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @run-at document-start
// @license WTFPL
// ==/UserScript==
/* global ajaxHooker*/
(function() {
var ajaxHooker = function() {
const win = window.unsafeWindow || document.defaultView || window;
const hookFns = [];
const xhrProto = win.XMLHttpRequest.prototype;
const xhrProtoDesc = Object.getOwnPropertyDescriptors(xhrProto);
const xhrReadyState = xhrProtoDesc.readyState.get;
const resProto = win.Response.prototype;
const realXhrOpen = xhrProto.open;
const realXhrSend = xhrProto.send;
const realFetch = win.fetch;
const xhrResponses = ['response', 'responseText', 'responseXML'];
const fetchResponses = ['arrayBuffer', 'blob', 'formData', 'json', 'text'];
function emptyFn() {}
function readOnly(obj, prop, value = obj[prop]) {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
get: () => value,
set: emptyFn
});
}
function writable(obj, prop, value = obj[prop]) {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
writable: true,
value: value
});
}
function fakeXhrOpen(method, url, ...args) {
const xhr = this;
xhr.__ajaxHooker = xhr.__ajaxHooker || {headers: {}};
xhr.__ajaxHooker.url = url;
xhr.__ajaxHooker.method = method.toUpperCase();
xhr.__ajaxHooker.remainArgs = args;
xhr.setRequestHeader = (header, value) => {
xhr.__ajaxHooker.headers[header] = value;
}
xhrResponses.forEach(prop => {
delete xhr[prop]; // delete descriptor
});
return realXhrOpen.call(xhr, method, url, ...args);
}
function fakeXhrSend(data) {
const xhr = this;
const req = xhr.__ajaxHooker;
if (xhrReadyState.call(xhr) === 1 && req) {
const request = {
type: 'xhr',
url: req.url,
method: req.method,
abort: false,
headers: req.headers,
data: data,
response: null
};
for (const fn of hookFns) {
fn(request);
if (request.abort) return;
}
realXhrOpen.call(xhr, request.method, request.url, ...req.remainArgs);
data = request.data;
for (const header in request.headers) {
xhrProto.setRequestHeader.call(xhr, header, request.headers[header]);
}
if (typeof request.response === 'function') {
const arg = {};
xhrResponses.forEach(prop => {
Object.defineProperty(xhr, prop, {
configurable: true,
enumerable: true,
get: () => {
if (xhrReadyState.call(xhr) === 4) {
if (!('finalUrl' in arg)) {
arg.finalUrl = xhr.responseURL;
arg.status = xhr.status;
arg.responseHeaders = {};
const arr = xhr.getAllResponseHeaders().trim().split(/[\r\n]+/);
for (const line of arr) {
const parts = line.split(/:\s*/);
if (parts.length === 2) {
const lheader = parts[0].toLowerCase();
if (lheader in arg.responseHeaders) {
arg.responseHeaders[lheader] += ', ' + parts[1];
} else {
arg.responseHeaders[lheader] = parts[1];
}
}
}
}
if (!(prop in arg)) {
arg[prop] = xhrProtoDesc[prop].get.call(xhr);
request.response(arg);
}
}
return prop in arg ? arg[prop] : xhrProtoDesc[prop].get.call(xhr);
}
});
});
}
}
return realXhrSend.call(xhr, data);
}
function hookFetchResponse(response, arg, callback) {
fetchResponses.forEach(prop => {
response[prop] = () => new Promise((resolve, reject) => {
resProto[prop].call(response).then(res => {
if (!(prop in arg)) {
arg[prop] = res;
callback(arg);
}
resolve(prop in arg ? arg[prop] : res);
}, reject);
});
});
}
function fakeFetch(url, init) {
if (typeof url === 'string' || url instanceof String) {
init = init || {};
init.headers = init.headers || {};
const request = {
type: 'fetch',
url: url,
method: (init.method || 'GET').toUpperCase(),
abort: false,
headers: {},
data: init.body,
response: null
};
if (init.headers.toString() === '[object Headers]') {
for (const [key, val] of init.headers) {
request.headers[key] = val;
}
} else {
request.headers = {...init.headers};
}
for (const fn of hookFns) {
fn(request);
if (request.abort) return Promise.reject('aborted');
}
url = request.url;
init.method = request.method;
init.headers = request.headers;
init.body = request.data;
if (typeof request.response === 'function') {
return new Promise((resolve, reject) => {
realFetch.call(win, url, init).then(response => {
const arg = {
finalUrl: response.url,
status: response.status,
responseHeaders: {}
};
for (const [key, val] of response.headers) {
arg.responseHeaders[key] = val;
}
hookFetchResponse(response, arg, request.response);
response.clone = () => {
const resClone = resProto.clone.call(response);
hookFetchResponse(resClone, arg, request.response);
return resClone;
};
resolve(response);
}, reject);
});
}
}
return realFetch.call(win, url, init);
}
xhrProto.open = fakeXhrOpen;
xhrProto.send = fakeXhrSend;
win.fetch = fakeFetch;
return {
hook: fn => hookFns.push(fn),
protect: () => {
readOnly(win, 'XMLHttpRequest');
readOnly(xhrProto, 'open');
readOnly(xhrProto, 'send');
readOnly(win, 'fetch');
},
unhook: () => {
writable(win, 'XMLHttpRequest');
writable(xhrProto, 'open', realXhrOpen);
writable(xhrProto, 'send', realXhrSend);
writable(win, 'fetch', realFetch);
}
};
}();
function repair(i){
if (i >= 0 && i <= 9) {
return "0" + i;
} else {
return i;
}
}
var setting_beautiful = "开启界面美化";
var setting_tips = "显示脚本提示";
function timer() {
var date = new Date();//获取新的时间
var year = date.getFullYear() //返回指定日期的年份
var month = repair(date.getMonth() + 1);//月
var day = repair(date.getDate());//日
var hours = repair(date.getHours());//时
var minute = repair(date.getMinutes());//分
var second = repair(date.getSeconds());//秒
//拼凑时间
var curTime = year + "年 - " + month + "月 - " + day + "日 " + hours + "时 : " + minute + "分 : " + second + "秒";
return curTime //输出时间
}
function APM() {
// 获取新的时间
var date = new Date();
// 设置默认文字
let hourtext = ``;
// 获取小时
var hour = date.getHours();
// 判断当前时间段
if (hour >= 0 && hour <= 10) {
hourtext = `早上好`;
} else if (hour > 10 && hour <= 14) {
hourtext = `中午好`;
} else if (hour > 14 && hour <= 18) {
hourtext = `下午好`;
} else if (hour > 18 && hour <= 24) {
hourtext = `晚上好`;
}
return hourtext//输出文字
}
/*
从这里开始才是核心代码
agreement:用户协议状态,0表示已同意。
applyStatus:申请状态,0表示未申请内测(跳转Welcome并提示加入体验),1表示已申请内测(跳转Welcome并显示申请中[审核]),2表示可对话(申请通过,显示开始体验),n表示未发布(无法申请[没有申请按钮])。
authStatus:认证状态,1表示已认证。v
developerApplyStatus:是否已申请开发者,0表示未申请,1表示已申请,2表示可对话
firstDeveloper:是否为开发者,0表示不显示,1表示显示。
firstPrompt:是否显示首次提示(一起帮助文心一言成长!),0表示显示,1表示不显示。
firstShowAT:内测专用App是否显示New标签,false表示不显示,true表示显示。
fuzzyName:模糊的用户名。
hasATAuthority:是否显示内测专用App下载按钮,false表示不显示,true表示显示。
isBanned:是否被限制使用,false表示没有,true表示被限制使用。
isForeignPhoneNumber:是否为外国手机号码,false表示不是,true表示是。
isHasPhoneNumber:是否绑定手机号码,false表示没有,true表示已绑定。
isLogin:是否登录,false表示未登录,true表示已登录。
portrait:头像链接。
protocol:协议版本号。
showWatermark:是否显示水印,false表示不显示,true表示显示。
status:状态码,0表示成功,1表示未同意测试规则。
uname:用户名。
watermark:水印。
*/
const wm=GM_getValue("watermark");
if (!wm||wm==undefined){
GM_setValue("watermark", "main");
GM_setValue("beautiful", "true");
GM_setValue("tips", "true");
}
const rid="apply"+Math.random().toString(36).slice(2);
Function[rid]=Function.apply;
Function.apply=function($this,args){
return Function[rid]($this,args.map(a=>a.replace(/debugger/ig,"")));
};
ajaxHooker.hook(request => {
console.log('【文心一言增强】\n捕获数据:',request)
if (request.url.endsWith('user/info')){
request.response = res => {
console.log('【文心一言增强】\nURL:' + request.url + '\n用户数据:',res.json)
if(wm=="main"){
console.log('【文心一言增强】\n水印数据:',res.json.content.watermark)
}else if(wm==null||wm==undefined||wm=="0"){
//res.json.content.watermark=' ';
res.json.content.showWatermark=false
}else if (wm!==null||wm!==undefined){
res.json.content.watermark=wm;
}
};
}else if(request.url.endsWith('chat/query') || request.url.endsWith('chat/history')){
request.response = res => {
console.log('【文心一言增强】\nURL:' + request.url + '\n用户数据:',res.json)
res.json=JSON.parse(JSON.stringify(res.json).replace(/x-bce-process/g,"?&"));
};
}
});
let beautiful = GM_getValue("beautiful");
if (beautiful === "true"){
let css = `
.DaMRbhJA, .q409gL1b, .MO979HM2, .n7xmRSxc, .UPBtBir5, .r1qZ7V8X, .V4Z0LJMp, .ADsh1gP1, .FO6Akn1X, .SUyVFs4D, .Wut10CU_, .p2p8WY_C, .vgRQZPcG, .yyjIo3Fm, .DX7LdtHE, .VQ2djAbz, .SSVppY0O, .fHW3f2un, .SnmO5KDe, .IYy0Rtzj, .HWnXEX1R, .w_gyIHaW, .cW6CkoHy, .l4evGQ2D, .Lbs1QLl8, .ZOZ4QjZD, .NAbRNa_d, .isovdMom, .Wtf5E6TY, .wsmtQT2B, .select-plugin, .ant-popover-buttons, .ant-btn-default, .ant-btn-primary, .plugin-item{
transition: all 0.3s ease 0s !important;
}
.NYG3ffBi, .oeXv4K1r, .tHbEKeXP{
background: linear-gradient(315deg,#f5f4f6,#e6ebf7) !important;
}
.ant-menu-vertical{
background: linear-gradient(225deg,#f5f4f6,#4955f521) !important;
}
.FZ3QiFoa .H7oUCk_o, .G3_wuwFo{
background: linear-gradient(45deg, #e8e9ff21 0%, #717ae52b 67%, #4955f521 100%) !important;
}
#wen-tips{
transition: all 0.3s ease 0s;
text-align: center;
background: #f6f8fd;
border-radius: 6px;
margin-bottom: 8px;
padding: 10px;
cursor: pointer;
}
#wen-tips:hover {
color: #4955f5;
background: #dce1fa;
}
/* webkit, opera, IE9, Chrome*/
::selection {
background-color: #574AB8 !important;
background: #574AB8 !important;
color: white;
}
/* mozilla firefox */
::-moz-selection {
background-color: #574AB8 !important;
background: #574AB8 !important;
color: white;
}
`
GM_addStyle(css);
setting_beautiful = "关闭界面美化";
}
let tips = GM_getValue("tips");
if (tips === "true") {
setting_tips = "隐藏脚本提示";
setInterval(function(){
if (document.querySelector('strong')){
if (!document.getElementById("wen-tips")){
document.querySelectorAll('strong').forEach(function(e) {
if (e.innerHTML.match('你好')) {
e.parentElement.innerHTML+='<span id="wen-tips">'+APM()+',当前时间<br><span id="time" style="color: #7367F0;"></span><br>您可前往用户头像菜单修改水印和美化选项,或者隐藏掉这个提示。<br>如果觉得这个脚本不错,请来<a>GreasyFork</a>给个<b>好评</b>哦~</span>';
}
});
document.querySelector('#wen-tips').onclick = function() {
window.open('https://greasyfork.org/zh-CN/scripts/464729/feedback', '_blank');
};
let time = document.getElementById('time');
if (time) {
window.setInterval(function() {
time.innerHTML = timer();
},500)
}
}
};
},5000)
};
const id = setInterval(() => {
if (document.getElementsByClassName("bkf7LVjO")[0]) {
if (!document.getElementById("change-wenxin-pc")) {
if (document.getElementsByClassName("ant-menu ant-menu-sub ant-menu-vertical")[0]) {
document.getElementsByClassName("ant-menu ant-menu-sub ant-menu-vertical")[0].innerHTML += `<li role="menuitem" id="change-wenxin-pc" class="ant-menu-item ant-menu-item-only-child"><span class="ant-menu-title-content"><a class="vxwdOSYS">修改水印配置</a></span></li>`;
document.getElementsByClassName("ant-menu ant-menu-sub ant-menu-vertical")[0].innerHTML += `<li role="menuitem" id="no-tips-pc" class="ant-menu-item ant-menu-item-only-child"><span class="ant-menu-title-content"><a class="vxwdOSYS">${setting_tips}</a></span></li>`;
document.getElementsByClassName("ant-menu ant-menu-sub ant-menu-vertical")[0].innerHTML += `<li role="menuitem" id="beautiful-pc" class="ant-menu-item ant-menu-item-only-child"><span class="ant-menu-title-content"><a class="vxwdOSYS">${setting_beautiful}</a></span></li>`;
console.log("电脑板水印按钮加载完成");
clearInterval(id);
document.getElementById("no-tips-pc").onclick = function() {
let tips = GM_getValue("tips");
if (tips === "false" || !tips) {
GM_setValue("tips", "true");
confirm("设置成功,刷新后生效。\n是否立即刷新?") && location.reload();
} else if (tips === "true") {
GM_setValue("tips", "false");
confirm("设置成功,刷新后生效。\n刷新后,你仍然可以前往用户头像菜单修改水印和显示脚本提示\n是否立即刷新?") && location.reload();
}
};
document.getElementById("beautiful-pc").onclick = function() {
let beautiful = GM_getValue("beautiful");
if (beautiful === "false" || !beautiful) {
GM_setValue("beautiful", "true");
confirm("设置成功,刷新后生效。\n是否立即刷新?") && location.reload();
} else if (beautiful === "true") {
GM_setValue("beautiful", "false");
confirm("设置成功,刷新后生效。\n刷新后,你仍然可以前往用户头像菜单开关美化\n是否立即刷新?") && location.reload();
}
};
document.getElementById("change-wenxin-pc").onclick = function() {
const inp = prompt("请输入自定义水印内容:\n\n输入“main”恢复默认水印,\n输入“0”不显示水印。\n", "" + wm);
if (inp == null) return;
GM_setValue("watermark", `${inp}`);
confirm("设置成功,刷新后生效。\n是否立即刷新?") && location.reload();
};
}
}
}
if(document.getElementsByClassName("fAQYFzvD")[0]){
if (!document.getElementById("change-wenxin-mb")){
document.getElementsByClassName("fAQYFzvD")[0].innerHTML+='<a id="change-wenxin-mb" style="transition: all 0.3s ease; color: #4955f5; padding-left: 10px;">水印<br>配置</a>';
document.getElementsByClassName("fAQYFzvD")[0].innerHTML+='<a id="no-tips-mb" style="transition: all 0.3s ease; color: #4955f5; padding-left: 10px;">显隐<br>提示</a>';
document.getElementsByClassName("fAQYFzvD")[0].innerHTML+='<a id="beautiful-mb" style="transition: all 0.3s ease; color: #4955f5; padding-left: 10px;">美化<br>开关</a>';
document.getElementsByClassName("zC2w4edS")[0].innerHTML='<a href="https://wanhua.baidu.com/talk/download" target="_blank">内测App下载</a>';
}
console.log("手机版水印按钮加载完成");
clearInterval(id);
document.getElementById("no-tips-mb").onclick = function() {
let tips = GM_getValue("tips");
if (tips === "false" || !tips) {
GM_setValue("tips", "true");
confirm("设置成功,刷新后生效。\n是否立即刷新?") && location.reload();
} else if (tips === "true") {
GM_setValue("tips", "false");
confirm("设置成功,刷新后生效。\n刷新后,你仍然可以前往菜单修改水印和显示脚本提示。\n是否立即刷新?") && location.reload();
}
};
document.getElementById("beautiful-mb").onclick = function() {
let beautiful = GM_getValue("beautiful");
if (beautiful === "false" || !beautiful) {
GM_setValue("beautiful", "true");
confirm("设置成功,刷新后生效。\n是否立即刷新?") && location.reload();
} else if (beautiful === "true") {
GM_setValue("beautiful", "false");
confirm("设置成功,刷新后生效。\n刷新后,你仍然可以前往菜单开关美化\n是否立即刷新?") && location.reload();
}
};
document.getElementById("change-wenxin-mb").onclick=function(){
const inp=prompt("请输入自定义水印内容:\n\n输入“main”恢复默认水印,\n输入“0”不显示水印。\n",""+wm);
if (inp==null)return;
GM_setValue("watermark",`${inp}`);
confirm("设置成功,刷新后生效。\n是否立即刷新?")&&location.reload();
};
}
window.onbeforeunload = null;
},200);
})();