lord63 / zhihudaily Goto Github PK
View Code? Open in Web Editor NEW又一个知乎日报的网页版... https://zhihudaily.lord63.com
License: MIT License
又一个知乎日报的网页版... https://zhihudaily.lord63.com
License: MIT License
Something like this on dribble
day | title | content
| title |
| title |
| title |
鉴于这个问题在三栏 UI 下被发现,所以接下来的描述基于三栏 UI 界面,但不确定其他地方是否存在类似问题。
所有的 JS 文件在 body 标签末尾被引入,在网络缓慢的情况下,界面会在脚本加载完前被呈现出来。
又由于 ajax 的目标网址被直接放在了 a 标签的 href 属性中,所以在加载完脚本前用户点击链接的话,
会前往该地址,即显示出返回的 json 。:astonished:
改进建议:
目前使用 cache 姿势不对:
复现方法:
首先访问 :http://zhihudaily.lord63.com/before/20151027?image=True
当再次 http://zhihudaily.lord63.com/before/20151027?image=False 时,由于 cache 原因,本应该是文字界面的却被定向回图片界面。route 中没有 image 参数,所以估计 cache 时不管的,认为是一样的。。。
We may need to change the CDN or use the static files directly.
int or string? I haven't touch the source code for a while, so I need time to decide to choose which one.
Make it work, make it better.
Now, it's time to make it better 😄
By JiangJi
之前都是直接向日报发请求的,现在既然我们已经有自己的数据库,那就切换到使用自己的数据库。一方面来说,页面相应速度会有所提升,二来服务也会稳定些(如果日报 API 跪,我那边就铁定跪了)。
首先切换过去的是文字和图片界面的之前天数的日报新闻访问。
关于当天的新闻的话,由于是动态更新的,暂时还是直接发请求,然后 cache 一下。这个涉及到文字,图片,分页和三栏 UI,到时候再细想一下怎么搞。存数据库估计就要定时任务去更新数据了。
The oldest news is on 20130519, if user input the url like this: http://zhihudaily.lord63.com/news/20010101, the database will complain about it. We need to deal with it.
脚本搓的连我都不好意思了。找个时间改进一下。。。
之前在 PR #18 中已经有过一次重构,优化了一下代码结构组织,使用 blueprint 和 application factory.
本次的重构重点应该是整个日报的逻辑方面。代码还是很糟糕 ;(
We need tests, seriously _(:3
Known sections:
{
"data": [
{
"description": "看别人的经历,理解自己的生活",
"id": 1,
"name": "深夜食堂",
"thumbnail": "http://pic4.zhimg.com/dd365bd4446ef227162f78cdc74a81e7.jpg"
},
{
"id": 2,
"thumbnail": "http://pic4.zhimg.com/84f456ba427df17b83a0e8a31225b4cc.jpg",
"name": "瞎扯",
"description": "随便扯扯,也能很有深度"
},
{
"thumbnail": "http://pic2.zhimg.com/f400869676a87d5368b8b6bd62bd9a51.jpg",
"description": "带你逛逛全世界",
"name": "知天下",
"id": 5
},
{
"description": "我喜欢假的",
"id": 6,
"name": "苗炜专栏",
"thumbnail": "http://pic4.zhimg.com/015cbf1daf2992e67350d33bdcb8c8ff.jpg"
},
{
"id": 12,
"thumbnail": "http://pic3.zhimg.com/91bcb46b18580762ffc1ed139a2e0235.jpg",
"name": "#知乎日报周末话题#",
"description": "来,聊聊天。"
},
{
"thumbnail": "http://pic1.zhimg.com/5e484346de18d1b3ad1182a00d4458bb.jpg",
"description": "一群爱应用的理想主义者发起的开放项目",
"name": "最美应用",
"id": 9
},
{
"id": 14,
"thumbnail": "http://p1.zhimg.com/85/9e/859ea4167c0af1d506c7e20b0de7a84b.jpg",
"name": "麻省理工科技评论",
"description": "关注即将商业化的技术创新,分享即将资本化的技术创业。"
},
{
"thumbnail": "http://p2.zhimg.com/1d/ab/1dab78da4b87dd85a7cf5a304da594bc.jpg",
"description": "关注智能汽车、智能硬件和设计创意",
"name": "硬科技",
"id": 8
},
{
"thumbnail": "http://pic3.zhimg.com/4d360740ba4b0dc677c8011d79a99bf6.jpg",
"description": "吃,很重要",
"name": "吃很重要",
"id": 3
},
{
"thumbnail": "http://pic1.zhimg.com/8c4e9df64eab10c746de5c4d4be8d837.jpg",
"description": "回顾一周 iOS 精品游戏",
"name": "鲜柚游戏周报",
"id": 10
},
{
"id": 11,
"thumbnail": "http://pic3.zhimg.com/68a872ae7989df74908e8d8d26a582d5.jpg",
"name": "豌豆荚设计奖",
"description": "每周发现一款优质应用"
},
{
"thumbnail": "http://p3.zhimg.com/b1/f4/b1f434425c0d8343571d1df357fb7818.jpg",
"description": "道听途说仅供参考",
"name": "小道消息",
"id": 7
},
{
"description": "精选每周 #知乎日报周末话题# 优秀评论",
"id": 15,
"name": "#周末话题优秀评论精选#",
"thumbnail": "http://p4.zhimg.com/3a/be/3abe47457e993ccf1cad2a3ce9f88218.jpg"
},
{
"description": "",
"id": 16,
"name": "整点儿新闻",
"thumbnail": "http://pic1.zhimg.com/7bdd5e9182cfd5d4aeaed3fcfb450627.jpg"
},
{
"id": 17,
"thumbnail": "http://pic2.zhimg.com/2c643e90b8eccf4e9a4dacc5e23ad264.jpg",
"name": "饿了",
"description": ""
}
]
}
为什么是 v1 呢,因为感觉要好几次的样子 _(:3J
You may need to create an account and star those articles you like.
目前是直接向日报请求,然后加个缓存。考虑以后是否存数据库,如果真这样,views 和 fetch 脚本都是要改的。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.