MCPcopy Create free account
hub / github.com/XIU2/UserScript / questionInvitation

Function questionInvitation

Zhihu-Enhanced.user.js:1577–1593  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1575
1576// 默认折叠邀请,修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript,且精简、优化了代码)
1577function questionInvitation(){
1578 let time = setInterval(function(){
1579 let q = document.querySelector('.QuestionInvitation-content'); if (!q) return
1580 clearInterval(time);
1581 q.style.display = 'none';
1582 document.querySelector('.QuestionInvitation-title').innerHTML = document.querySelector('.QuestionInvitation-title').innerText + '<span style="cursor: pointer; font-size: 14px; color: #919aae;"> 展开/折叠</span>'
1583 // 点击事件(展开/折叠)
1584 document.querySelector('.Topbar').onclick = function(){
1585 let q = document.querySelector('.QuestionInvitation-content')
1586 if (q.style.display == 'none') {
1587 q.style.display = ''
1588 } else {
1589 q.style.display = 'none'
1590 }
1591 }
1592 });
1593}
1594
1595// 屏蔽热榜杂项
1596function blockHotOther() {

Callers 1

startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected