Script Archived
This script has been archived by the author. The script may be no longer functional, and the author no longer maintains it. You cannot provide feedback for this script.
// ==UserScript==
// @name 油猴中文网个人优化
// @description 调整油猴中文网的页面风格,脚本页查看代码
// @namespace Sency
// @author Sency
// @version 1.1
// @match http*://bbs.tampermonkey.net.cn/*
// @grant none
// @run-at document-start
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function addStyle(css) {
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css.replace(/(^|\n|(?<=:))\s*|\s*(?={)/g, '');
document.head.appendChild(style);
return style;
}
addStyle(`
#pt, .wp.a_t, #toplistbox_7ree, .bm.lk > .bm_h.cl, #wp > a:nth-child(1), #wp > a:nth-child(2), .kmlineheight, .topico, .comiis_lbox, #pgt {
display: none !important;
}
#comiis_sousuo_menu, #comiis_key_menu {
position: fixed !important;
top: 50px !important;
}
#category_lk > ul > li:nth-child(1):before {
content: "友情链接";
font-weight: bold;
margin-right: 20px;
}
.comiis_width, .comiis_rk {
margin-left: 0 !important;
}
.comiis_lp {
padding-right: 0 !important;
}
.comiis_listinfo {
padding: 10px !important;
}
.comiis_pn_post {
position: absolute;
z-index: 1;
top: 70px;
left: calc(50% - 50px);
padding-top: 0 !important;
}`);
window.addEventListener('load', e => {
//顶部最新回复
const headUl = document.querySelector('.comiis_nvbox > ul');
headUl && headUl.insertAdjacentHTML('beforeEnd', `
<li>
<a href="https://bbs.tampermonkey.net.cn/forum.php?mod=guide&view=new" hiddenfocus="true">最新回复</a>
</li>`);
/*
//修复搜索框不消失
const sousuo = document.querySelector('#comiis_sousuo');
const sousuoMenu = document.querySelector('#comiis_sousuo_menu');
if (sousuo && sousuoMenu) {
sousuo.setAttribute('onmouseover', "showMenu({'ctrlid':this.id,'pos':'34!','ctrlclass':'on','duration':2});");
sousuo.removeAttribute('initialized');
sousuoMenu.removeAttribute('initialized');
}
//脚本页查看代码
const installLink = document.querySelector('.install-link');
const lastHelpLink = document.querySelector('a.install-help-link:last-of-type');
if (installLink && lastHelpLink) {
const id = installLink.href.match(/\/(\d+).user/)[1];
lastHelpLink.insertAdjacentHTML('afterEnd', `
<a class="install-help-link" style="background-color:red;" target="_blank" href="https://scriptcat.org/script-show-page/${id}/code">查看代码</a>`);
}
*/
});
})();