From 1ba059f07799b5a6d8b8177c628a49b0055566ab Mon Sep 17 00:00:00 2001 From: hole-thu Date: Sun, 3 Apr 2022 00:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E8=AF=8D=E4=BD=9C=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E8=AF=84=E8=AE=BA=E5=8C=BA=20&&=20=E9=9D=9E=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=A8=A1=E5=BC=8F=E5=8F=AF=E7=9C=8B=E8=A2=AB=E5=B1=8F?= =?UTF-8?q?=E8=94=BD=E6=B4=9E=20&&=20=E4=BF=AE=E5=A4=8D=E6=8A=98=E5=8F=A0?= =?UTF-8?q?=E6=97=B6=E6=9C=AA=E9=9A=90=E8=97=8F=E8=A2=AB=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Config.js | 10 +++++----- src/Flows.js | 47 +++++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/Config.js b/src/Config.js index 9c4906e..00985bc 100644 --- a/src/Config.js +++ b/src/Config.js @@ -29,7 +29,7 @@ const DEFAULT_CONFIG = { pressure: false, easter_egg: true, color_scheme: 'default', - block_words_v2: ['#天火', '#桃花石'], + block_words_v3: ['蜘蛛'], whitelist_cw: [], ipfs_gateway_list: [ 'https://.ipfs.dweb.link/', @@ -64,9 +64,9 @@ export function load_config() { if (config[key] !== undefined) config[key] = loaded_config[key]; }); - if (loaded_config['block_words']) { - config['block_words_v2'] = loaded_config['block_words'].concat( - config['block_words_v2'], + if (loaded_config['block_words_v2']) { + config['block_words_v3'] = loaded_config['block_words_v2'].concat( + config['block_words_v3'], ); } @@ -378,7 +378,7 @@ export class ConfigUI extends PureComponent { callback={this.save_changes_bound} /> */} info.text.includes(word)) && + !info.can_del; + this.color_picker = new ColorPicker(); return (
  + {has_block_words && 已屏蔽}
-
- -
+ {!has_block_words && ( +
+ +
+ )} ); } @@ -850,11 +857,13 @@ class FlowItemRow extends PureComponent { super(props); this.needFold = props.info.cw && - !props.search_param && window.config.whitelist_cw.indexOf('*') == -1 && window.config.whitelist_cw.indexOf(props.info.cw) == -1 && - props.mode !== 'attention' && - props.mode !== 'attention_finished'; + props.mode === 'list'; + this.has_block_words = + window.config.block_words_v3.some((word) => + props.info.text.includes(word), + ) && !props.info.can_del; this.color_picker = new ColorPicker(); this.state = { replies: props.info.comments @@ -863,12 +872,6 @@ class FlowItemRow extends PureComponent { reply_status: 'done', reply_error: null, info: Object.assign({}, props.info, { variant: {} }), - hidden: - (window.config.block_words_v2.some((word) => - props.info.text.includes(word), - ) && - !props.info.can_del) || - this.needFold, attention: props.info.attention, cached: true, // default no display anything }; @@ -954,7 +957,7 @@ class FlowItemRow extends PureComponent { } render() { - const { show_sidebar, token, search_param, is_quote } = this.props; + const { show_sidebar, token, search_param, is_quote, mode } = this.props; let show_pid = load_single_meta(show_sidebar, token, [this.state.info.pid]); let hl_rules = [['pid', PID_RE]]; @@ -1042,9 +1045,9 @@ class FlowItemRow extends PureComponent { ); - if (this.state.hidden) { + if (this.needFold || this.has_block_words) { return ( - this.needFold && ( + (!this.has_block_words || mode !== 'list') && (
{