MCPcopy Index your code
hub / github.com/XIU2/UserScript / cleanSearch

Function cleanSearch

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

Source from the content-addressed store, hash-verified

1403
1404// 净化搜索热门
1405function cleanSearch() {
1406 if (!menu_value('menu_cleanSearch')) return
1407
1408 const el = document.querySelector('.SearchBar-input > input');
1409 const observer = new MutationObserver((mutationsList, observer) => {
1410 if (mutationsList[0].attributeName === 'placeholder' && mutationsList[0].target.placeholder != '') mutationsList[0].target.placeholder = '';
1411 });
1412 el.placeholder = '';
1413 observer.observe(el, { attributes: true });
1414 document.documentElement.appendChild(document.createElement('style')).textContent = '.AutoComplete-group > .SearchBar-label:not(.SearchBar-label--history), .AutoComplete-group > [id^="AutoComplete2-topSearch-"], .AutoComplete-group > [id^="AutoComplete3-topSearch-"] {display: none !important;}';
1415}
1416
1417
1418// 快捷关闭悬浮评论(监听点击事件,点击网页两侧空白处)

Callers 1

startFunction · 0.85

Calls 1

menu_valueFunction · 0.70

Tested by

no test coverage detected