Giter Site home page Giter Site logo

zhihudaily's People

Contributors

lord63 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

animfanis123

zhihudaily's Issues

三栏 UI 下,ajax 的链接位置不合适

鉴于这个问题在三栏 UI 下被发现,所以接下来的描述基于三栏 UI 界面,但不确定其他地方是否存在类似问题。

所有的 JS 文件在 body 标签末尾被引入,在网络缓慢的情况下,界面会在脚本加载完前被呈现出来。
又由于 ajax 的目标网址被直接放在了 a 标签的 href 属性中,所以在加载完脚本前用户点击链接的话,
会前往该地址,即显示出返回的 json 。:astonished:

改进建议:

  • 将 ajax 的脚本于界面前引入或
  • 将目标网址移出 href 属性

date in the database schema

int or string? I haven't touch the source code for a while, so I need time to decide to choose which one.

Organize the code

Make it work, make it better.

Now, it's time to make it better 😄

Use database.

之前都是直接向日报发请求的,现在既然我们已经有自己的数据库,那就切换到使用自己的数据库。一方面来说,页面相应速度会有所提升,二来服务也会稳定些(如果日报 API 跪,我那边就铁定跪了)。

首先切换过去的是文字和图片界面的之前天数的日报新闻访问。

关于当天的新闻的话,由于是动态更新的,暂时还是直接发请求,然后 cache 一下。这个涉及到文字,图片,分页和三栏 UI,到时候再细想一下怎么搞。存数据库估计就要定时任务去更新数据了。

Refactor zhihudaily v2

之前在 PR #18 中已经有过一次重构,优化了一下代码结构组织,使用 blueprint 和 application factory.
本次的重构重点应该是整个日报的逻辑方面。代码还是很糟糕 ;(

ideas

  • 整理下静态文件,有些可以丢cdn
  • 在dev环境下不要加载ga?
  • get the first news in db, not today's new
  • 升级flask
  • 重构图片ui和分页ui的单个的图片元素,抽出去macro?
  • 修正数据库中错误的图片链接的数据
  • try dotenv?
  • 换个部署的方式吧,比如upstart+nginx什么的

Need a way to show the sections

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": ""
        }
    ]
}

How to deal with today's news?

目前是直接向日报请求,然后加个缓存。考虑以后是否存数据库,如果真这样,views 和 fetch 脚本都是要改的。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.