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. Zepto常见问题

    Zepto遇到的问题 延时 总所周知,默认click事件,会有300ms的延时问题,Zepto的tap事件很好的解决了这个问题.但是也挖了一个大坑. 点透 Zepto的点透应该也是大家比较熟悉的了.当 ...

  2. C# 字符串 相关操作

    你或许知道你能使用String.Trim方法去除字符串的头和尾的空格,不幸运的是. 这个Trim方法不能去除字符串中间的C#空格. static void Main()         {       ...

  3. 将 HttpPostedFile 转换成 Image 或者 Bitmap

    代码如下: HttpFileCollection httpfiles = context.Request.Files; files = httpfiles[i]; Image im = Image.F ...

  4. SSH 远程端口转发

    既然"本地端口转发"是指绑定本地端口的转发,那么"远程端口转发"(remote forwarding)当然是指绑定远程端口的转发. 还是接着看上面那个例子,ho ...

  5. 使用SAE(VAE)检测信用卡欺诈——感觉误报率还是比较高啊 70%+误报 蛋疼

    from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScale ...

  6. (C/C++学习笔记) 十. 函数

    十. 函数 ● 基本概念 函数 函数定义 function definition: return_type function_name ( parameter list ) { Body of fun ...

  7. 1.4 C++内联函数(inline)

    参考:http://www.weixueyuan.net/view/6330.html C++语言新增关键字 inline,用于将一个函数声明为内联函数.在程序编译时,编译器会将内联函数调用处用函数体 ...

  8. java算法大全

    题一: /** * 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,  * 小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少对? * 分析:  * 第 ...

  9. CentOS 6.6安装postgresql9.6.6

    一.环境介绍 系统平台:CentOS release 6.6 (Final) Postgresql:postgresql-9.6.6 二.安装过程 1.安装依赖包 yum -y install gcc ...

  10. Cookie注入实战(非SQL注入)

    cookie注入原理其实很简单,就是利用了session机制中的特性,只能说是特性,不能算是漏洞. 这里简单的说下原理,session的机制就相当于你有一张蛋糕店的会员卡,这张会员卡就是你浏览器中的c ...