File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// ==UserScript==
22// @name 全球主机交流论坛增强
3- // @version 1.1.8
3+ // @version 1.1.9
44// @author X.I.U
55// @description 自动签到(访问空间)、屏蔽用户(黑名单)、屏蔽关键词(帖子标题)、自动无缝翻页、自动显示帖子内隐藏回复、自动隐藏阅读权限 255 的帖子、快捷回到顶部(右键点击两侧空白处)、收起预览帖子(左键点击两侧空白处)
66// @match *://hostloc.com/*
378378 document . body . onclick = function ( event ) {
379379 if ( event . target == this ) {
380380 document . querySelectorAll ( '[id^="threadPreviewTR_"] .showhide' ) . forEach ( function ( el ) {
381- el . click ( )
381+ if ( el . parentNode . querySelector ( '[name="message"]' ) . value === '' ) { // 避免快速回复过程中误点收起了
382+ let parentElement = el . parentNode . parentNode . parentNode . parentNode . parentNode ,
383+ top = parentElement . offsetTop + parentElement . offsetParent . offsetTop + parentElement . offsetParent . offsetParent . offsetTop ; // 元素距离顶部的高度
384+ if ( top < document . documentElement . scrollTop ) window . scrollTo ( 0 , top ) // 帖子标题在上面时才会滚动到该帖子处
385+ el . click ( )
386+ }
382387 } ) ;
383388 }
384389 }
You can’t perform that action at this time.
0 commit comments