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. 使用nginx+dnsmasq解决同IP不同端口Session冲突问题

    由于一台服务器上需要部署多个项目,而我们的WEB项目因为用到框架都是一样的,导致同时运行,session相互冲突,这个登录后,那个就得重新登录,造成了使用不方便,原因是IP相同认为是同一个域,接收了B ...

  2. How do you add?(递推)

    题意:求将n分为k个数相加的种数. 如:n=20,k=2,则可分为: 0+20=20 1+19=20 2+18=20 ....... 20 +0=20 共21种方案. 解析:令f(n,m)表示将n分为 ...

  3. Oracle11g温习-第六章:控制文件

    2013年4月27日 星期六 10:33  .控制文件的功能和特点 1) [定义数据库当前物理状态] 2) [维护数据的一致性]  如果控制文件中的检查点与数据文件中的一致,则说明数据一致,可以启动到 ...

  4. learning docker steps(1) ----- docker 安装

    docker 安装 参考:https://docs.docker.com/install/linux/docker-ce/ubuntu/ 按如下指令可安装: $ sudo apt-get instal ...

  5. 若所有的参数皆需要类型转换——请为此采用non-member函数

    若所有的参数皆需要类型转换--请为此采用non-member函数 经常使用C++的程序猿(希望更多的程序媛),一般不会同意让classes支持类型转换,至于为什么,请看后续的博客.假如我们设计一个表示 ...

  6. 快速切题 acdream手速赛(6)A-C

    Sudoku Checker Time Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) Submi ...

  7. 51nod1269Devu and Flowers

    题解: 如果没有限制每一种花有多少,那么就是简单的排列组合问题. 那么我们强制让一些花一定都要选. 暴力搜索,然后组合数(逆元) 采用容斥原理来计算最后的答案 代码: #include<bits ...

  8. java基本类型的大小

    1个字节是8位byte 1字节short 2字节int 4字节long 8字节float 4字节double 8字节char 2字节boolean 1字节======================= ...

  9. windowns 下备份mysql数据库

    @echo off & setlocal ENABLEEXTENSIONS :: ---------- 配置项 ---------- :: 备份放置的路径,加 \ set BACKUP_PAT ...

  10. SharePoint SSS(Security Store Service)服务-PowerShell

    1. 获取SSS应用程序的标识 Get-SPServiceApplication 2. 获取指定的SSS应用程序实例 $sss = Get-SPServiceApplication -Identity ...