update
- add cr_version_test - remove track config - remove comment_cache and horizontal_scroll config
This commit is contained in:
@@ -33,6 +33,10 @@
|
||||
_czc.push(["_setCustomVar","has_token",localStorage['TOKEN']?'yes':'no',1]);
|
||||
_czc.push(["_setCustomVar","standalone",((window.matchMedia('(display-mode: standalone)').matches) || (window.navigator.standalone))?'yes':'no',1]);
|
||||
_czc.push(["_setCustomVar","build_info","%REACT_APP_BUILD_INFO%"||'---']);
|
||||
var cr_version=/Chrome\/(\d+)/.exec(navigator.userAgent);
|
||||
_czc.push(["_setCustomVar","cr_version_test",cr_version?cr_version[1]:'[null]',2]);
|
||||
/*
|
||||
// track config
|
||||
try {
|
||||
var config=JSON.parse(localStorage['hole_config']||'{}');
|
||||
for(var key in config)
|
||||
@@ -42,6 +46,7 @@
|
||||
} catch(e) {
|
||||
console.trace(e);
|
||||
}
|
||||
*/
|
||||
var cnzz_s_tag = document.createElement('script');
|
||||
cnzz_s_tag.type = 'text/javascript';
|
||||
cnzz_s_tag.async = true;
|
||||
|
||||
@@ -14,9 +14,7 @@ const DEFAULT_CONFIG={
|
||||
background_img: 'static/bg/gbp.jpg',
|
||||
background_color: '#113366',
|
||||
pressure: false,
|
||||
horizontal_scroll: true,
|
||||
easter_egg: true,
|
||||
comment_cache: false,
|
||||
color_scheme: 'default',
|
||||
};
|
||||
|
||||
@@ -223,7 +221,6 @@ export class ConfigUI extends PureComponent {
|
||||
<div>
|
||||
<div className="box config-ui-header">
|
||||
<p>这些功能仍在测试,可能不稳定(<a onClick={this.reset_settings.bind(this)}>全部重置</a>)</p>
|
||||
<p>我们会收集你的设置,以用于改进产品</p>
|
||||
<p><b>修改设置后 <a onClick={()=>{window.location.reload()}}>刷新页面</a> 方可生效</b></p>
|
||||
</div>
|
||||
<div className="box">
|
||||
@@ -235,14 +232,6 @@ export class ConfigUI extends PureComponent {
|
||||
description="短暂按住 Esc 键或重压屏幕(3D Touch)可以快速返回或者刷新树洞"
|
||||
/>
|
||||
<hr />
|
||||
<ConfigSwitch callback={this.save_changes_bound} id="horizontal_scroll" name="横向滚动"
|
||||
description="在树洞列表里横向滚动浏览回复,如果经常误触可以把它关掉"
|
||||
/>
|
||||
<hr />
|
||||
<ConfigSwitch callback={this.save_changes_bound} id="comment_cache" name="评论缓存"
|
||||
description="缓存已读树洞的评论(加载更快,但可能有bug)"
|
||||
/>
|
||||
<hr />
|
||||
<ConfigSwitch callback={this.save_changes_bound} id="easter_egg" name="允许彩蛋"
|
||||
description="在某些情况下显示彩蛋"
|
||||
/>
|
||||
|
||||
@@ -53,9 +53,6 @@
|
||||
padding-left: 18px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.flow-reply-row.config-no-scroll {
|
||||
overflow-x: hidden !important;
|
||||
}
|
||||
|
||||
.flow-reply-row::-webkit-scrollbar {
|
||||
display: none;
|
||||
|
||||
@@ -532,7 +532,7 @@ class FlowItemRow extends PureComponent {
|
||||
}}>
|
||||
<FlowItem parts={parts} info={this.state.info} attention={this.state.attention} img_clickable={false} is_quote={this.props.is_quote}
|
||||
color_picker={this.color_picker} show_pid={show_pid} replies={this.state.replies} />
|
||||
<div className={'flow-reply-row'+(window.config.horizontal_scroll ? '' : ' config-no-scroll')}>
|
||||
<div className="flow-reply-row">
|
||||
{this.state.reply_status==='loading' && <div className="box box-tip">加载中</div>}
|
||||
{this.state.reply_status==='failed' &&
|
||||
<div className="box box-tip"><a onClick={()=>{this.load_replies()}}>重新加载</a></div>
|
||||
|
||||
@@ -6,7 +6,6 @@ class Cache {
|
||||
constructor() {
|
||||
this.db=null;
|
||||
this.added_items_since_maintenance=0;
|
||||
if(window.config.comment_cache) {
|
||||
const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER);
|
||||
open_req.onerror=console.error.bind(console);
|
||||
open_req.onupgradeneeded=(event)=>{
|
||||
@@ -23,7 +22,6 @@ class Cache {
|
||||
setTimeout(this.maintenance.bind(this),1);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
get(pid,target_version) {
|
||||
return new Promise((resolve,reject)=>{
|
||||
@@ -35,15 +33,15 @@ class Cache {
|
||||
get_req.onsuccess=()=>{
|
||||
let res=get_req.result;
|
||||
if(!res) {
|
||||
console.log('cache miss');
|
||||
//console.log('comment cache miss '+pid);
|
||||
resolve(null);
|
||||
} else if(target_version===res.version) { // hit
|
||||
console.log('cache hit');
|
||||
console.log('comment cache hit '+pid);
|
||||
res.last_access=(+new Date());
|
||||
store.put(res);
|
||||
resolve(res.data);
|
||||
} else { // expired
|
||||
console.log('cache expired: ver',res.version,'target',target_version);
|
||||
console.log('comment cache expired '+pid+': ver',res.version,'target',target_version);
|
||||
store.delete(pid);
|
||||
resolve(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user