From 67e37973e269f2800c3c5e457c695851d85c5fe9 Mon Sep 17 00:00:00 2001 From: xmcp Date: Fri, 10 Jan 2020 12:35:16 +0800 Subject: [PATCH] update - add cr_version_test - remove track config - remove comment_cache and horizontal_scroll config --- public/index.html | 5 +++++ src/Config.js | 11 ----------- src/Flows.css | 3 --- src/Flows.js | 2 +- src/cache.js | 38 ++++++++++++++++++-------------------- 5 files changed, 24 insertions(+), 35 deletions(-) diff --git a/public/index.html b/public/index.html index 77e5f14..6aacca4 100644 --- a/public/index.html +++ b/public/index.html @@ -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; diff --git a/src/Config.js b/src/Config.js index fe851ea..cf5cb9f 100644 --- a/src/Config.js +++ b/src/Config.js @@ -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 {

这些功能仍在测试,可能不稳定(全部重置

-

我们会收集你的设置,以用于改进产品

修改设置后 {window.location.reload()}}>刷新页面 方可生效

@@ -235,14 +232,6 @@ export class ConfigUI extends PureComponent { description="短暂按住 Esc 键或重压屏幕(3D Touch)可以快速返回或者刷新树洞" />
- -
- -
diff --git a/src/Flows.css b/src/Flows.css index c289c10..6875333 100644 --- a/src/Flows.css +++ b/src/Flows.css @@ -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; diff --git a/src/Flows.js b/src/Flows.js index 8d39d2f..7609afa 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -532,7 +532,7 @@ class FlowItemRow extends PureComponent { }}> -
+
{this.state.reply_status==='loading' &&
加载中
} {this.state.reply_status==='failed' && diff --git a/src/cache.js b/src/cache.js index 44bbf61..c8debe7 100644 --- a/src/cache.js +++ b/src/cache.js @@ -6,23 +6,21 @@ 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)=>{ - console.log('comment cache db upgrade'); - const db=event.target.result; - const store=db.createObjectStore('comment',{ - keyPath: 'pid', - }); - store.createIndex('last_access','last_access',{unique: false}); - }; - open_req.onsuccess=(event)=>{ - console.log('comment cache db loaded'); - this.db=event.target.result; - setTimeout(this.maintenance.bind(this),1); - }; - } + const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER); + open_req.onerror=console.error.bind(console); + open_req.onupgradeneeded=(event)=>{ + console.log('comment cache db upgrade'); + const db=event.target.result; + const store=db.createObjectStore('comment',{ + keyPath: 'pid', + }); + store.createIndex('last_access','last_access',{unique: false}); + }; + open_req.onsuccess=(event)=>{ + console.log('comment cache db loaded'); + this.db=event.target.result; + setTimeout(this.maintenance.bind(this),1); + }; } get(pid,target_version) { @@ -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); }