Interesting enough to find out the Reader function in Safari is actually Javascript and there are many interesting stuff from the 2000 line code:

* 5 main parts in the file:
* 1. define const
* 2. helper functions
* 3. CandidateElement
* 4. String Prototype extension
* 5. ReaderArticleFinder (main)
*
* findArticle: look for suggested candidate, otherwise look for others
* when looking for articles, check basic score of each elements (text length, text depth, id and class name, language)
* then cleanArticleNode: find pruneElements and remove them by shouldPruneElement: classname, textlength, imagearea, calculateLinkDensity
*

Way to call it:
* var ReaderArticleFinderJS = new ReaderArticleFinder(document);
* //var article = ReaderArticleFinderJS.findArticle();
* ReaderArticleFinderJS.isReaderModeAvailable();
* ReaderArticleFinderJS.prepareToTransitionToReader();

 

Blog also for this: http://joevennix.com/2011/05/09/Hacking-Safari-Reader.html

Understanding Safari Reader的更多相关文章

  1. 收藏这些Safari快捷键,让你的Mac浏览网页更加方便

    文章内容及图片来源于:知乎,如果涉及版权问题,请联系作者删除 文章收录于:风云社区(提供上千款各类mac软件的下载) Safari是Mac上的原生浏览器,功能自然很强大,现在每天在Mac上使用的最多的 ...

  2. APPLE-SA-2019-3-25-4 Safari 12.1

    APPLE-SA-2019-3-25-4 Safari 12.1 Safari 12.1 is now available and addresses the following: Safari Re ...

  3. Edge/Chrome/火狐/Safari/Opera和IE

    据DigitalTrends网站报道,谷歌Chrome浏览器性能远超竞争对手的时代已经成为过去.目前流行的浏览器水平基本相当.IE 11被Windows 10中的Edge浏览器取而代之.Mozilla ...

  4. What's New in iOS9 iOS9功能改进

    What's New in iOS9 This article summarizes the key developer-related features introduced in iOS 9, w ...

  5. iOS 9之SFSafariViewController

    金田( github 示例源码) 有时候需要在App内部打开一个网页,例如为了展示公司官网,产品列表信息,Facebook,微博等.以前都是使用 UIWebView,iOS 8引入了WKWebView ...

  6. APPLE-SA-2019-3-25-1 iOS 12.2

    APPLE-SA-2019-3-25-1 iOS 12.2 iOS 12.2 is now available and addresses the following: CFStringAvailab ...

  7. IE、FF、Safari、OP不同浏览器兼容报告

    IE.FF.Safari.OP不同浏览器兼容报告 1         浏览器内核简介 Trident IE浏览器(GreenBrowser绿色浏览器, 遨游浏览器....都是IE) Geckos Fi ...

  8. Understanding Virtual Memory

    Understanding Virtual Memory by Norm Murray and Neil Horman Introduction Definitions The Life of a P ...

  9. (转) Written Memories: Understanding, Deriving and Extending the LSTM

    R2RT   Written Memories: Understanding, Deriving and Extending the LSTM Tue 26 July 2016 When I was ...

随机推荐

  1. Many Easy Problem

    转自hwk0518,不胜感谢,侵删.

  2. python-day20--collections模块

    1.namedtuple: 生成可以使用名字来访问元素内容的tuple >>> from collections import namedtuple >>> Poi ...

  3. LeetCode 22. Generate Parentheses(构造)

    题目大意:给n个'(' 和 ')',构造出所有的长度为2*n并且有效的(可匹配的)字符串. 题目分析:这道题不难,可以直接搜索出所有可能的字符串,然后再逐一判断是否合法即可.但是还有更好的办法,实际上 ...

  4. quartz---的一个简单例子

    quartz---的一个简单例子 首先建立一个maven项目.jar工程即可.(提示:我前面有如何建立一个maven工程的总结以及maven环境的配置.) 1.建立好后点击到app中运行,--> ...

  5. 用 Spark 为 Elasticsearch 导入搜索数据

    越来越健忘了,得记录下自己的操作才行! ES和spark版本: spark-1.6.0-bin-hadoop2.6 Elasticsearch for Apache Hadoop 2.1.2 如果是其 ...

  6. Vue---vue-cli 中的proxyTable解决开发环境中的跨域问题

    使用vue+vue-cli+axios+element-ui开发后台管理系统时,遇到一个问题,后台给了一个接口,我这边用axios请求数据,控制台总是报405错误和跨域错误 错误 405? 没见过!! ...

  7. CF 459A && 459B && 459C && 459D && 459E

    http://codeforces.com/contest/459 A题 Pashmak and Garden 化简化简水题,都告诉平行坐标轴了,数据还出了对角线,后面两个点坐标给的范围也不错 #in ...

  8. EhLib 的 DbgridEh 影响 其他数据集的Open方法

    DbgridEh 对应数据集ADOTable1,其中有个字段 部门编码,另外增加查找字段比如 部门名称 ADOTable2对应查找数据集,包含 部门编码和 部门名称字段. ADOTable1 打开后, ...

  9. 对于for循环和while循环,两种形式的优缺点

    1.for循环 一般用于知道循环次数,并且for循环可以节省内存以及代码简洁,在循环语句中定义一个局部变量,循环结束后,局部变量就被释放了. ;val<=;val++) { sum+=val; ...

  10. Linux IO模式-阻塞io、非阻塞io、多路复用io

    一 概念说明 在进行解释之前,首先要说明几个概念: - 用户空间和内核空间 - 进程切换 - 进程的阻塞 - 文件描述符 - 缓存 I/O 用户空间与内核空间 现在操作系统都是采用虚拟存储器,那么对3 ...