11// ==UserScript==
22// @name 全球主机交流论坛增强
3- // @version 1.3.0
3+ // @version 1.3.1
44// @author X.I.U
55// @description 自动签到(访问空间)、屏蔽用户(黑名单)、屏蔽关键词(帖子标题)、回帖小尾巴、自动无缝翻页、快捷回到顶部(右键点击两侧空白处)、收起预览帖子(左键点击两侧空白处)、预览帖子快速回复带签名、显示是否在线、显示帖子内隐藏回复、屏蔽阅读权限 255 帖子
66// @match *://hostloc.com/*
9292 var loginStatus = false ;
9393 if ( document . getElementById ( 'um' ) ) {
9494 loginStatus = true ;
95+ } else {
96+ loginStatus = getLoginStatus ( ) ;
9597 }
9698
9799 // 默认 ID 为 0
252254 // 自定义屏蔽用户
253255 function customBlockUsers ( ) {
254256 let nowBlockUsers = '' ;
255- GM_getValue ( 'menu_customBlockUsers' ) . forEach ( function ( item ) { nowBlockUsers = nowBlockUsers + '|' + item } )
257+ GM_getValue ( 'menu_customBlockUsers' ) . forEach ( function ( item ) { nowBlockUsers += '|' + item } )
256258 let newBlockUsers = prompt ( '编辑 [自定义屏蔽用户],刷新网页后生效\n(不同用户名之间使用 "|" 分隔,\n(例如:用户A|用户B|用户C,如果只有一个就不需要 "|" 了。' , nowBlockUsers . replace ( '|' , '' ) ) ;
257259 if ( newBlockUsers === '' ) {
258260 GM_setValue ( 'menu_customBlockUsers' , [ ] ) ;
305307 function blockUsers_vfastpost ( ) {
306308 let vfastpost = e => {
307309 if ( e . target . innerHTML && e . target . innerHTML . indexOf ( 'id="vfastpost"' ) > - 1 ) {
308- let listItem = e . target . querySelectorAll ( '[id^="post_"]' ) ;
310+ let listItem = e . target . querySelectorAll ( '.bm_c > [id^="post_"]' ) ;
309311 if ( listItem . length < 1 ) return
310312 listItem . forEach ( function ( item ) { // 遍历所有回复
311313 menu_value ( 'menu_customBlockUsers' ) . forEach ( function ( item1 ) { // 遍历用户黑名单
326328 // 自定义屏蔽关键词(帖子标题)
327329 function customBlockKeywords ( ) {
328330 let nowBlockKeywords = '' ;
329- GM_getValue ( 'menu_customBlockKeywords' ) . forEach ( function ( item ) { nowBlockKeywords = nowBlockKeywords + '|' + item } )
331+ GM_getValue ( 'menu_customBlockKeywords' ) . forEach ( function ( item ) { nowBlockKeywords += '|' + item } )
330332 let newBlockKeywords = prompt ( '编辑 [自定义屏蔽关键词],刷新网页后生效\n(不同关键词之间使用 "|" 分隔,\n(例如:助力|互助|互点,如果只有一个就不需要 "|" 了。' , nowBlockKeywords . replace ( '|' , '' ) ) ;
331333 if ( newBlockKeywords === '' ) {
332334 GM_setValue ( 'menu_customBlockKeywords' , [ ] ) ;
707709 }
708710 } ( i ) ;
709711 }
712+
713+
714+ // 通过 Cookie 来判断是否登录
715+ function getLoginStatus ( ) {
716+ let cookie = document . cookie . split ( ';' ) ;
717+ for ( let i = 0 ; i < cookie . length ; i ++ ) { if ( cookie [ i ] . trim ( ) . indexOf ( 'hkCM_2132_lip=' ) === 0 ) return true ; }
718+ return false ;
719+ }
710720} ) ( ) ;
0 commit comments