From 1a623785e2e6738297081e6f55fe4a474313a353 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Wed, 30 Mar 2022 23:17:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=A0=87=E6=B3=A8=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Flows.js | 36 ++++++++++++++++++++++-------------- src/color_picker.js | 5 +++-- src/flows_api.js | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/Flows.js b/src/Flows.js index 985c515..95dcae4 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -1,17 +1,9 @@ import React, { PureComponent } from 'react'; import copy from 'copy-to-clipboard'; import { ColorPicker } from './color_picker'; -import { - split_text, - NICKNAME_RE, - PID_RE, - URL_RE, - URL_PID_RE, - TAG_RE, -} from './text_splitter'; +import { split_text, PID_RE } from './text_splitter'; import { format_time, - build_highlight_re, Time, TitleLine, ClickHandler, @@ -136,6 +128,9 @@ class Reply extends PureComponent { {info.author_title && ( {`"${info.author_title}"`} )} + {info.is_tmp && ( + 临时账号 + )} {!!do_delete && !!info.can_del && ( {!!is_quote && ( @@ -252,7 +248,13 @@ class FlowItem extends PureComponent { {/**/} )} -
+
{!!window.LATEST_POST_ID && parseInt(info.pid, 10) > window.LATEST_POST_ID && (
@@ -292,8 +294,11 @@ class FlowItem extends PureComponent { {info.author_title && ( {`"${info.author_title}"`} )} + {info.is_tmp && ( + 临时账号 + )} {info.is_reported && R } - {!!do_delete && !!info.can_del && ( + {!!do_delete && !!can_del && ( { @@ -316,10 +321,10 @@ class FlowItem extends PureComponent { {info.blocked_count && ( {info.blocked_count} )} - {info.cw !== null && (!do_edit_cw || !info.can_del) && ( + {info.cw !== null && (!do_edit_cw || !can_del) && ( {info.cw} )} - {!!do_edit_cw && !!info.can_del && ( + {!!do_edit_cw && !!can_del && (
)} {info.allow_search && 📢 } -
{!!info.hot_score && ( hot score: {info.hot_score} @@ -1081,6 +1086,9 @@ class FlowItemRow extends PureComponent { {this.props.info.author_title && ( {`"${this.props.info.author_title}"`} )} + {this.props.info.is_tmp && ( + 临时账号 + )} {this.props.info.cw !== null && ( {this.props.info.cw} )} diff --git a/src/color_picker.js b/src/color_picker.js index afcf240..691b325 100644 --- a/src/color_picker.js +++ b/src/color_picker.js @@ -8,9 +8,10 @@ export class ColorPicker { this.current_h = Math.random(); } - get(name) { + get(name, is_tmp = false) { name = name.toLowerCase(); - if (name === '洞主') return ['hsl(0,0%,97%)', 'hsl(0,0%,16%)']; + if (is_tmp) return ['hsl(0, 0%, 80%)', 'hsl(0, 0%, 30%)']; + if (name === '洞主') return ['hsl(0, 0%, 97%)', 'hsl(0, 0%, 16%)']; if (!this.names[name]) { this.current_h += golden_ratio_conjugate; diff --git a/src/flows_api.js b/src/flows_api.js index c7b0781..adb80ab 100644 --- a/src/flows_api.js +++ b/src/flows_api.js @@ -27,7 +27,7 @@ export const parse_replies = (replies, color_picker) => .sort((a, b) => parseInt(a.cid, 10) - parseInt(b.cid, 10)) .map((info) => { info.name = gen_name(info.name_id); - info._display_color = color_picker.get(info.name); + info._display_color = color_picker.get(info.name, info.is_tmp); info.variant = {}; return info; });