// ==UserScript==
// @name cnblogs garden
// @name:zh 博客花园-博客园(cnblogs)美化增强
// @namespace http://github.com/yuhanawa/UserScript
// @name:zh-CN 博客花园-博客园(cnblogs)美化增强
// @description better cnblogs
// @description:zh 博客园 首页及文章美化/自动翻页字体放大/样式调整等
// @description:zh-CN 博客园 首页及文章美化/自动翻页/字体放大/样式调整等
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_addStyle
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// @grant GM_openInTab
// @grant unsafeWindow
// @match *://*.cnblogs.com/*
// @match *://yuhan-script-config.netlify.app/*
// @match *://user-script-config-form.vercel.app/*
// @match *://yuhanawa.github.io/tools/userscriptconfig/*
// @version 0.1.19
// @author Yuhanawa
// @license GPL-3.0
// @icon none
// @run-at document-start
// ==/UserScript==
/*
cnblogs v.0.1.19 by Yuhanawa
Source: https://github.com/Yuhanawa/UserScript
*/
isLoaded=!1,onload(()=>isLoaded=!0);const __props__=new Map;
function get(k,d){return GM_getValue(k,void 0===d?__props__.get(k):d)}
function set(k,v){return GM_setValue(k,v)}
function cfg(k,v){return void 0===v?get(k):set(k,v)}
function getOptionKeyAndName(optionStr){var key=optionStr.match(/\$([^ ]+)/)?.[0];return key?{key:key.replace("$",""),name:optionStr.replace(key,"")}:{key:optionStr,name:optionStr}}
function style(css){var node;"undefined"!=typeof GM_addStyle?GM_addStyle(css):((node=document.createElement("style")).appendChild(document.createTextNode(css)),document.body.appendChild(node))}
function addMenu(name,key,options,current,index,onclick){const getOptionKey=o=>getOptionKeyAndName(o).key;void 0!==current&&null!=index&&-1!==index||(current=set(key,getOptionKey(options[0])),index=0);var o=`${name}:${o=options[index],getOptionKeyAndName(o).name}[${index+1}/${options.length}]<点击切换`;return GM_registerMenuCommand(o,()=>{if(set(key,getOptionKey(options[index+1>=options.length?0:index+1])),onclick)try{onclick()}catch(e){console.log(`发生错误(${name}-${current}-onclick): `+e)}location.reload()}),index}
function onload(f){isLoaded?f():document.addEventListener("DOMContentLoaded",()=>f())}
function timeoutAfterLoad(f,t){onload(()=>setTimeout(()=>f(),t))}
function intervalAfterLoad(f,t,runOnFirst){onload(()=>{runOnFirst&&f(),setInterval(f,t)})}
function run(fts){void 0===fts&&(fts=features);for(const key of Object.keys(fts))try{const feature=fts[key];("boolean"==typeof feature.match&&1==feature.match||0!==feature.match.filter(m=>"string"==typeof m?null!==window.location.href.match(m):m.test(window.location.href)).length)&&addFeature(key,feature)}catch(error){console.error("发生了一个意料之外的错误, 这可能是因为非法的feature所造成的, 不过请放心, 脚本将继续运行而不会崩溃. ",feature,error)}}
function addFeature(key,feature){var{name,values}=feature;if(!feature.switchable||get(key+"_switch",feature.default_switch_state??!0))if("$"===name||feature.directlyRun)try{"function"==typeof values?"string"==typeof(result=values(feature))&&style(result):"string"==typeof values&&style(values)}catch(e){console.error(e)}else{var result=Object.keys(values),key0=getOptionKeyAndName(result[0]).key;let current=get(key,key0),index=result.findIndex(x=>getOptionKeyAndName(x).key===current);-1!==index&&void 0!==index||(set(key,key0),index=0,current=key0),feature.hideInMenu||addMenu(name,key,result,current,index);try{var value=values[result[index]];if(null!=value)if("function"==typeof value){const result=value(feature);"string"==typeof result&&style(result)}else"string"==typeof value&&style(value)}catch(e){console.error(e)}}}
function findFastestSite(sites){return new Promise((resolve,reject)=>{let fastestSite=null,fastestTime=1/0,completedRequests=0;sites.forEach(function(site){const xhr=new XMLHttpRequest,startTime=(new Date).getTime();xhr.onreadystatechange=()=>{var timeElapsed;fastestTime<100&&(xhr.abort(),resolve(fastestSite)),xhr.readyState===XMLHttpRequest.DONE&&(timeElapsed=(new Date).getTime()-startTime,console.log(`Ping ${site} took ${timeElapsed}ms`),console.log("Status: "+xhr.status),xhr.status<400&&timeElapsed<fastestTime&&(fastestTime=timeElapsed,fastestSite=site),++completedRequests===sites.length)&&resolve(fastestSite)},xhr.onprogress=()=>{fastestTime<100&&(xhr.abort(),resolve(fastestSite))},xhr.onload=()=>{console.log("Pinging "+site)},xhr.open("GET",site,!0),xhr.timeout=2e3,xhr.send()})})}
function getConfigPage(){return findFastestSite(["https://user-script-config-form.vercel.app","https://yuhan-script-config.netlify.app","https://yuhanawa.github.io/tools/userscriptconfig/"]).then(fastestSite=>fastestSite).catch(error=>(console.error("Error:",error),null))}
function showConfigPage(){getConfigPage().then(fastestSite=>{void 0!==GM_openInTab?GM_openInTab(fastestSite,{active:!0}):location.href=fastestSite})}
function LoadConfigPage(name){console.log("LoadConfigPage "+name)}
function loadConfig(name,properties){GM_registerMenuCommand("在新窗口打开设置中心",()=>{showConfigPage()}),GM_registerMenuCommand("在页面内镶嵌设置中心(BETA)",()=>{loadconfigComponent()}),anchors=[];for(const key of Object.keys(properties))__props__.set(name+"_"+key,properties[key].default),key.startsWith("#")&&anchors.push({key:key,href:properties[key].href||key,title:properties[key].title||properties[key].description||key});void 0!==unsafeWindow.awa&&void 0!==unsafeWindow.awa.userscript||(unsafeWindow.awa={},unsafeWindow.awa.userscript={}),unsafeWindow.awa.current=name,unsafeWindow.awa.userscript[name]={props:properties,anchors:anchors,get:get,set:set}}
function loadconfigComponent(){unsafeWindow.useNewConfig=!0;var head=unsafeWindow.document.head,reactScript=document.createElement("script");reactScript.src="https://cdn.jsdelivr.net/npm/[email protected]/umd/react.production.min.js",head.appendChild(reactScript);const reactDOMScript=document.createElement("script");reactDOMScript.src="https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.production.min.js",head.appendChild(reactDOMScript);var commonStyles=document.createElement("link"),commonStyles=(commonStyles.rel="stylesheet",commonStyles.href="https://cdn.jsdelivr.net/gh/Yuhanawa/UserScript/config-component/dist/assets/css/common.css",head.appendChild(commonStyles),document.createElement("link")),commonStyles=(commonStyles.rel="stylesheet",commonStyles.href="https://cdn.jsdelivr.net/gh/Yuhanawa/UserScript/config-component/dist/assets/css/vendor.css",head.appendChild(commonStyles),document.createElement("link"));commonStyles.rel="stylesheet",commonStyles.href="https://cdn.jsdelivr.net/gh/Yuhanawa/UserScript/config-component/dist/assets/css/index.css",head.appendChild(commonStyles);const addscript=head=>{var indexModule=document.createElement("script"),indexModule=(indexModule.type="module",indexModule.crossOrigin=!0,indexModule.src="https://cdn.jsdelivr.net/gh/Yuhanawa/UserScript/config-component/dist/assets/js/index.js",head.appendChild(indexModule),document.createElement("script")),indexModule=(indexModule.type="module",indexModule.crossOrigin=!0,indexModule.src="https://cdn.jsdelivr.net/gh/Yuhanawa/UserScript/config-component/dist/assets/js/index.js",head.appendChild(indexModule),document.createElement("link")),indexModule=(indexModule.rel="modulepreload",indexModule.crossOrigin=!0,indexModule.href="https://cdn.jsdelivr.net/gh/Yuhanawa/UserScript/config-component/dist/assets/js/common.js",head.appendChild(indexModule),document.createElement("link"));indexModule.rel="modulepreload",indexModule.crossOrigin=!0,indexModule.href="https://cdn.jsdelivr.net/gh/Yuhanawa/UserScript/config-component/dist/assets/js/vendor.js",head.appendChild(indexModule),document.getElementById("config-component-root").appendChild(document.createElement("config-component"));const configPage=document.querySelector("#config-component-shadow"),container=configPage.querySelector("#config-component-root"),iframe=configPage.querySelector(".config-component");var pos1=0,pos2=0,pos3=0,pos4=0;
function elementDrag(e){(e=e||window.event).preventDefault(),pos1=pos3-e.clientX,pos2=pos4-e.clientY,pos3=e.clientX,pos4=e.clientY,container.style.top=container.offsetTop-pos2+"px",container.style.left=container.offsetLeft-pos1+"px"}
function closeDragElement(){iframe.style.pointerEvents="auto",configPage.onmouseup=null,configPage.onmousemove=null}container.onmousedown=function(e){(e=e||window.event).preventDefault(),pos3=e.clientX,pos4=e.clientY,iframe.style.pointerEvents="none",configPage.onmouseup=closeDragElement,configPage.onmousemove=elementDrag}};head=document.createElement("div"),head.id="config-component-shadow",document.body.appendChild(head),commonStyles=document.createElement("div");commonStyles.id="config-component-root",head.appendChild(commonStyles),reactScript.onload=()=>reactDOMScript.onload=()=>addscript(unsafeWindow.document.head)}
function receiveMessage(event) {
const data = event.data
switch (data.type) {
case "resizeIframe":
document.getElementById("ing_iframe").style.height = `${data.height}px`;
break;
default:
break;
}
}
unsafeWindow.addEventListener("message", receiveMessage, false);
function show_ing_iframe() {
if (document.getElementById("ing_iframe")) return;
timeoutAfterLoad(() => {
const iframe = document.createElement('iframe')
iframe.id = "ing_iframe"
iframe.src = "https://ing.cnblogs.com/"
document.querySelector('#main_flow').replaceChild(iframe, document.querySelector('#main_flow>.card'))
}, 50)
}
function getPage(url, obj) {
GM_xmlhttpRequest({
url: url,
method: 'GET',
overrideMimeType: `text/html; charset=${document.characterSet || document.charset || document.inputEncoding}`,
headers: {
'x-requested-with': 'XMLHttpRequest',
'Referer': location.href,
'User-Agent': navigator.userAgent,
'Accept': 'text/html,application/xhtml+xml,application/xml'
},
timeout: 10000,
onerror: (response) => {
console.error(`ERR: URL:${url}`, response);
},
ontimeout: (response) => {
console.warn(`TIMEOUT: URL:${url}`, response);
},
...obj
});
}
loadConfig('cnblogs', {".line_bc":{"widget":"line","title":"❗❗❗修改完记得点保存(在最下面)❗❗❗"},".line_sw":{"widget":"line","title":"❗开关还没做完❗"},"logo_switch":{"title":"LOGO替换","default":true,"widget":"switch","type":"boolean"},"menu_switch":{"title":"首页左侧菜单增强","default":true,"widget":"switch","type":"boolean"},"auto_pager_ing_switch":{"title":"闪存自动翻页开关","default":true,"widget":"switch","type":"boolean"}})
let features_cnblogs_1574814730 = {
cnblogs_side_right: {
name: "右侧吸底",
match: [
/www.cnblogs.com\/[^\/]*$/,
/www.cnblogs.com\/(sitehome|pick|candidate|subscription|following|aggsite|cate|comment)\//,
],
directlyRun: true,
switchable: true,
values: () => {
fn = () => {
const side = document.getElementById("side_right");
if (side && side.clientHeight > window.innerHeight)
side.style.top = `${window.innerHeight - side.clientHeight}px`;
else setTimeout(fn, 200);
};
timeoutAfterLoad(fn, 200);
},
},
cnblogs_menu: {
name: "sidenav",
match: [
/www.cnblogs.com\/[^\/]*$/,
/www.cnblogs.com\/(sitehome|pick|candidate|subscription|following|aggsite|cate|comment)\//,
],
directlyRun: true,
switchable: true,
values: () => {
onload(() => {
const sidenav = document.getElementsByClassName("sidenav")[0];
function insertNavItem(pos, id, href, title, icon) {
const li = document.createElement("li");
li.id = id;
li.className = "sidenav-item";
li.innerHTML = `<a href="${href}" title="${title}">
<img src="${icon}">
<span>${title}</span>
</a>`;
sidenav.insertAdjacentElement(pos, li);
return li;
}
const sidenav_ing = insertNavItem(
"afterBegin",
"sidenav_ing",
"#ing",
"闪存",
"https://assets.cnblogs.com/images/ing/lucky-star-3-1.png",
);
sidenav_ing.addEventListener("click", () => show_ing_iframe());
const sidenav_home = insertNavItem(
"afterBegin",
"sidenav_home",
"/",
"主页",
document.getElementById("user_icon").src,
);
if (/www.cnblogs.com\/#ing*$/.test(location.href)) {
sidenav_ing.className += " current-nav";
} else if (/www.cnblogs.com\/[^\/]*$/.test(location.href)) {
sidenav_home.className += " current-nav";
}
setTimeout(() => {
sidenav_home.querySelector("img").src =
document.getElementById("user_icon").src;
}, 320);
});
},
},
cnblogs_logo: {
name: "LOGO替换",
match: [
/www.cnblogs.com\/[^\/]*$/,
/www.cnblogs.com\/(sitehome|pick|candidate|subscription|following|aggsite|cate|comment)\//,
],
directlyRun: true,
switchable: true,
values:
".navbar-branding>a{background:url(//common.cnblogs.com/images/logo/logo20170227.png);background-size:contain;background-repeat:no-repeat;width:auto;height:36px;display:block;margin-left:8px}.navbar-branding>a>img{display:none!important}",
},
cnblogs_ing_in_iframe: {
name: "ing_in_iframe",
match: [/ing.cnblogs.com/],
directlyRun: true,
values: () => {
var style =
":root,:root #container,:root #container_content,:root #main,:root #wrapper,body,body #container,body #container_content,body #main,body #wrapper,html,html #container,html #container_content,html #main,html #wrapper{height:fit-content!important;scrollbar-width:0}:root .feed_body,body .feed_body,html .feed_body{display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-start}:root .feed_body:not(*),body .feed_body:not(*),html .feed_body:not(*){background:red}";
if (top === self) return style;
var style =
style +
"#app_bar,#footer,#goTop,#header,#right_sidebar,#top{display:none!important}#container,#container_content,#main,#wrapper,:root,body,html{width:100%;height:fit-content;margin:0;padding:0}.ing-item{display:flex;flex-direction:row;justify-content:space-around;align-items:flex-end;flex-wrap:nowrap}#user_ing_block{margin:24px 16px}";
var refreshHeight = () => {
unsafeWindow.parent.postMessage(
{
type: "resizeIframe",
height:
document.body.scrollHeight ?? document.body.clientHeight + 220,
},
"*",
);
};
const observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
// 遍历所有变化
if (mutation.type === "childList") {
refreshHeight();
} else if (mutation.type === "attributes") {
// 属性变化
}
});
});
onload(() => {
refreshHeight();
// 观察 #main 元素
observer.observe(document.getElementById("main"), {
childList: true,
attributes: false,
subtree: true,
});
});
timeoutAfterLoad(() => {
// if (!document.querySelector(".pager")) return
var timeout = 0;
setInterval(() => {
if (timeout > 0) timeout--;
}, 1000);
unsafeWindow.nextPage = nextPage;
document.querySelectorAll(".pager").forEach((el) => el.remove());
function receiveMessage(event) {
const data = event.data;
switch (data.type) {
case "nextPage":
nextPage();
break;
default:
break;
}
}
if (get("cnblogs_auto_pager_ing_switch")) {
unsafeWindow.addEventListener("message", receiveMessage, false);
}
function nextPage() {
if (timeout > 0) return;
timeout = 3;
IngListType = "All";
PageIndex = 2;
getPage(
`/ajax/ing/GetIngList?IngListType=${IngListType}&PageIndex=${PageIndex}&PageSize=30&Tag=&_=${Date.now()}`,
{
onload: (response) => {
try {
const doc = response.responseText;
document
.querySelector(".feed_block")
.insertAdjacentHTML("beforeend", doc);
document
.querySelectorAll(".feed_loading")
.forEach((el) => el.remove());
document
.querySelector(".feed_block")
.insertAdjacentHTML(
"beforeend",
`<div class="feed_loading"><img align="absmiddle" src="//assets.cnblogs.com/images/loading.gif" alt=""> 正在加载数据...</div>`,
);
PageIndex++;
} catch (e) {
console.error("ERR", e, response.responseText);
}
},
onerror: (response) => {
console.error(`ERR: URL:${url}`, response);
},
},
);
}
}, 400);
return style;
},
},
cnblogs_ing: {
name: "ing",
match: [/www.cnblogs.com\/#ing*$/],
directlyRun: true,
values: () => {
show_ing_iframe();
if (get("cnblogs_auto_pager_ing_switch")) {
setInterval(() => {
if (
document.body.offsetHeight - window.scrollY - window.innerHeight <
window.innerHeight * 2
) {
document
.getElementById("ing_iframe")
.contentWindow.postMessage({ type: "nextPage" }, "*");
}
}, 2000);
}
},
},
cnblogs_better_skin: {
name: "better_skin",
match: true,
directlyRun: true,
switchable: true,
values:
'.skin-lessismoreright #blogTitle{display:flex;flex-direction:row;flex-wrap:wrap;align-content:stretch;justify-content:center;align-items:baseline;padding:12px}.skin-lessismoreright #blogTitle .title:after{content:" | ";white-space:pre}.skin-lessismoreright #blogTitle .subtitle{font-size:15.5pt;color:#222}.skin-lessismoreright #blogTitle .subtitle::before{content:" ";white-space:pre}.skin-lessismoreright #main{padding:4px 20px}.skin-lessismoreright #main .post .postTitle{border-bottom:1px solid rgba(66,119,206,.5333333333);border-bottom-style:dashed;font-size:24px;font-weight:700;margin:20px 0 12px;width:fit-content}.skin-lessismoreright #main .post .postBody{color:rgba(0,0,0,.9882352941);font-size:15px;line-height:25px;font-family:-apple-system,PingFangSC-Regular,Pingfang SC,Hiragino Sans GB,Noto Sans,system-ui,BlinkMacSystemFont,Microsoft YaHei,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans",simsun,arial,helvetica,"Helvetica Neue",sans-serif}.skin-lessismoreright #main .post #blog_post_info{height:fit-content;width:-webkit-fill-available;display:inline-flex;flex-direction:row;justify-content:space-between}.skin-lessismoreright #main .post #blog_post_info #author_profile{border:1px solid #ccc;background:#f0f8ff;padding:12px 14px 0;width:fit-content;height:88px;border-radius:6px}.skin-lessismoreright #main .post #blog_post_info #author_profile a{text-decoration:none;color:rgba(0,0,0,.9882352941);font-size:14px;margin:2px}.skin-lessismoreright #main .post #blog_post_info #author_profile #author_profile_follow{position:relative;float:right;top:-18px}.skin-lessismoreright #main .post #blog_post_info #author_profile #author_profile_follow a{color:#06c}.skin-lessismoreright #main .post #blog_post_info #author_profile .author_avatar{margin-right:16px;border:1px solid rgba(128,128,128,.5019607843);border-radius:6px;width:64px}.skin-lessismoreright #main #blog-comments-placeholder .feedback_area_title{font-size:18px}.skin-lessismoreright #main #blog-comments-placeholder .layer{color:gray}.skin-lessismoreright #main #blog-comments-placeholder .blog_comment_body{font-size:15px;color:rgba(0,0,0,.9882352941)}.skin-lessismoreright .commentbox_main.comment_textarea{width:100%}#green_channel{padding:5px 0 15px;margin-bottom:10px;margin-top:10px;border:0;border-top:#eee 1px dashed;border-bottom:#eee 1px dashed;font-size:12px;width:100%!important;text-align:center;display:inline-block;vertical-align:middle}#green_channel_digg,#green_channel_favorite,#green_channel_follow{width:80px}#btn_comment_submit,#green_channel_digg,#green_channel_favorite,#green_channel_follow,#green_channel_wechat,#green_channel_weibo{text-decoration:none;color:#fff;margin:10px auto auto;height:30px;display:inline-block;line-height:30px;font-size:12px;font-weight:500;letter-spacing:2px;border-radius:3px;text-transform:uppercase;transition:all .4s;-webkit-transition:all .4s;-moz-transition:all .4s;-ms-transition:all .4s;-o-transition:all .4s;position:relative;background-image:none}#btn_comment_submit{width:80px}#green_channel_digg:hover,#green_channel_favorite:hover,#green_channel_follow:hover,#green_channel_wechat:hover,#green_channel_weibo:hover{transform:scale(1.02,1.02)}#green_channel_digg:active,#green_channel_favorite:active,#green_channel_follow:active,#green_channel_wechat:active,#green_channel_weibo:active{transform:scale(.95,.95);transition:all .4s -125ms}#green_channel_digg{background-color:#5c8ec6;box-shadow:0 15px 18px -6px rgba(95,193,206,.65)}#green_channel_follow{background-color:#e33100!important;box-shadow:0 15px 18px -6px rgba(227,49,0,.65);margin-left:10px}#green_channel_favorite{background-color:#ffb515;box-shadow:0 15px 18px -6px rgba(255,198,75,.65);margin-left:10px}#green_channel_wechat,#green_channel_weibo{background-color:#ff464b!important;box-shadow:0 15px 18px -6px rgba(255,70,75,.65)!important;margin-left:10px;width:45px}#green_channel_wechat{background-color:#3cb034!important;box-shadow:0 15px 18px -6px rgba(60,176,52,.65)!important}div#green_channel img{height:20px;width:20px}',
},
cnblogs_base: {
name: "美化",
match: [
/www.cnblogs.com\/[^\/]*$/,
/www.cnblogs.com\/(sitehome|pick|candidate|subscription|following|aggsite|cate|comment)\//,
],
directlyRun: true,
values:
'@charset "UTF-8";*{transition:all .1s}:root{--text-color-1:#202020;--text-color-2:#596172 // old: #555;--text-color-3:#555;--highlighted-color:#5e72e4;--theme-color:#5e72e4}#side_nav{position:sticky;top:8px}#side_nav .sidenav{width:fit-content;font-size:larger;padding-top:14px}#side_nav .sidenav .sidenav-item{margin:2px!important;padding:14px;border-radius:16px}#side_nav .sidenav .sidenav-item img{width:24px;height:24px}#side_nav .sidenav .sidenav-item:hover:not(.current-nav){background:rgba(204,204,204,.8)}#side_nav .sidenav .sidenav-item .dropdown-button>a{display:flex;align-items:center}#side_nav .sidenav .sidenav-category-active,#side_nav .sidenav .sidenav-item.current-nav{padding:14px!important;margin:2px 4px 2px 2px!important;font-weight:700}#side_nav .sidenav .sidenav-category-active img,#side_nav .sidenav .sidenav-item.current-nav img{width:26px;height:26px;box-shadow:inset 0 0 12px 32px rgba(205,255,255,.8509803922),-6px 3px 12px 6px rgba(0,255,255,.1215686275);border-radius:18px}#sidenav_more .dropdown-menu{left:6px;top:85%;font-size:large}#sidenav_more:hover .dropdown-menu{box-shadow:2px 5px 16px 4px #ccc}.post-list{border-top:1px dashed #dcdcdc;margin-top:20px}.post-list a{position:relative;color:#2d65b3!important}.post-list a,.post-list a:hover{text-decoration:none!important}.post-list a:hover:after{left:0!important;width:100%!important;transition:width 350ms!important}.post-list a:after{content:""!important;position:absolute!important;border-bottom:2px solid #f16d7a!important;bottom:-2px!important;left:100%!important;width:0!important;transition:width 350ms,left 350ms!important}.post-list a>em,.post-list a>strong{color:#f73131!important;text-decoration:none!important}.post-list .post-item .avatar{border-radius:4px;padding:0;border:1px solid rgba(34,34,34,.3333333333);margin-top:4px}.post-list>.post-item>.post-item-body>.post-item-text>.post-item-title,.post-list>.post-item>.post-item-body>.post-item-text>.post-item-title:link{color:var(--title-color-2);text-decoration:none;font-weight:500;font-size:19px}.post-list>.post-item>.post-item-body>.post-item-text>.post-item-title:focus,.post-list>.post-item>.post-item-body>.post-item-text>.post-item-title:hover,.post-list>.post-item>.post-item-body>.post-item-text>.post-item-title:link:focus,.post-list>.post-item>.post-item-body>.post-item-text>.post-item-title:link:hover{color:var(--highlighted-color);text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:2px;text-decoration-color:var(--highlighted-color);transition:all .15s ease-in-out}.post-list>.post-item>.post-item-body>.post-item-text>.post-item-summary{color:var(--text-color-3);margin-top:8px;font-size:15px;font-family:-apple-system,MiSans,Microsoft YaHei,Tahoma,Arial,"Helvetica Neue",Helvetica,"Nimbus Sans L",Arial,"Liberation Sans","PingFang SC","Hiragino Sans GB","Source Han Sans CN","Source Han Sans SC","Microsoft YaHei","Wenquanyi Micro Hei","WenQuanYi Zen Hei","ST Heiti",SimHei,"WenQuanYi Zen Hei Sharp",sans-serif}.card.headline{background:rgba(240,248,255,.8705882353);border-radius:16px;box-shadow:2px 2px 14px 1px rgba(240,248,255,.8705882353)}.card.headline a{font-size:14px;color:#003aae}.card.headline a:hover{text-decoration:none}.card.headline a:hover #text{text-decoration:underline}.card.headline .headline-label{font-size:16px;color:#4242fb}#side_right{position:sticky;top:-2200px;height:fit-content}#side_right #sidebar_bh{background:#fff;padding:8px 16px;border-radius:16px}#side_right #sidebar_bh a{display:inline-grid;align-content:space-evenly;justify-content:start;align-items:stretch;justify-items:start;color:rgba(34,34,34,.8666666667);font-size:14px;grid-row-gap:6px}#side_right #sidebar_bh a:hover{color:#222;font-style:italic;text-decoration:none}#side_right #sidebar_bh a:before{content:"博客园 VIP 会员";font-size:18px;font-weight:700}#side_right #sidebar_bh a:after{content:" G O ! >>";color:#fff;font-weight:bolder;background:#4378ff;border-radius:14px;padding:6px 8px;margin:0 0 2px;font-style:italic;box-shadow:2px 1px 8px 0#4378ff}.sidebar .card .card-title{margin-bottom:12px;color:#444;font-size:15px;font-weight:700}.sidebar .item-list li{font-size:14px;margin:8px 0}.sidebar .item-list li:hover{font-size:15px;margin:10px -1px;color:#4378ff}#top_nav{border-bottom:1px solid rgba(0,0,0,.05);box-shadow:0 2px 4px 0 rgba(0,0,0,.05);font-family:-apple-system,BlinkMacSystemFont,PingFang SC,"Segoe UI",Hiragino Sans GB,Arial,Microsoft YaHei,Verdana,Roboto,Noto,Helvetica Neue,ui-sans-serif}#ing_iframe{width:100%;min-height:100%;scroll-behavior:hidden;border:0;overflow:hidden}',
},
cnblogs_auto_pager_ing: {
name: "AutoPager",
match: [/www.cnblogs.com\/#ing*$/],
directlyRun: true,
switchable: true,
values: () => {
// 功能实现在ing_in_iframe中
},
},
cnblogs_auto_pager_home: {
name: "AutoPager",
match: [
/www.cnblogs.com\/[^\/]*$/,
/www.cnblogs.com\/(sitehome|pick|candidate|subscription|following|aggsite|cate|comment)\//,
],
directlyRun: true,
switchable: true,
values: () => {
timeoutAfterLoad(() => {
if (
!document.querySelector(".pager") ||
document.querySelector("#Autopage_number")
)
return;
var timeout = 0;
setInterval(() => {
if (timeout > 0) timeout--;
}, 1000);
unsafeWindow.nextPage = nextPage;
setInterval(() => {
if (!document.querySelector(".pager")) return;
if (
document.body.offsetHeight - window.scrollY - window.innerHeight <
window.innerHeight * 2
) {
nextPage();
}
}, 2000);
function nextPage() {
if (timeout > 0) return;
timeout = 3;
getPage(document.querySelector(".pager > a:nth-last-child(1)").href, {
onload: (response) => {
try {
const doc = new DOMParser().parseFromString(
response.responseText,
"text/html",
); //"text/html"
const articles = doc.querySelectorAll("#post_list>article");
for (const article of articles) {
document
.querySelector("#post_list")
.insertAdjacentElement("beforeend", article);
}
document
.querySelector(".pager")
.parentNode.replaceChild(
doc.querySelector(".pager"),
document.querySelector(".pager"),
);
} catch (e) {
console.error("ERR", e, response.responseText);
}
},
});
// GM_xmlhttpRequest({
// url: document.querySelector(".pager > a:nth-last-child(1)").href,
// method: 'GET',
// overrideMimeType: `text/html; charset=${document.characterSet || document.charset || document.inputEncoding}`,
// headers: {
// 'x-requested-with': 'XMLHttpRequest',
// 'Referer': location.href,
// 'User-Agent': navigator.userAgent,
// 'Accept': 'text/html,application/xhtml+xml,application/xml'
// },
// timeout: 10000,
// onload: (response) => {
// try {
// const doc = (new DOMParser()).parseFromString(response.responseText, "text/html");//"text/html"
// const articles = doc.querySelectorAll('#post_list>article')
// for (const article of articles) {
// document.querySelector('#post_list').insertAdjacentElement('beforeend', article)
// }
// document.querySelector('.pager').parentNode.replaceChild(doc.querySelector('.pager'), document.querySelector('.pager'))
// } catch (e) {
// console.error('ERR', e, response.responseText);
// }
// },
// onerror: (response) => {
// console.error(`ERR: URL:${url}`, response);
// },
// ontimeout: (response) => {
// console.warn(`TIMEOUT: URL:${url}`, response);
// }
// });
}
}, 400);
},
},
};
run(features_cnblogs_1574814730);