diff --git a/src/App.js b/src/App.js index 6cecffc..e5f7532 100644 --- a/src/App.js +++ b/src/App.js @@ -8,7 +8,7 @@ import {TokenCtx,ISOP_APPKEY} from './UserAction'; import ImasuguApp from './imasugu/src/App'; function DeprecatedAlert(props) { - if(['pkuhelper.pku.edu.cn','127.0.0.1','localhostx'].indexOf(document.domain)===-1) + if(['pkuhelper.pku.edu.cn','127.0.0.1','localhost'].indexOf(document.domain)===-1) return (
@@ -31,16 +31,6 @@ function DeprecatedAlert(props) {
); - if(props.token && props.token.startsWith('isop_')) - return ( -
-
-

树洞于2019年3月更新登录方式,原先登录已失效。

-

请按右上角的按钮,点“注销”,然后重新登录。

-

好消息:更新后支持客户端和网页同时使用了!

-
-
- ); return null; } diff --git a/src/Flows.js b/src/Flows.js index d29fa6a..8c6a420 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -19,11 +19,12 @@ const PREVIEW_REPLY_COUNT=10; window.LATEST_POST_ID=parseInt(localStorage['_LATEST_POST_ID'],10)||0; -function load_single_meta(show_sidebar,token) { +function load_single_meta(show_sidebar,token,parents) { return (pid)=>{ + let title_elem=; const color_picker=new ColorPicker(); show_sidebar( - '帖子详情', + title_elem,
正在加载 #{pid}
@@ -36,20 +37,20 @@ function load_single_meta(show_sidebar,token) { const [single,replies]=res; single.data.variant={}; show_sidebar( - '帖子详情', + title_elem, ) }) .catch((e)=>{ console.error(e); show_sidebar( - '帖子详情', + title_elem,
-

load_single_meta(show_sidebar,token)()}>重新加载

+

load_single_meta(show_sidebar,token,parents)(pid)}>重新加载

{''+e}

); @@ -115,7 +116,9 @@ class FlowItem extends PureComponent { }
- {parseInt(props.info.pid,10)>window.LATEST_POST_ID &&
} + {!!window.LATEST_POST_ID && parseInt(props.info.pid,10)>window.LATEST_POST_ID && +
+ }
{!!parseInt(props.info.likenum,10) && @@ -165,7 +168,6 @@ class FlowSidebar extends PureComponent { error_msg: null, }; this.color_picker=props.color_picker; - this.show_pid=load_single_meta(this.props.show_sidebar,this.props.token); this.syncState=props.sync_state||(()=>{}); this.reply_ref=React.createRef(); } @@ -282,6 +284,9 @@ class FlowSidebar extends PureComponent { render() { if(this.state.loading_status==='loading') return (

加载中……

); + + let show_pid=load_single_meta(this.props.show_sidebar,this.props.token,this.props.parents.concat([this.state.info.pid])); + return (
@@ -308,7 +313,7 @@ class FlowSidebar extends PureComponent {
{this.show_reply_bar('',e);}}> {this.set_variant(null,variant);}} /> @@ -327,7 +332,7 @@ class FlowSidebar extends PureComponent { {this.show_reply_bar(reply.name,e);}}> {this.set_variant(reply.cid,variant);}} /> @@ -344,6 +349,24 @@ class FlowSidebar extends PureComponent { } } +function FlowSidebarTitle(props) { + let last_pid=props.parents.length ? props.parents[props.parents.length-1] : null; + return ( + + 树洞  + {!!last_pid && + + load_single_meta(props.show_sidebar,props.token,props.parents.slice(0,-1))(last_pid)}> + #{last_pid} + +  →  + + } + #{props.pid} + + ); +} + class FlowItemRow extends PureComponent { constructor(props) { super(props); @@ -354,7 +377,6 @@ class FlowItemRow extends PureComponent { attention: false, }; this.color_picker=new ColorPicker(); - this.show_pid=load_single_meta(this.props.show_sidebar,this.props.token); } componentDidMount() { @@ -393,16 +415,18 @@ class FlowItemRow extends PureComponent { show_sidebar() { this.props.show_sidebar( - '帖子详情', + , ); } render() { + let show_pid=load_single_meta(this.props.show_sidebar,this.props.token,[this.state.info.pid]); + let hl_rules=[ ['url',URL_RE], ['pid',PID_RE], @@ -429,14 +453,14 @@ class FlowItemRow extends PureComponent { this.show_sidebar(); }}> + color_picker={this.color_picker} show_pid={show_pid} replies={this.state.replies} />
{this.state.reply_status==='loading' &&
加载中
} {this.state.reply_status==='failed' && } {this.state.replies.slice(0,PREVIEW_REPLY_COUNT).map((reply)=>( - + ))} {this.state.replies.length>PREVIEW_REPLY_COUNT &&
还有 {this.state.replies.length-PREVIEW_REPLY_COUNT} 条
diff --git a/src/Sidebar.js b/src/Sidebar.js index 8fb0e0f..9bbf3aa 100644 --- a/src/Sidebar.js +++ b/src/Sidebar.js @@ -7,7 +7,7 @@ export function Sidebar(props) {

-  ×  +    {props.title}

{props.content}