快速显示隐藏 boosts 脚本
- 内容介绍
- 文章标签
- 相关推荐
快速显示/隐藏boost,融入侧边栏。
image736×1302 17.3 KB
站里的另一个类似功能脚本。
纯 CSS 实现 Boost 自动折叠/展开功能 开发调优感觉 Boost 很多时,会分散注意力,影响阅读。 于是写了一个样式,实现 Boost 自动折叠/展开功能。 默认只显示两个 Boost,鼠标移到上面时,显示全部内容。 声明:本样式不会影响任何功能,隐藏任何内容。 建议使用 Stylus 安装,也可以用油猴脚本管理器安装。 有问题,欢迎随时反馈。 安装链接: Discourse - Collapse Boosts [SCR-2…
// ==UserScript==
// @name Linux.do 隐藏/显示 Boost
// @namespace http://tampermonkey.net/
// @version 0.1
// @match *://linux.do/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=linux.do
// @grant none
// ==/UserScript==
(()=>{
let d=document, ls=localStorage, w=window, K='ldo_h', H=ls.getItem(K)=='1';
let E='M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.4 78.1-95.4 92.9-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.8-35.7-46.1-87.7-92.9-131.1C433.5 68.8 368.8 32 288 32zM128 256a160 160 0 1 1 320 0 160 160 0 1 1 -320 0zm160-80a80 80 0 1 0 0 160 80 80 0 1 0 0-160z';
let S='M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zM223.1 149.5C248.6 126.2 282.7 112 320 112c79.5 0 144 64.5 144 144c0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3c0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1c-79.5 0-144-64.5-144-144c0-6.9 .5-13.6 1.4-20.2L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5L373 389.9z';
let st=d.head.appendChild(d.createElement('style'));
let U=()=>{ st.innerHTML=H?'.discourse-boosts__post-menu{display:none!important}':''; };
U();
let R=(b)=>{
b.innerHTML=`<svg class="fa d-icon svg-icon fa-width-auto svg-string" width="1em" height="1em" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${H?576:640} 512"><path fill="currentColor" d="${H?E:S}"/></svg> <span class="d-button-label">${H?'显示 Boost':'隐藏 Boost'}</span>`;
};
let I=()=>{
let c=d.querySelector('.timeline-footer-controls');
if(!c || d.getElementById('ldo-b')) return;
let b=d.createElement('button');
b.id='ldo-b';
b.className='btn btn-icon-text btn-default btn-small';
b.type='button';
R(b);
b.onclick=()=>{ ls.setItem(K,H=H?'':'1'); U(); R(b); };
c.prepend(b);
};
new MutationObserver(I).observe(d.body,{childList:true,subtree:true});
w.addEventListener('storage',e=>{
if(e.key==K){ H=e.newValue=='1'; U(); let b=d.getElementById('ldo-b'); if(b) R(b); }
});
})();
网友解答:
--【壹】--:
大水哥今天你的大a怎么样,起飞了吗哈哈哈
--【贰】--:
最终还是大帅哥拯救了零回复。 其实一开始想写成悬浮按钮的,怎么看怎么丑,干脆改成融合了
--【叁】--:
这个好诶,完美融入了,你不说我都没发现。
快速显示/隐藏boost,融入侧边栏。
image736×1302 17.3 KB
站里的另一个类似功能脚本。
纯 CSS 实现 Boost 自动折叠/展开功能 开发调优感觉 Boost 很多时,会分散注意力,影响阅读。 于是写了一个样式,实现 Boost 自动折叠/展开功能。 默认只显示两个 Boost,鼠标移到上面时,显示全部内容。 声明:本样式不会影响任何功能,隐藏任何内容。 建议使用 Stylus 安装,也可以用油猴脚本管理器安装。 有问题,欢迎随时反馈。 安装链接: Discourse - Collapse Boosts [SCR-2…
// ==UserScript==
// @name Linux.do 隐藏/显示 Boost
// @namespace http://tampermonkey.net/
// @version 0.1
// @match *://linux.do/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=linux.do
// @grant none
// ==/UserScript==
(()=>{
let d=document, ls=localStorage, w=window, K='ldo_h', H=ls.getItem(K)=='1';
let E='M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.4 78.1-95.4 92.9-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.8-35.7-46.1-87.7-92.9-131.1C433.5 68.8 368.8 32 288 32zM128 256a160 160 0 1 1 320 0 160 160 0 1 1 -320 0zm160-80a80 80 0 1 0 0 160 80 80 0 1 0 0-160z';
let S='M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zM223.1 149.5C248.6 126.2 282.7 112 320 112c79.5 0 144 64.5 144 144c0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3c0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1c-79.5 0-144-64.5-144-144c0-6.9 .5-13.6 1.4-20.2L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5L373 389.9z';
let st=d.head.appendChild(d.createElement('style'));
let U=()=>{ st.innerHTML=H?'.discourse-boosts__post-menu{display:none!important}':''; };
U();
let R=(b)=>{
b.innerHTML=`<svg class="fa d-icon svg-icon fa-width-auto svg-string" width="1em" height="1em" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${H?576:640} 512"><path fill="currentColor" d="${H?E:S}"/></svg> <span class="d-button-label">${H?'显示 Boost':'隐藏 Boost'}</span>`;
};
let I=()=>{
let c=d.querySelector('.timeline-footer-controls');
if(!c || d.getElementById('ldo-b')) return;
let b=d.createElement('button');
b.id='ldo-b';
b.className='btn btn-icon-text btn-default btn-small';
b.type='button';
R(b);
b.onclick=()=>{ ls.setItem(K,H=H?'':'1'); U(); R(b); };
c.prepend(b);
};
new MutationObserver(I).observe(d.body,{childList:true,subtree:true});
w.addEventListener('storage',e=>{
if(e.key==K){ H=e.newValue=='1'; U(); let b=d.getElementById('ldo-b'); if(b) R(b); }
});
})();
网友解答:
--【壹】--:
大水哥今天你的大a怎么样,起飞了吗哈哈哈
--【贰】--:
最终还是大帅哥拯救了零回复。 其实一开始想写成悬浮按钮的,怎么看怎么丑,干脆改成融合了
--【叁】--:
这个好诶,完美融入了,你不说我都没发现。

