├── 201709 ├── origin.md ├── preface.md └── runtime.md ├── 201710 ├── eventloop.md ├── function.md ├── functional.md └── gc.md ├── 201711 ├── design.md ├── process.md └── this.md ├── .gitignore ├── GLOSSARY.md ├── LICENSE ├── README.md ├── SUMMARY.md ├── assets ├── 2017_09_01.png ├── 2017_09_02.jpg ├── 2017_09_03.jpg ├── 2017_09_04.jpg ├── 2017_09_05.jpg └── 2017_10_01.jpg ├── book.json ├── docs ├── 201709 │ ├── origin.html │ ├── preface.html │ └── runtime.html ├── 201710 │ ├── eventloop.html │ ├── function.html │ ├── functional.html │ └── gc.html ├── 201711 │ ├── design.html │ ├── process.html │ └── this.html ├── .gitignore ├── GLOSSARY.html ├── LICENSE ├── assets │ ├── 2017_09_01.png │ ├── 2017_09_02.jpg │ ├── 2017_09_03.jpg │ ├── 2017_09_04.jpg │ ├── 2017_09_05.jpg │ └── 2017_10_01.jpg ├── gitbook │ ├── fonts │ │ └── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ ├── gitbook-plugin-fontsettings │ │ ├── fontsettings.js │ │ └── website.css │ ├── gitbook-plugin-highlight │ │ ├── ebook.css │ │ └── website.css │ ├── gitbook-plugin-katex │ │ ├── fonts │ │ │ ├── KaTeX_AMS-Regular.eot │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.eot │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ ├── KaTeX_Caligraphic-Regular.eot │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ │ ├── KaTeX_Fraktur-Bold.eot │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.eot │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ ├── KaTeX_Main-Bold.eot │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ ├── KaTeX_Main-Italic.eot │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ ├── KaTeX_Main-Regular.eot │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.eot │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ ├── KaTeX_Math-Italic.eot │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ ├── KaTeX_Math-Regular.eot │ │ │ ├── KaTeX_Math-Regular.ttf │ │ │ ├── KaTeX_Math-Regular.woff │ │ │ ├── KaTeX_Math-Regular.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.eot │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ ├── KaTeX_SansSerif-Italic.eot │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Regular.eot │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ ├── KaTeX_Script-Regular.eot │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ ├── KaTeX_Size1-Regular.eot │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ ├── KaTeX_Size2-Regular.eot │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ ├── KaTeX_Size3-Regular.eot │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ ├── KaTeX_Size4-Regular.eot │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.eot │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ └── KaTeX_Typewriter-Regular.woff2 │ │ └── katex.min.css │ ├── gitbook-plugin-lunr │ │ ├── lunr.min.js │ │ └── search-lunr.js │ ├── gitbook-plugin-search │ │ ├── lunr.min.js │ │ ├── search-engine.js │ │ ├── search.css │ │ └── search.js │ ├── gitbook-plugin-sharing │ │ └── buttons.js │ ├── gitbook.js │ ├── images │ │ ├── apple-touch-icon-precomposed-152.png │ │ └── favicon.ico │ ├── style.css │ └── theme.js ├── index.html ├── package.json └── search_index.json └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /201709/origin.md: -------------------------------------------------------------------------------- 1 | # JavaScript 起源 2 | 3 | 在了解、学习一个东西时,了解其诞生的背景及历史是十分有必要的,这能让你多一个发展的维度去看待它。 4 | 5 | 布兰登·艾奇(Bremdan Eich),在 1995 年受聘于网景(Netscape)公司。当时网景公司急需一种网页脚本语言,使得浏览器可以与网页互动,Eich 用了 10 天的时间创造了 Javascript。 6 | 7 | 那 10 天 Eich 做的大概事情可以在 [Brendan Eich - JavaScript at 20](https://www.youtube.com/watch?v=83_rC1FesOI) 9:55 秒的时候看到。 8 | 9 | 总的来说他的设计思路是这样的 10 | 11 | ``` 12 | (1)借鉴 C 语言的基本语法; 13 | (2)借鉴 Java 语言的数据类型和内存管理; 14 | (3)借鉴 Scheme 语言,将函数提升到"第一等公民"(first class)的地位; 15 | (4)借鉴 Self 语言,使用基于原型(prototype)的继承机制。 16 | ``` 17 | Eich 说,JavaScript 是 C 语言和 Self 语言的结合,我想无论怎样 JavaScript 都难以摆脱它们的影子。 18 | 19 | 在 [Brendan Eich 2008 年的自述](https://brendaneich.com/2008/04/popularity/) 中,发现一句话 20 | 21 | > Yet here we are. The web must evolve, or die. So too with JS. 22 | 23 | 世界总是在变的,Flash 会被淘汰,IE6 也终于退休。短短 20 年,JavaScript 的分支也变得十分庞大起来,我们面临权衡抉择,选择适合自己的技能树 evolve, or die。 24 | 25 | 下一章开始,让我们直接上干货。 26 | 27 | ------ 28 | 29 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 -------------------------------------------------------------------------------- /201709/preface.md: -------------------------------------------------------------------------------- 1 | # 序章 2 | 3 | #### 起因 4 | 5 | 因为工作的原因,很多牛人就在你眼前。他们视野广阔、思想先进,不断的影响着自己,仿佛自己也变得这么 NB,然而现实往往打脸,落到实处发现自己还是有很多基础不扎实的地方。 6 | 7 | 这篇文章,将同大家一起深入地了解前端核心基础,提高自己的硬实力。 -------------------------------------------------------------------------------- /201709/runtime.md: -------------------------------------------------------------------------------- 1 | # JavaScript 语法解析、AST、V8、JIT 2 | 3 | #### JavaScript 是如何执行的 4 | 5 | 对于常见编译型语言(例如:Java)来说,编译步骤分为:词法分析->语法分析->语义检查->代码优化和字节码生成。 6 | 7 | 对于解释型语言(例如 JavaScript)来说,通过词法分析 -> 语法分析 -> 语法树,就可以开始解释执行了。 8 | 9 | ![](../assets/2017_09_01.png) 10 | 11 | 具体过程是这样的: 12 | 13 | 1.词法分析是将字符流(char stream)转换为记号流(token stream) 14 | 15 | ``` 16 | NAME "AST" 17 | EQUALS 18 | NAME "is Tree" 19 | SEMICOLON 20 | ``` 21 | 22 | 2.语法分析成 AST (Abstract Syntax Tree),你可以在这里试试 [http://esprima.org/](http://esprima.org/demo/parse.html#) 23 | 24 | 3.预编译,当JavaScript引擎解析脚本时,它会在预编译期对所有声明的变量和函数进行处理!并且是先预声明变量,再预定义函数! 25 | 26 | 4.解释执行,在执行过程中,JavaScript 引擎是严格按着作用域机制(scope)来执行的,并且 JavaScript 的变量和函数作用域是在定义时决定的,而不是执行时决定的。JavaScript 中的变量作用域在函数体内有效,无块作用域; 27 | 28 | ``` javascript 29 | function func(){ 30 | for(var i = 0; i < array.length; i++){ 31 | //do something here. 32 | } 33 | //此时 i 仍然有值,及 i == array.length 34 | console.log(i); // 但在 java 语言中,则无效 35 | } 36 | ``` 37 | JavaScript 引擎通过作用域链(scope chain)把多个嵌套的作用域串连在一起,并借助这个链条帮助 JavaScript 解释器检索变量的值。这个作用域链相当于一个索引表,并通过编号来存储它们的嵌套关系。当 JavaScript 解释器检索变量的值,会按着这个索引编号进行快速查找,直到找到全局对象(global object)为止,如果没有找到值,则传递一个特殊的 undefined 值。 38 | ``` javascript 39 | var scope = "global"; 40 | scopeTest(); 41 | function scopeTest(){ 42 | console.log(scope); 43 | var scope = "local"; 44 | console.log(scope); 45 | } 46 | 打印结果:undefined,local; 47 | ``` 48 | 49 | #### V8、JIT 50 | 51 | 我们常说的 V8 是 Google 发布的开源 JavaScript 引擎,采用 C++ 编写。SpiderMonkey(Mozilla,基于 C)、Rhino(Mozilla,基于 Java),而 Nodejs 依赖于 V8 引擎开发,接下来的内容是 JavaScript 在 V8 引擎中的运行状态,而类似的 JavaScript 现代引擎对于这些实现大同小异。 52 | 53 | 在本文的开头提到了编译型语言,解释型语言。JavaScript 是解释型语言且`弱类型`,在生成 AST 之后,就开始一边解释,一边执行,但是有个弊端,当某段代码被多次执行时,它就有了可优化的空间(比如类型判断优化),而不用一次次的去重复之前的解释执行。 54 | 编译型语言如 JAVA,可以在执行前就进行优化编译,但是这会耗费大量的时间,显然不适用于 Web 交互。 55 | 56 | 于是就有了,JIT(Just-in-time),JIT 是两种模式的混合。 57 | 58 | ![](../assets/2017_09_02.jpg) 59 | 60 | 它是如何工作的呢: 61 | 62 | 1.在 JavaScript 引擎中增加一个监视器(也叫分析器)。监视器监控着代码的运行情况,记录代码一共运行了多少次、如何运行的等信息,如果同一行代码运行了几次,这个代码段就被标记成了 “warm”,如果运行了很多次,则被标记成 “hot”。 63 | 64 | 2.(基线编译器)如果一段代码变成了 “warm”,那么 JIT 就把它送到基线编译器去编译,并且把编译结果存储起来。比如,监视器监视到了,某行、某个变量执行同样的代码、使用了同样的变量类型,那么就会把编译后的版本,替换这一行代码的执行,并且存储。 65 | 66 | 3.(优化编译器)如果一个代码段变得 “hot”,监视器会把它发送到优化编译器中。生成一个更快速和高效的代码版本出来,并且存储。例如:循环加一个对象属性时,假设它是 INT 类型,优先做 INT 类型的判断 67 | 68 | 4.(去优化)可是对于 JavaScript 从来就没有确定这么一说,前 99 个对象属性保持着 INT 类型,可能第 100 个就没有这个属性了,那么这时候 JIT 会认为做了一个错误的假设,并且把优化代码丢掉,执行过程将会回到解释器或者基线编译器,这一过程叫做去优化。 69 | 70 | ###### 优化代码图例: 71 | 72 | “hot” 代码 73 | 74 | ![](../assets/2017_09_03.jpg) 75 | 76 | 优化前 77 | 78 | ![](../assets/2017_09_04.jpg) 79 | 80 | 优化后 81 | 82 | ![](../assets/2017_09_05.jpg) 83 | 84 | 85 | #### 总结 86 | 87 | 明白一些基本原理能拓展出更多的东西,比如: 88 | 89 | 1.var a = 10; var b = 20; ==> var a=10, b=20; 这些改代码的好处是什么,如何从原理解释? 90 | 91 | 2.JavaScript 的函数和变量是在什么时候声明的,函数声明和函数表达式的区别? 92 | 93 | 3.如何通过编译器的优化原理,如何提高 JavaScript 的执行效率? 94 | 95 | ------ 96 | 97 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 -------------------------------------------------------------------------------- /201710/eventloop.md: -------------------------------------------------------------------------------- 1 | # Event Loop 2 | 3 | 本文以 Node.js 为例,讲解 Event Loop 在 Node.js 的实现,[原文](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/),JavaScript 中的实现大同小异。 4 | 5 | #### 什么是 Event Loop ? 6 | 7 | 单线程的 Node.js 能够实现`无阻塞IO`的原因就是事件循环(Event Loop)。 8 | 9 | 现在大多数系统内核是多线程的,所以它们可以在后台执行多个操作,当这些操作完成时,内核就会通知 Node.js,而这些操作的回调函数被添加到事件轮询列表(poll queue),并且 Node.js 会在适当的时机执行回调函数。 10 | 11 | #### 概览 Event Loop 12 | 13 | 当 Node.js 开始执行时,便初始化 Event Loop,执行过程中会存在许多异步操作,如:REPL、定时器(timers)、调用异步 API(请求,事件监听),`在主进程代码执行完后,便开始运行 Event Loop`。 14 | 15 | 下图描述了 Event Loop 中的各个阶段 16 | 17 | ``` 18 | ┌───────────────────────┐ 19 | ┌─>│ timers │ 这个阶段执行 `setTimeout()` 和 `setInterval()` 中的回调函数 20 | │ └──────────┬────────────┘ 21 | │ ┌──────────┴────────────┐ 22 | │ │ I/O callbacks │ 这个阶段执行除了 `close` 回调函数以外的几乎所有的 I/0 回调函数 23 | │ └──────────┬────────────┘ 24 | │ ┌──────────┴────────────┐ 25 | │ │ idle, prepare │ 这个阶段仅仅 Node.js 内部使用 26 | │ └──────────┬────────────┘ ┌───────────────┐ 27 | │ ┌──────────┴────────────┐ │ incoming: │ 28 | │ │ poll │<─────┤ connections, │ 执行队列中的回调函数、检索新的回调函数 29 | │ └──────────┬────────────┘ │ data, etc. │ 30 | │ ┌──────────┴────────────┐ └───────────────┘ 31 | │ │ check │ `setImmediate()` 将在这里被调用 32 | │ └──────────┬────────────┘ 33 | │ ┌──────────┴────────────┐ 34 | └──┤ close callbacks │ `close` 回调函数被调用如:socket.on('close', ...) 35 | └───────────────────────┘ 36 | ``` 37 | 38 | #### 详解 Event Loop 的各个阶段 39 | 40 | ###### timers 41 | 42 | setTimeout() 和 setInterval() 都要指定一个运行时间,这个运行时间其实不是确切的运行时间,而是一个期望时间,Event Loop 会在 timers 阶段执行超过期望时间的定时器回调函数,但由于你不确定在其他阶段甚至主进程中的事件执行时间,所以定时器不一定会按时执行。 43 | 44 | ``` javascript 45 | var asyncApi = function (callback) { 46 | setTimeout(callback, 90) 47 | } 48 | 49 | const timeoutScheduled = Date.now(); 50 | setTimeout(() => { 51 | const delay = Date.now() - timeoutScheduled; 52 | console.log(`${delay}ms setTimeout 被执行`); // 140ms 之后被执行 53 | }, 100); 54 | 55 | asyncApi(() => { 56 | const startCallback = Date.now(); 57 | while (Date.now() - startCallback < 50) { 58 | // do nothing 59 | } 60 | }) 61 | ``` 62 | 63 | ###### I/O callbacks 64 | 65 | 这个阶段主要执行一些系统操作带来的回调函数,如 TCP 错误,如果 TCP 尝试链接时出现 `ECONNREFUSED` 错误 ,一些 *nix 会把这个错误报告给 Node.js。而这个错误报告会先进入队列中,然后在 I/O callbacks 阶段执行。 66 | 67 | ###### poll 68 | 69 | poll 阶段有两个主要功能: 70 | 71 | 1. 也会执行时间定时器到达期望时间的回调函数 72 | 2. 执行事件循环列表(poll queue)里的函数 73 | 74 | 当 Event Loop 进入 poll 阶段并且没有其余的定时器,那么: 75 | - 如果事件循环列表`不为空`,则迭代同步的执行队列中的函数。 76 | - 如果事件循环列表`为空`,则判断是否有 `setImmediate()` 函数待执行。如果有结束 `poll` 阶段,直接到 77 | `check` 阶段。如果没有,则等待回调函数进入队列并立即执行。 78 | 79 | ###### check 80 | 81 | 在 poll 阶段结束之后,执行 `setImmediate()`。 82 | 83 | ###### close 84 | 85 | 突然结束的事件的回调函数会在这里触发,如果 `socket.destroy()`,那么 `close` 会被触发在这个阶段,也有可能通过 `process.nextTick()` 来触发。 86 | 87 | #### setImmediate()、setTimeout()、process.nextTick() 88 | 89 | 这里要说明一下 `process.nextTick()` 是在下次事件循环之前运行,如果把 `process.nextTick()` 和 `setImmediate()` 写在一起,那么是 `process.nextTick()` 先执行。`next` 比 `immediate` 快,官方也说这个函数命名有问题,但是因为历史存留没办法解决。 90 | 91 | ``` 92 | process.nextTick(() => { 93 | console.log('nextTick'); 94 | }); 95 | setImmediate(() => { 96 | console.log('setImmediate'); 97 | }); 98 | setTimeout(() => { 99 | console.log('setTimeout'); 100 | }, 0) 101 | 102 | // 执行结果,nextTick, setTimeout, setImmediate 103 | // 查看 Node.js 源码,setTimeout(fun, 0) 会转化成 setTimeout(fun, 1),所以在这种简单的情况下,对于不同设备,setImmediate 有可能早于 setTimeout 执行。 104 | ``` 105 | 106 | #### 总结 107 | 108 | 理解事件循环,会知道 JavaScript 如何无阻塞运行的,以及它简洁的开发思路和事件驱动风格。 109 | 110 | ------ 111 | 112 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 -------------------------------------------------------------------------------- /201710/function.md: -------------------------------------------------------------------------------- 1 | # 递归、闭包、原型、继承 2 | 3 | 本文主要讲解、理清一些函数常用的知识点:递归、闭包是什么、闭包使用场景、什么是原型和原型链、如何实现继承、继承的原理。 4 | 5 | #### 递归 6 | 7 | 函数的递归就是在函数中调用自身 8 | 9 | 举一个实例,著名斐波那契数列如何求得,问题是这样的: 10 | 11 | 1. 第一个月初有一对刚诞生的兔子 12 | 2. 第二个月之后(第三个月初)它们可以生育 13 | 3. 每月每对可生育的兔子会诞生下一对新兔子 14 | 4. 兔子永不死去 15 | 16 | 定义出来的数列是 17 | 18 | ![](../assets/2017_10_01.jpg) 19 | 20 | 我们需要求得 n 月有多少对兔子,通过递归算法可以求得 21 | 22 | ``` javascript 23 | function fn(n) { 24 | return n < 2 ? 1 : fn(n - 1) + fn(n - 2) 25 | } 26 | var count = fn(30); 27 | console.log(count); 28 | ``` 29 | 30 | #### 闭包 31 | 32 | 什么是闭包?闭包就是函数,它可以继承并访问自身所被声明的函数作用域内的变量。 33 | 34 | ``` javaScript 35 | function fn1 () { 36 | var a = 'hello' 37 | function fn2 () { 38 | console.log(a) 39 | } 40 | } 41 | fn1() // 其中 fn2 就是闭包函数 42 | ``` 43 | 44 | #### 闭包的使用场景 45 | 46 | 闭包有很多使用场景,以下举例: 47 | 48 | ###### 1. 私有变量 49 | 50 | ``` javascript 51 | function Person(){ 52 | var name = "default"; 53 | return { 54 | getName : function(){ 55 | return name; 56 | }, 57 | setName : function(newName){ 58 | name = newName; 59 | } 60 | } 61 | }; 62 | var person = Person() 63 | console.log(person.getName()) // default 64 | person.setName('xiaomuchen') 65 | console.log(person.getName()) // xiaomuchen 66 | var person2 = Person() 67 | console.log(person2.getName()) // default 68 | ``` 69 | 70 | 上述函数,使用闭包创建私有变量 name,变量不可被外部直接操作、获取,只能通过返回的接口控制。 71 | 72 | 73 | ###### 2. 匿名自执行函数 74 | 75 | 比如在开发页面时,需要在页面初始化时,你需要立即做一些操作,那么可以在页面中使用`匿名自执行函数`,它会在 JS 引擎读取到这部分代码时就立即执行。 76 | 77 | ``` javascript 78 | // 在 title 上添加页面打开时间 79 | (function(){ 80 | var openTime = new Date() 81 | document.title = document.title + openTime 82 | })(); 83 | ``` 84 | 85 | #### 原型、原型链、继承 86 | 87 | 先问一个问题:\_\_proto\_\_ 和 prototype 会出现在什么地方?它们之间是什么关系?实现继承依赖什么? 88 | 89 | ###### \_\_proto\_\_ 和 prototype 的区别 90 | 91 | 1.JavaScript 中每一个对象都拥有原型链(\_\_proto\_\_)指向其构造函数的原型(prototype) 92 | 93 | ```javascript 94 | var a = {} 95 | a.__proto__ === Object.prototype // true 96 | 97 | function Person () {} 98 | Person.__proto__ === Function.prototype // true 99 | 100 | var p = new Person() 101 | p.__proto__ === Person.prototype // true 102 | ``` 103 | 104 | 2.JavaScript 中每一个函数都拥有原型(prototype),原型也是一个对象,这个对象包括:原型链、原型方法(属性)、函数构造,同理它的原型链指向其构造函数的原型 105 | 106 | ```javascript 107 | function Person () {} 108 | Person.prototype.getName = function () {} 109 | Object.getOwnPropertyNames(Person.prototype) // ["constructor", "getName"] 110 | Person.prototype.__proto__ === Object.prototype // true 111 | ``` 112 | 113 | 3.当访问一个函数上的属性时,`先尝试访问自身上的属性,再尝试访问其原型上的属性`。当访问一个对象上的属性时,`先尝试访问自身上的属性,再通过原型链尝试访问其构造函数原型上的属性`。如果没有则通过原型上的原型链,继续向上查找,直到访问 Object.prototype 上的属性,如果还是没有,因为 Object.prototype 是一个没有 \_\_proto\_\_ 的对象,则查询到此为止,返回 undefined。 114 | 115 | ```javascript 116 | function Person () {} 117 | Person.getName = function () { 118 | console.log('Person1') 119 | } 120 | Person.prototype.getName = function () { 121 | console.log('Person2') 122 | } 123 | var p = new Person() 124 | 125 | Person.getName() // Person1 126 | p.getName() // Person2 127 | console.log(typeof p.getClass) // undefined 128 | ``` 129 | 130 | ###### 继承 131 | 132 | JavaScript 函数通过原型和原型链实现继承 133 | 134 | ``` javascript 135 | function superA (name) { 136 | this.name = name 137 | } 138 | superA.prototype.getName = function () { 139 | console.log(this.name) 140 | } 141 | function subA (name) { 142 | superA.call(this, name) // 继承属性 143 | } 144 | subA.prototype = new superA() // 继承方法 145 | 146 | var a1 = new subA('xiaomuchen') 147 | a1.getName() // xiaomuchen 148 | ``` 149 | 150 | 上述代码,描述了一个函数的经典继承,其工作原理是这样的: 151 | 152 | 1. 声明父类 superA、子类 subA 153 | 2. 重写子类 subA 的原型,指向 superA 的实例 154 | 3. 当实例化 a1 时,a1.\_\_proto\_\_ => subA.prototype => new superA() => superA.prototype,所以 a1 的构造函数是 superA 155 | 4. 同时,运行 subA 也就是 superA.call(this, 'xiaomuchen'),其中 this 指向 a1 所以 a1 继承了 name 属性 156 | 5. 这样子类 subA 的实例 a1 就继承了 superA 的原型方法和属性 157 | 158 | #### 总结 159 | 160 | 本文概括了递归、闭包、原型、继承,理清这些基本的概念,有助于你接纳更多的东西,我们会在下一个章节对函数进行更深入的讨论。 161 | 162 | ------ 163 | 164 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 -------------------------------------------------------------------------------- /201710/functional.md: -------------------------------------------------------------------------------- 1 | # JavaScript 函数式编程 2 | 3 | 函数式编程是一种编程范式,记得在刚学编程时从`面向过程编程` 转换到 `面向对象编程` 时的触动,了解 `函数式编程` 或许会给你一个最初的惊喜。函数式编程是一个很大的命题,在本文中将介绍几个基本概念:`纯函数`、`柯里化(curry)`、`组合(compose)`、`容器(container)`、`函子(functor)`,希望能激起你对它的兴趣。 4 | 5 | #### 如何实现链式调用 6 | 7 | 先让我们忘掉上面那些奇怪的概念,让我们看一个贯彻全文的实例,如何实现一个链式调用。 8 | 9 | ``` javaScript 10 | var Container = function(x) { 11 | this.__value = x; 12 | } 13 | 14 | Container.of = function(x) { return new Container(x); }; 15 | 16 | Container.prototype.map = function(f){ 17 | return Container.of(f(this.__value)) 18 | } 19 | ``` 20 | 21 | 上述代码实现了一个简单的链式调用,让我们看看如何使用它 22 | 23 | ``` javaScript 24 | Container.of(3); // Container {__value: 3} 25 | Container.of(4); // Container {__value: 4} 26 | 27 | var add1 = function (num) { return num + 1 }; 28 | var add2 = function (num) { return num + 2 }; 29 | 30 | Container.of(3).map(add1).map(add2) // Container {__value: 6} 31 | Container.of(4).map(add2).map(add2).map(add2) // Container {__value: 10} 32 | ``` 33 | 34 | 在这个实例中出现的 `Container` 是一个容器,通过 `Container.of` 来实例化保存值到 `this.__value` 。`add1`、`add2` 都是 `纯函数`,我们通过 `map` 函数来操作容器内的值,我们把 `Container` 看作数据结构,这种数据结构可以通过 `map` 操作,那么它就叫 `functor`。 35 | 36 | 37 | #### 纯函数 38 | 39 | > 什么是纯函数:纯函数是这样一种函数,即相同的输入,永远会得到相同的输出,而且没有任何可观察的副作用。 40 | 41 | 比如 `slice` 和 `splice`,这两个函数的作用并别无二致。但是我们说 `slice` 符合纯函数的定义是因为对相同的输入它保证能返回相同的输出。而 `splice` 的调用却会产生可观察到的副作用,这个数组被永久地改变了。 42 | 43 | ``` javaScript 44 | var xs = [1,2,3,4,5]; 45 | 46 | // 纯的 47 | xs.slice(0,3); // => [1,2,3] 48 | xs.slice(0,3); // => [1,2,3] 49 | 50 | // 不纯的 51 | xs.splice(0,3); // => [1,2,3] 52 | xs.splice(0,3); // => [4,5] 53 | ``` 54 | 55 | 在函数式编程中,我们尽量杜绝 `splice` 这种会改变数据的函数。我们追求的是 `slice` 那种可靠的,每次都能返回同样结果的函数。 56 | 57 | 再看另一个例子 58 | 59 | ``` javaScript 60 | // 不纯的 61 | var num_1 = 1 62 | var add1 = function (num) { return num + num_1 }; 63 | 64 | // 纯的 65 | var add1 = function (num) { return num + 1 }; 66 | ``` 67 | 68 | 在不纯的版本中,`add1` 的结果将取决于 `num_1` 这个可变变量的值。换句话说,它取决于`系统状态`(system state)。因为它引入了外部的环境,从而增加了`认知负荷`(cognitive load)。这种依赖状态是影响系统复杂度的罪魁祸首,不仅让它变得不纯,而且导致每次我们思考整个软件的时候都痛苦不堪。 69 | 70 | 为什么要使用纯函数呢?举例容易看到的好处:1. 可缓存性,因为纯函数对于相同的输入有相同的输出,所以纯函数是可以缓存运算结果的;2. 可移植性,因为不会受`环境变量`等外部状态的影响,可以方便移植;3. 可测试性,无需配置外部变量,一个输入一个输出,直接断言;等等。 71 | 72 | 有哪些不纯的情况呢?1. IO 操作,你不知道你读取的内容会是怎样;2. 接口请求,你确定返回的内容是什么;3. dom 操作,引起了副作用;4. 甚至连 console.log 都是不纯的,因为它有副作用;等等。对于不纯的函数我们尽量把它控制在可控范围内发生,这个会在文章后面提到。 73 | 74 | #### 函数柯里化 75 | 76 | > 什么是柯里化(curry)?curry 的概念很简单,只传递给函数一部分参数来调用它,让它返回一个函数去处理剩下的参数 77 | 78 | 简单的实例: 79 | ``` javascript 80 | var add = function (x, y) { return x + y; } 81 | add(1, 2) // 3 82 | add(10, 1) // 11 83 | add(10, 2) // 12 84 | add(10, 3) // 13 85 | 86 | // curry 87 | var add = function(x) { 88 | return function(y) { 89 | return x + y; 90 | }; 91 | }; 92 | 93 | var increment = add(1); 94 | var addTen = add(10); 95 | 96 | increment(2); // 3 97 | addTen(1); // 11 98 | addTen(2); // 12 99 | addTen(3); // 13 100 | ``` 101 | 102 | 我们把 `add` 函数通过柯里化变成了接受部分参数并返回一个处理剩余函数且返回结果的函数。在实际环境中我们可能用到 `ramda` 这样的库来帮助我们实现柯里化。 103 | 104 | ``` javascript 105 | var R = require('ramda'); 106 | var add = function (x, y) { return x + y; } 107 | var addTen = R.curry(add)(10) 108 | 109 | addTen(1); // 11 110 | addTen(2); // 12 111 | ``` 112 | 113 | 柯里化是函数式编程的工具,他能实现预加载函数、分步取值、避免重复传参、锁定函数运行环境等等功能。 114 | 115 | #### 函数组合 116 | 117 | 这就是组合(compose) 118 | 119 | ``` javascript 120 | // 简单实现,复杂实现可以传递多个函数用于组合 121 | var compose = function(f,g) { 122 | return function(x) { 123 | return f(g(x)); 124 | }; 125 | }; 126 | ``` 127 | 128 | 组合多个函数生成一个新的函数,并且函数从右往左运行。 129 | 130 | ``` javascript 131 | var double = function (num) { return num * 2 } 132 | var add = R.curry(function (x, y) { return x + y; }) 133 | 134 | var price = compose(double, add(10)) // 通过成本获取商品价格 135 | 136 | price(10) // 40 137 | price(20) // 60 138 | ``` 139 | 140 | 通过函数组合我们可以,一次性的合并多个处理函数,并且可以方便的改变函数的执行顺序。 141 | 142 | #### 容器和函子(functor) 143 | 144 | 让我们回顾开头的例子 145 | 146 | ``` javascript 147 | var Container = function(x) { 148 | this.__value = x; 149 | } 150 | 151 | Container.of = function(x) { return new Container(x); }; 152 | 153 | Container.prototype.map = function(f){ 154 | return Container.of(f(this.__value)) 155 | } 156 | ``` 157 | 158 | 现在我们转换角度,把调用 `Container.of` 返回的对象看作一种数据结构 `Container {__value: 3}` ,这种数据结构只能使用 `map` 方法进行操作,类似这样的数据结构被称为 `functor`。 159 | 160 | 这样做的好处是什么呢?我们能在不离开 `容器(Container)` 的情况下操作容器里面的值,操作完成之后又放回容器。我们可以不断的进行这一操作,就像 `组合函数` 一样。这是一种抽象,我们让容器保存值,并且请求容器通过 `map` 里的函数去操作值。 161 | 162 | 163 | #### 总结 164 | 165 | 在文章中,提到了 `纯函数`、`柯里化(curry)`、`组合(compose)`、`容器(container)`、`函子(functor)`,不要看它们很遥远其实已经或多或少出现在我们身边。举个例子:尖头函数。 166 | 167 | ```javascript 168 | const curryAdd = x => y => x + y 169 | const compose = (f, g) => x => f(g(x)) 170 | const double = num => num * 2 171 | const price = y => compose(double, curryAdd(10))(y) 172 | 173 | console.log(price(0)) // 20 174 | ``` 175 | 176 | 仅仅几行代码就可以体验 `curry` 和 `compose` 工具,如果在阅读本文之后对这种编程范式感兴趣的的话,或者对 `不纯操作的处理`、`处理错误和流程` 等延伸内容好奇的话,可以阅读这篇文章[《JS 函数式编程指南》](https://www.gitbook.com/book/llh911001/mostly-adequate-guide-chinese/details)。 177 | 178 | ------ 179 | 180 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 181 | -------------------------------------------------------------------------------- /201710/gc.md: -------------------------------------------------------------------------------- 1 | # JavaScript 内存管理 2 | 3 | JavaScript 具有垃圾自动回收机制(Garbage Collection)简称 GC。垃圾回收机制会中断整个代码执行,释放不可能再被使用的变量,释放内存,这个工作机制是周期性的,我们会在下文详细探讨。 4 | 5 | #### 可释放对象 6 | 7 | ``` javascript 8 | function fn1() { 9 | var obj1 = { name: 'xiaomuchen', age: '20' } 10 | } 11 | function fn2() { 12 | var obj2 = { name: 'xiaomuchen', age: '20' } 13 | return obj2 14 | } 15 | var a = fn1() 16 | var b = fn2() 17 | console.log(a, b) // undefined, {name: "xiaomuchen", age: "20"} 18 | ``` 19 | 20 | 我们对比上面两个函数,fn1 在函数内声明变量 obj1 并且赋值,在函数执行后这个变量`便不可再访问了`,fn2 在最后把函数内的变量 obj2 返回到全局变量 b,所以 `{ name: 'xiaomuchen', age: '20' }` 这个对象(或者说 obj2)`依然可被访问`。 21 | 22 | JavaScript 回收机制通过判断变量是否可被访问,来决定回收哪些变量。 23 | 24 | 25 | #### 标记清除和引用计数 26 | 27 | 那么 JavaScript 是如何判断变量是否可被访问?这就要提到标记清除和引用计数。 28 | 29 | 标记清除:标记清除是目前大部分 JavaScript 引擎使用的判断方式,通过标记变量的状态来确定是否可被回收。当变量在环境中被声明时标记`进入环境`,理论上永远不要释放进入环境的变量,因为它可以在环境中的任何位置、任何时刻被访问。当环境被销毁(如函数执行完),则变量被标记`离开环境`等待回收。 30 | 31 | ``` javascript 32 | function fn(){ 33 | var a = { count: 10 } // 被标记,进入环境 34 | var b = { count: 20 } // 被标记,进入环境 35 | } 36 | fn(); // 执行完毕之后 b 被标记,离开环境 37 | ``` 38 | 39 | 引用计数:JavaScript 引擎维护一张`引用表`,保存内存中所有的资源的引用次数。资源被引用一次则引用 +1,资源被去掉引用或者退出变量的函数作用域时,则引用 -1,当资源的引用次数为`0`时,说明无法访问这个值,则等待回收。 40 | (注:引用计数从 1 到 0 这个过程可能不执行,而是直接标记`可被回收`,不再进行加减运算节约开销) 41 | 42 | ``` javascript 43 | function fn(){ 44 | var a = { count: 10 } // 资源 { count: 10 } 被引用次数为 1 45 | a = { count: 20 } // 资源 { count: 20 } 被引用次数为 1,资源 { count: 10 } 被引用次数为 0,等待回收 46 | // do someThing 47 | } 48 | fn(); // 资源 { count: 20 } 被释放 49 | ``` 50 | 51 | 但是引用计数存在一种`循环引用`的情况,如下例子,两个对象之间相互引用,在离开环境后对象不可访问,但由于对象的引用次数为 1,则导致不会被回收。这个例子来自《JavaScript 高级程序设计》,但我思考良久,如果引用计数把 a.param 也作为一个变量来计数,那么就没有这个问题了,引用计数实现的方式不同,产生的结果也不一样。 52 | 53 | ``` javascript 54 | function fn(){ 55 | var a = { count: 10 } 56 | var b = { count: 20 } 57 | a.param = b // b 的引用次数为 2 58 | b.param = a // a 的引用次数为 2 59 | } 60 | fn(); // a、b 的引用次数为 1 61 | ``` 62 | 63 | #### GC 的缺陷、分代回收和增量 GC 64 | 65 | 和其他语言一样 GC 会中断代码执行,停止其他操作。因为要遍历所有对象,回收所有不可访问对象,这个操作的耗时可能有 100ms 以上。在 V8 引擎新版本中引入了两种优化方法:1. 分代回收(Generation GC),2. 增量 GC(increment GC) 66 | 67 | 分代回收:目的是通过对象的使用频率、存在时长区分新生代与老生代对象。多回收新生代区(young generation),少回收老生代区(tenured generation),减少每次需遍历的对象,从而减少每次GC的耗时 68 | 69 | 增量 GC:把需要长耗时的遍历、回收操作`拆分运行`,减少中断时间,但是会增大上下文切换开销 70 | 71 | #### Node.js 中的 GC 表现 72 | 73 | 当我们用 Node.js 搭建一个稳定的服务时,就需要考虑服务器内存的开销,下面一个 Node.js 内存回收执行的例子: 74 | 75 | 执行代码`node --trace_gc --trace_gc_verbose test.js`跟踪一个网络服务的 GC。 76 | 77 | ``` console.log 78 | [41204:0x102001c00] Memory reducer: call rate 0.056, low alloc, foreground 79 | [41204:0x102001c00] Memory reducer: started GC #1 80 | [41204:0x102001c00] Heap growing factor 1.1 based on mu=0.970, speed_ratio=42956 (gc=675253, mutator=16) 81 | [41204:0x102001c00] Grow: old size: 21382 KB, new limit: 33604 KB (1.1) 82 | [41204:0x102001c00] Memory reducer: finished GC #1 (will do more) 83 | [41204:0x102001c00] 156410 ms: Mark-sweep 27.7 (50.0) -> 21.0 (30.0) MB, 12.4 / 0.0 ms (+ 20.4 ms in 7 steps since start of marking, biggest step 4.8 ms) [Incremental marking task: finalize incremental marking] [GC in old space requested]. 84 | [41204:0x102001c00] Memory allocator, used: 30756 KB, available: 1435612 KB 85 | [41204:0x102001c00] New space, used: 169 KB, available: 838 KB, committed: 1024 KB 86 | [41204:0x102001c00] Old space, used: 16662 KB, available: 2417 KB, committed: 19412 KB 87 | [41204:0x102001c00] Code space, used: 4078 KB, available: 178 KB, committed: 5120 KB 88 | [41204:0x102001c00] Map space, used: 642 KB, available: 0 KB, committed: 2128 KB 89 | [41204:0x102001c00] Large object space, used: 0 KB, available: 1434571 KB, committed: 0 KB 90 | [41204:0x102001c00] All spaces, used: 21552 KB, available: 1438005 KB, committed: 27684 KB 91 | [41204:0x102001c00] External memory reported: 1026 KB 92 | [41204:0x102001c00] Total time spent in GC : 158.6 ms 93 | [41204:0x102001c00] Memory reducer: call rate 0.003, low alloc, foreground 94 | ``` 95 | 96 | 首先我们可以看到 Node.js 区分 `New space`、`Old space` 等来划分检索空间。而提示`(+ 20.4 ms in 7 steps since start of marking, biggest step 4.8 ms)` 告诉我们这个标记的步骤分 7 步进行,耗时最长的一次时 4.8ms。这使 JavaScript 可以很好的支持开发高实时应用。 97 | 98 | #### 总结 99 | 100 | 因为篇幅有限,留下一些小问题供大家思考: 101 | 102 | 1. 闭包一定会导致内存不可被回收? 103 | 2. 如何监控一个 Node.js 服务的内存开销,如何处理不可预知的内存泄漏? 104 | 105 | ------ 106 | 107 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 108 | 109 | 110 | -------------------------------------------------------------------------------- /201711/design.md: -------------------------------------------------------------------------------- 1 | # JavaScript 设计模式 2 | 3 | // TODO 4 | 5 | ------ 6 | 7 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 -------------------------------------------------------------------------------- /201711/process.md: -------------------------------------------------------------------------------- 1 | # JavaScript 异步流程控制 2 | 3 | 本文主要讲解 JavaScript 在异步流程控制中的一些实践、容错以及复杂异步环境下我们该如何去处理。 4 | 5 | #### 发展历史 6 | 7 | 简要的提及一下,异步流程控制的发展历史大概是 `callback hell` => `Promise` => `Generator` => `async/await` 8 | 9 | ES6 中 `Promise` 是通过 `.then().then().catch()` 的方式来解决 `callback` 多层嵌套的问题。但 `Promise` 依然是异步执行的,这时候 TJ 的 [co](https://github.com/tj/co),通过 `Generator` 实现了异步代码的同步化。这个模式和 ES7 中的 `async/await` 类似。 10 | 11 | ``` javascript 12 | function A() { 13 | // async get dataA 14 | function B(dataA) { 15 | // async get dataB 16 | function C(dataB) { 17 | } 18 | } 19 | } 20 | 21 | Promise(A).then(B).then(C).catch(err => console.log(err)) 22 | 23 | co(function *() { 24 | var dataA = yield A() 25 | var dataB = yield B(dataA) 26 | var dataC = yield C(dataB) 27 | }) 28 | 29 | async () => { 30 | const dataA = await A() 31 | const dataB = await B(dataA) 32 | const dataC = await C(dataB) 33 | } 34 | ``` 35 | 36 | #### 使用 37 | 38 | 首先是语法糖支持情况,你可以使用下面命令行查看当前 node 版本对于 ES6/ES7 的支持。目前大多浏览器是不支持新语法的,如果你当前环境不支持新语法,你可以使用 [bable](https://github.com/babel/babel)、 [co](https://github.com/tj/co)、 [Promise](https://github.com/then/promise)、 [bluebird](https://github.com/petkaantonov/bluebird) 等开源项目来扩展功能。 39 | 40 | `$ node --v8-options | grep harmony` 41 | 42 | 对了如果你还对这些新语法的使用方式和 API 陌生的话,建议看看 [《ECMAScript 6 入门》](http://es6.ruanyifeng.com/#README) 这本书,下面的内容,假定你对基本的使用已经有所了解,我们开始正篇。 43 | 44 | 45 | #### Promise 实践和容错 46 | 47 | 之前当面试官的时候,如果面试对象经常使用 ES6,我会喜欢问一个问题:`假设你的移动端页面上有头部、中部、底部三部分数据需要并发的去请求 api 拿到返回数据,你会怎么处理?用 Promise 如何实现?如果其中一个 API 出了错误怎么容错?` 48 | 49 | 1.第一个问题很简单,依次执行三个异步请求函数,在获取到数据后执行渲染函数填充到页面上 50 | 51 | 2.第二个问题,其实也没多绕,你可以同时执行三个 Promise 函数,也可以打包成 Promise.all() 一并执行,显然对于这种并发执行的异步函数 Promise.all() 更符合程序设计。 52 | 53 | ``` javascript 54 | const render = log = console.log 55 | const asyncApi = (num) => { 56 | return new Promise((resolve, reject) => { 57 | setTimeout(() => { 58 | if (typeof num !== 'number') { 59 | reject('param error') 60 | } 61 | num += 10 62 | resolve(num) 63 | }, 100); 64 | }) 65 | } 66 | 67 | asyncApi(0).then(render).catch(log) // 10 68 | asyncApi(5).then(render).catch(log) // 15 69 | asyncApi(10).then(render).catch(log) // 20 70 | 71 | Promise.all([asyncApi(0), asyncApi(5), asyncApi(10)]).then(render).catch(log) // [ 10, 15, 20 ] 72 | ``` 73 | 74 | 3.无论怎样,我会把面试者引导到 Promise.all() 上,这时候我会抛出问题 `如果其中一个 API 出了错误怎么容错?` 75 | 76 | ``` javascript 77 | asyncApi(0).then(render).catch(log) // 10 78 | asyncApi(false).then(render).catch(log) // param error 79 | asyncApi(10).then(render).catch(log) // 20 80 | 81 | Promise.all([asyncApi(0), asyncApi(false), asyncApi(10)]).then(render).catch(log) // param error 82 | ``` 83 | 84 | 对比发现,Promise 之间互不影响。但由于 Promise.all() 其实是将传入的多个 Promise 打包成一个,任何一个地方出错了都会直接抛出异常,导致不执行 `then` 直接跳到了 `catch`,丢失了成功的数据。 85 | 86 | 4.解决方式是使用 `resolve` 传递错误,then 环节去处理 87 | 88 | ```javascript 89 | const render = log = console.log 90 | const asyncApi = (num) => { 91 | return new Promise((resolve, reject) => { 92 | setTimeout(() => { 93 | if (typeof num !== 'number') { 94 | resolve({ err: 'param error' }) // 修改前:reject('param error') 95 | } 96 | num += 10 97 | resolve({ data: num }) // 修改前:resolve(num) 98 | }, 100); 99 | }) 100 | } 101 | 102 | Promise.all([asyncApi(0), asyncApi(false), asyncApi(10)]).then(render).catch(log) 103 | // [ { data: 10 }, { err: 'param error' }, { data: 20 } ],这时候就可以区分处理了 104 | ``` 105 | 106 | 107 | #### 复杂环境 108 | 109 | 我们假设一个如下的复杂场景,异步请求之间相互依赖。仅仅用 `Promise` 来实现,会不停的调用 `then`、 `return` 并且创建匿名函数。 110 | 111 | ``` javascript 112 | // 流程示意图 113 | // data data1 114 | // asyncApi -----> asyncApi -----> render/error 115 | // 10 + data data2 data3 116 | // -----> asyncApi -----> asyncApi -----> render/error 117 | 118 | asyncApi(0).then(data => { 119 | return Promise.all([asyncApi(data.data), asyncApi(10 + data.data)]) 120 | }).then(([data1, data2]) => { 121 | render(data1) 122 | return asyncApi(data2.data) 123 | }).then(render).catch(log) 124 | ``` 125 | 126 | 而如果加上 `async/await` 来改写它,就可以完全按同步的写法来获取异步数据,并且语义清晰。 127 | 128 | ``` javascript 129 | const run = async () => { 130 | let data = await asyncApi(0) 131 | let [data1, data2] = await Promise.all([asyncApi(data.data), asyncApi(10 + data.data)]) 132 | render(data1) 133 | let data3 = await asyncApi(data2.data) 134 | render(data3) 135 | } 136 | run().catch(log) 137 | ``` 138 | 139 | 或许你觉得差不了太多,那我再改一下,现在我们看到 `data3` 是需要 `data2` 作为函数参数才能获取,假如:获取 `data3` 需要 `data` 和 `data2` 呢? 140 | 141 | 你会发现 `Promise` 的写法隔离了环境,如果需要 `data` 这个值,那就要想办法传递下去或保存到其他地方,而 `async/await` 的写法就不需要考虑这个问题。 142 | 143 | #### 总结 144 | 145 | 在本文的前半部分简单介绍了流程控制的发展历史和如何使用这些新的语法糖,后半部分我们聊到了 `Promise` 和 `async/await` 如何去实现复杂的异步流程环境,并满足容错和可读性。 146 | 147 | 做一个有追求的程序员,在实际项目中多去思考`容错`和`可读性`,相信代码质量会有不错的提升。 148 | 149 | ------ 150 | 151 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 -------------------------------------------------------------------------------- /201711/this.md: -------------------------------------------------------------------------------- 1 | # this、apply、call、bind 2 | 3 | #### 隐式绑定的 this 4 | 5 | `this` 实际上是在函数被调用时绑定的,它指向什么完全取决于函数的调用方式。 6 | 7 | ``` javascript 8 | var obj = { 9 | a: 1, 10 | foo: function () { 11 | console.log(this.a) 12 | } 13 | } 14 | 15 | var foo2 = obj.foo 16 | obj.foo() // 1 17 | foo2() // undefined 18 | ``` 19 | 20 | 如果没有指定函数的运行对象,默认的 `this` 会隐式的绑定到运行环境的全局对象上。 21 | 22 | ``` javascript 23 | function foo() { 24 | console.log(this.a) 25 | } 26 | a = 'global' 27 | foo() // global 28 | ``` 29 | 30 | 看一个常见但是有点出乎意料的的例子,如果是回调函数,即使你传入了 `obj.foo` 还是会丢失 `this`。 31 | 32 | ``` javascript 33 | function foo() { 34 | console.log(this.a) 35 | } 36 | function doFoo(fn) { 37 | fn() 38 | } 39 | var obj = { a: 1, foo: foo } 40 | a = "global" 41 | doFoo(obj.foo) // global 42 | ``` 43 | 44 | 如果是链式调用呢,则是最后哪个对象调用了这个方法,`this` 指向谁。 45 | 46 | ``` javascript 47 | function foo() { 48 | console.log(this.a); 49 | } 50 | var obj2 = { a: 11, foo: foo } 51 | var obj1 = { a: 1, obj2: obj2 } 52 | obj1.obj2.foo(); // 11 53 | ``` 54 | 55 | 其实 this 的指向都有规律可言,在隐式绑定的 this 中,`this 绑定的是调用它的对像`。我们回过头解释上面例子。 56 | 57 | 第一个例子的 `foo2()` 和第二个例子的 `foo()` 其实是在 `window` (global) 对象上运行的,对应的打印值就合乎情理了。第三个例子涉及 JS 执行的原理,传入的 `obj.foo` 被赋值到 `fn` 上,所以本质上是 `fn = obj.foo; window.fn()`,因此 `this` 指向了 `window` 。 58 | 59 | 60 | 61 | #### 显式绑定的 this 62 | 63 | 隐式绑定的 `this` 能为我们带来很多灵活性,但是有时我们需要显式的指定函数运行的 `this` 。 64 | 65 | 比如 `apply、call、bind` 这三个绑定在 `Function.prototype` 上的函数(关于 prototype 我们会在后面的章节提到),让我们先看看具体 API。 66 | 67 | ``` javascript 68 | fun.apply(thisArg, [argsArray]) 69 | fun.call(thisArg, arg1, arg2, ...) 70 | fun.bind(thisArg[, arg1[, arg2[, ...]]]) 71 | ``` 72 | 73 | 它们的语法十分相近,第一个参赛指定函数的 this 环境,后面的参赛指定函数需要的参数,最大的区别是 `bind` 不是执行 `fun` 而是返回一个函数,我们看看如何来用它们显式绑定 this。 74 | 75 | ``` javascript 76 | var obj1 = { a: 1 } 77 | var obj2 = { a: 11 } 78 | var foo = function () { 79 | console.log(this.a) 80 | } 81 | a = 'global' 82 | foo.apply(obj1) // 1 83 | foo.call(obj2) // 11 84 | foo.bind(global)() // global 85 | ``` 86 | 87 | 实际情况 `bind` 更适合用来固定 `this` 环境。 88 | 89 | ```javascript 90 | var obj1 = { a: 1 } 91 | var obj2 = { a: 11 } 92 | var foo = function () { 93 | console.log(this.a) 94 | }.bind(obj1) 95 | foo.apply(obj2) // 1 96 | foo.call(obj2) // 1 97 | ``` 98 | 99 | 另外我们还可以使用 `new` 和 `=>` 尖头函数。 100 | 101 | `new` 关键字把 this 指向实例,这个过程发生了什么,我们会在[后面章节](http://localhost:4000/201710/function.html)讨论。 102 | 103 | ```javascript 104 | var foo = function (a) { 105 | this.a = a 106 | } 107 | foo.prototype.sayA = function () { 108 | console.log(this.a) 109 | } 110 | var bar = new foo(2) 111 | foo.sayA() // 2 112 | ``` 113 | 114 | 而尖头函数十分特别,你可以把它理解为 bind 函数的语法糖,它的 this 同外层函数的 this。 115 | 116 | ``` javascript 117 | var obj = { 118 | a: 1, 119 | foo: function () { 120 | console.log(this) 121 | setTimeout(() => { 122 | console.log(this) 123 | }) 124 | } 125 | } 126 | obj.foo() // obj { a: 1, foo: ƒ }, obj { a: 1, foo: ƒ } 127 | ``` 128 | 129 | #### 总结 130 | 131 | this 是 JavaScript 的一大难点,多年经验的前端程序员都可能对这方面模糊。this 在大量的函数、类库中都有使用,理清显式绑定和隐式绑定有助于理解或书写这类函数。 132 | 133 | ------ 134 | 135 | 作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 -------------------------------------------------------------------------------- /GLOSSARY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 参考文章-201709-origin 4 | - [关于JavaScript诞生之初的趣事](http://www.cnblogs.com/xiaoyang002/p/4137975.html) 5 | - [JavaScript 诞生记](http://www.ruanyifeng.com/blog/2011/06/birth_of_javascript.html) 6 | - [Brendan Eich 的自述](https://brendaneich.com/2008/04/popularity/) 7 | - [ecma 规范制定](http://www.ruanyifeng.com/blog/2015/11/ecmascript-specification.html) 8 | 9 | ## 参考文章-201709-runtime 10 | - [理解 JavaScript 的编译过程与运行机制](http://blog.csdn.net/celte/article/details/39412683) 11 | - [JavaScript的语法解析与抽象语法树](http://www.iteye.com/news/30731) 12 | - [JavaScript 有哪些引擎](http://www.cnblogs.com/gdutbean/archive/2012/02/21/2362003.html) 13 | - [V8 Design Elements](https://my.oschina.net/sub/blog/152628) 14 | - [JavaScript Just-in-time (JIT) 工作原理](http://huziketang.com/blog/posts/detail?postId=58c12f36a6d8a07e449fdd22) 15 | - [JS特性性能缺陷及JIT的解决方案](http://www.cnblogs.com/hyddd/archive/2013/02/06/2908110.html) 16 | 17 | ## 参考文章-201710-eventloop 18 | - [再谈Event Loop](http://www.ruanyifeng.com/blog/2014/10/event-loop.html) 19 | - [Event Loop Design](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/) 20 | - [JavaScript 中的实现](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/EventLoop) 21 | 22 | ## 参考文章-201710-gc 23 | - [跟我学习 javascript 的垃圾回收机制与内存管理](http://www.jb51.net/article/75292.htm) 24 | - [Node.js 调试 GC 以及内存暴涨的分析](http://blog.csdn.net/lihuifeng/article/details/51984442) 25 | - [COM 常见的内存泄漏及解决](http://blog.csdn.net/cplusplus_zk/article/details/4899194) 26 | - [V8 引擎设计](http://blog.csdn.net/hgl868/article/details/45095153) 27 | 28 | ## 参考文章-201710-function 29 | - [JS原型、原型链深入理解](http://www.jb51.net/article/80109.htm) 30 | 31 | ## 参考文章-201710-functional 32 | - [百度百科-函数式编程](https://baike.baidu.com/item/%E5%87%BD%E6%95%B0%E5%BC%8F%E7%BC%96%E7%A8%8B/4035031?fr=aladdin) 33 | - [函数式编程入门教程](http://www.ruanyifeng.com/blog/2017/02/fp-tutorial.html) 34 | - [Functor, Applicative, 以及 Monad 的图片阐释](http://jiyinyiyong.github.io/monads-in-pictures/) 35 | 36 | ## 参考文章-201711-process 37 | - 无参考 38 | 39 | ## 参考文章-201711-design 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 《前端基础漫游指南》 2 | 3 | 欢迎 Star,关注请 Watch,探讨 Issues。 4 | 5 | #### 目录 6 | 7 | - [序章](https://cheogo.github.io/learn-javascript/201709/preface.html) 8 | - [JavaScript 起源](https://cheogo.github.io/learn-javascript/201709/origin.html) 9 | - [JavaScript 语法解析、AST、V8、JIT](https://cheogo.github.io/learn-javascript/201709/runtime.html) 10 | - [JavaScript Event loop](https://cheogo.github.io/learn-javascript/201710/eventloop.html) 11 | - [JavaScript 内存管理](https://cheogo.github.io/learn-javascript/201710/gc.html) 12 | - [this、apply、call、bind](https://cheogo.github.io/learn-javascript/201711/this.html) 13 | - [递归、闭包、原型、继承](https://cheogo.github.io/learn-javascript/201710/function.html) 14 | - [JavaScript 函数式编程](https://cheogo.github.io/learn-javascript/201710/functional.html) 15 | - [JavaScript 异步流程控制](https://cheogo.github.io/learn-javascript/201711/process.html) 16 | - JavaScript 设计模式 -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [目录](./README.md) 4 | * [序章](201709/preface.md) 5 | * [JavaScript 起源](201709/origin.md) 6 | * [JavaScript 语法解析、AST、V8、JIT](201709/runtime.md) 7 | * [JavaScript Event Loop](201710/eventloop.md) 8 | * [JavaScript 内存管理](201710/gc.md) 9 | * [this、apply、call、bind](201711/this.md) 10 | * [递归、闭包、原型、继承](201710/function.md) 11 | * [JavaScript 函数式编程](201710/functional.md) 12 | * [JavaScript 异步流程控制](201711/process.md) 13 | * [JavaScript 设计模式](201711/design.md) 14 | -------------------------------------------------------------------------------- /assets/2017_09_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/assets/2017_09_01.png -------------------------------------------------------------------------------- /assets/2017_09_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/assets/2017_09_02.jpg -------------------------------------------------------------------------------- /assets/2017_09_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/assets/2017_09_03.jpg -------------------------------------------------------------------------------- /assets/2017_09_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/assets/2017_09_04.jpg -------------------------------------------------------------------------------- /assets/2017_09_05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/assets/2017_09_05.jpg -------------------------------------------------------------------------------- /assets/2017_10_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/assets/2017_10_01.jpg -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "katex" 4 | ], 5 | "pluginsConfig": { 6 | } 7 | } -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /docs/201709/origin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JavaScript 起源 · GitBook 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
74 |
75 | 76 | 77 | 80 | 81 | 82 | 253 | 254 | 255 |
256 | 257 |
258 | 259 |
260 | 261 | 262 | 263 | 272 | 273 | 274 | 275 | 276 |
277 |
278 | 279 |
280 |
281 | 282 |
283 | 284 |

JavaScript 起源

285 |

在了解、学习一个东西时,了解其诞生的背景及历史是十分有必要的,这能让你多一个发展的维度去看待它。

286 |

布兰登·艾奇(Bremdan Eich),在 1995 年受聘于网景(Netscape)公司。当时网景公司急需一种网页脚本语言,使得浏览器可以与网页互动,Eich 用了 10 天的时间创造了 Javascript。

287 |

那 10 天 Eich 做的大概事情可以在 Brendan Eich - JavaScript at 20 9:55 秒的时候看到。

288 |

总的来说他的设计思路是这样的

289 |
(1)借鉴 C 语言的基本语法;
290 | (2)借鉴 Java 语言的数据类型和内存管理;
291 | (3)借鉴 Scheme 语言,将函数提升到"第一等公民"(first class)的地位;
292 | (4)借鉴 Self 语言,使用基于原型(prototype)的继承机制。
293 | 

Eich 说,JavaScript 是 C 语言和 Self 语言的结合,我想无论怎样 JavaScript 都难以摆脱它们的影子。

294 |

Brendan Eich 2008 年的自述 中,发现一句话

295 |
296 |

Yet here we are. The web must evolve, or die. So too with JS.

297 |
298 |

世界总是在变的,Flash 会被淘汰,IE6 也终于退休。短短 20 年,JavaScript 的分支也变得十分庞大起来,我们面临权衡抉择,选择适合自己的技能树 evolve, or die。

299 |

下一章开始,让我们直接上干货。

300 |
301 |

作者:肖沐宸,github

302 | 303 | 304 |
305 | 306 |
307 |
308 |
309 | 310 |

results matching ""

311 |
    312 | 313 |
    314 |
    315 | 316 |

    No results matching ""

    317 | 318 |
    319 |
    320 |
    321 | 322 |
    323 |
    324 | 325 |
    326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 |
    341 | 342 | 348 |
    349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | -------------------------------------------------------------------------------- /docs/201709/preface.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 序章 · GitBook 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
    74 |
    75 | 76 | 77 | 80 | 81 | 82 | 253 | 254 | 255 |
    256 | 257 |
    258 | 259 |
    260 | 261 | 262 | 263 | 272 | 273 | 274 | 275 | 276 |
    277 |
    278 | 279 |
    280 |
    281 | 282 |
    283 | 284 |

    序章

    285 |

    起因

    286 |

    因为工作的原因,很多牛人就在你眼前。他们视野广阔、思想先进,不断的影响着自己,仿佛自己也变得这么 NB,然而现实往往打脸,落到实处发现自己还是有很多基础不扎实的地方。

    287 |

    这篇文章,将同大家一起深入地了解前端核心基础,提高自己的硬实力。

    288 | 289 | 290 |
    291 | 292 |
    293 |
    294 |
    295 | 296 |

    results matching ""

    297 |
      298 | 299 |
      300 |
      301 | 302 |

      No results matching ""

      303 | 304 |
      305 |
      306 |
      307 | 308 |
      309 |
      310 | 311 |
      312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 |
      327 | 328 | 334 |
      335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | -------------------------------------------------------------------------------- /docs/201711/design.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JavaScript 设计模式 · GitBook 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
      72 |
      73 | 74 | 75 | 78 | 79 | 80 | 251 | 252 | 253 |
      254 | 255 |
      256 | 257 |
      258 | 259 | 260 | 261 | 270 | 271 | 272 | 273 | 274 |
      275 |
      276 | 277 |
      278 |
      279 | 280 |
      281 | 282 |

      JavaScript 设计模式

      283 |

      // TODO

      284 |
      285 |

      作者:肖沐宸,github

      286 | 287 | 288 |
      289 | 290 |
      291 |
      292 |
      293 | 294 |

      results matching ""

      295 |
        296 | 297 |
        298 |
        299 | 300 |

        No results matching ""

        301 | 302 |
        303 |
        304 |
        305 | 306 |
        307 |
        308 | 309 |
        310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 |
        321 | 322 | 328 |
        329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | -------------------------------------------------------------------------------- /docs/GLOSSARY.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | · GitBook 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
        70 |
        71 | 72 | 73 | 76 | 77 | 78 | 249 | 250 | 251 |
        252 | 253 |
        254 | 255 |
        256 | 257 | 258 | 259 | 268 | 269 | 270 | 271 | 272 |
        273 |
        274 | 275 |
        276 |
        277 | 278 |
        279 | 280 |

        参考文章-201709-origin

        281 | 287 |

        参考文章-201709-runtime

        288 | 296 |

        参考文章-201710-eventloop

        297 | 302 |

        参考文章-201710-gc

        303 | 309 |

        参考文章-201710-function

        310 | 313 |

        参考文章-201710-functional

        314 | 319 |

        参考文章-201711-process

        320 |
          321 |
        • 无参考
        • 322 |
        323 |

        参考文章-201711-design

        324 | 325 | 326 |
        327 | 328 |
        329 |
        330 |
        331 | 332 |

        results matching ""

        333 |
          334 | 335 |
          336 |
          337 | 338 |

          No results matching ""

          339 | 340 |
          341 |
          342 |
          343 | 344 |
          345 |
          346 | 347 |
          348 | 349 | 350 | 351 | 352 | 353 | 354 |
          355 | 356 | 362 |
          363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | -------------------------------------------------------------------------------- /docs/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/assets/2017_09_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/assets/2017_09_01.png -------------------------------------------------------------------------------- /docs/assets/2017_09_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/assets/2017_09_02.jpg -------------------------------------------------------------------------------- /docs/assets/2017_09_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/assets/2017_09_03.jpg -------------------------------------------------------------------------------- /docs/assets/2017_09_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/assets/2017_09_04.jpg -------------------------------------------------------------------------------- /docs/assets/2017_09_05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/assets/2017_09_05.jpg -------------------------------------------------------------------------------- /docs/assets/2017_10_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/assets/2017_10_01.jpg -------------------------------------------------------------------------------- /docs/gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /docs/gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-fontsettings/fontsettings.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | // Configuration 3 | var MAX_SIZE = 4, 4 | MIN_SIZE = 0, 5 | BUTTON_ID; 6 | 7 | // Current fontsettings state 8 | var fontState; 9 | 10 | // Default themes 11 | var THEMES = [ 12 | { 13 | config: 'white', 14 | text: 'White', 15 | id: 0 16 | }, 17 | { 18 | config: 'sepia', 19 | text: 'Sepia', 20 | id: 1 21 | }, 22 | { 23 | config: 'night', 24 | text: 'Night', 25 | id: 2 26 | } 27 | ]; 28 | 29 | // Default font families 30 | var FAMILIES = [ 31 | { 32 | config: 'serif', 33 | text: 'Serif', 34 | id: 0 35 | }, 36 | { 37 | config: 'sans', 38 | text: 'Sans', 39 | id: 1 40 | } 41 | ]; 42 | 43 | // Return configured themes 44 | function getThemes() { 45 | return THEMES; 46 | } 47 | 48 | // Modify configured themes 49 | function setThemes(themes) { 50 | THEMES = themes; 51 | updateButtons(); 52 | } 53 | 54 | // Return configured font families 55 | function getFamilies() { 56 | return FAMILIES; 57 | } 58 | 59 | // Modify configured font families 60 | function setFamilies(families) { 61 | FAMILIES = families; 62 | updateButtons(); 63 | } 64 | 65 | // Save current font settings 66 | function saveFontSettings() { 67 | gitbook.storage.set('fontState', fontState); 68 | update(); 69 | } 70 | 71 | // Increase font size 72 | function enlargeFontSize(e) { 73 | e.preventDefault(); 74 | if (fontState.size >= MAX_SIZE) return; 75 | 76 | fontState.size++; 77 | saveFontSettings(); 78 | } 79 | 80 | // Decrease font size 81 | function reduceFontSize(e) { 82 | e.preventDefault(); 83 | if (fontState.size <= MIN_SIZE) return; 84 | 85 | fontState.size--; 86 | saveFontSettings(); 87 | } 88 | 89 | // Change font family 90 | function changeFontFamily(configName, e) { 91 | if (e && e instanceof Event) { 92 | e.preventDefault(); 93 | } 94 | 95 | var familyId = getFontFamilyId(configName); 96 | fontState.family = familyId; 97 | saveFontSettings(); 98 | } 99 | 100 | // Change type of color theme 101 | function changeColorTheme(configName, e) { 102 | if (e && e instanceof Event) { 103 | e.preventDefault(); 104 | } 105 | 106 | var $book = gitbook.state.$book; 107 | 108 | // Remove currently applied color theme 109 | if (fontState.theme !== 0) 110 | $book.removeClass('color-theme-'+fontState.theme); 111 | 112 | // Set new color theme 113 | var themeId = getThemeId(configName); 114 | fontState.theme = themeId; 115 | if (fontState.theme !== 0) 116 | $book.addClass('color-theme-'+fontState.theme); 117 | 118 | saveFontSettings(); 119 | } 120 | 121 | // Return the correct id for a font-family config key 122 | // Default to first font-family 123 | function getFontFamilyId(configName) { 124 | // Search for plugin configured font family 125 | var configFamily = $.grep(FAMILIES, function(family) { 126 | return family.config == configName; 127 | })[0]; 128 | // Fallback to default font family 129 | return (!!configFamily)? configFamily.id : 0; 130 | } 131 | 132 | // Return the correct id for a theme config key 133 | // Default to first theme 134 | function getThemeId(configName) { 135 | // Search for plugin configured theme 136 | var configTheme = $.grep(THEMES, function(theme) { 137 | return theme.config == configName; 138 | })[0]; 139 | // Fallback to default theme 140 | return (!!configTheme)? configTheme.id : 0; 141 | } 142 | 143 | function update() { 144 | var $book = gitbook.state.$book; 145 | 146 | $('.font-settings .font-family-list li').removeClass('active'); 147 | $('.font-settings .font-family-list li:nth-child('+(fontState.family+1)+')').addClass('active'); 148 | 149 | $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); 150 | $book.addClass('font-size-'+fontState.size); 151 | $book.addClass('font-family-'+fontState.family); 152 | 153 | if(fontState.theme !== 0) { 154 | $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); 155 | $book.addClass('color-theme-'+fontState.theme); 156 | } 157 | } 158 | 159 | function init(config) { 160 | // Search for plugin configured font family 161 | var configFamily = getFontFamilyId(config.family), 162 | configTheme = getThemeId(config.theme); 163 | 164 | // Instantiate font state object 165 | fontState = gitbook.storage.get('fontState', { 166 | size: config.size || 2, 167 | family: configFamily, 168 | theme: configTheme 169 | }); 170 | 171 | update(); 172 | } 173 | 174 | function updateButtons() { 175 | // Remove existing fontsettings buttons 176 | if (!!BUTTON_ID) { 177 | gitbook.toolbar.removeButton(BUTTON_ID); 178 | } 179 | 180 | // Create buttons in toolbar 181 | BUTTON_ID = gitbook.toolbar.createButton({ 182 | icon: 'fa fa-font', 183 | label: 'Font Settings', 184 | className: 'font-settings', 185 | dropdown: [ 186 | [ 187 | { 188 | text: 'A', 189 | className: 'font-reduce', 190 | onClick: reduceFontSize 191 | }, 192 | { 193 | text: 'A', 194 | className: 'font-enlarge', 195 | onClick: enlargeFontSize 196 | } 197 | ], 198 | $.map(FAMILIES, function(family) { 199 | family.onClick = function(e) { 200 | return changeFontFamily(family.config, e); 201 | }; 202 | 203 | return family; 204 | }), 205 | $.map(THEMES, function(theme) { 206 | theme.onClick = function(e) { 207 | return changeColorTheme(theme.config, e); 208 | }; 209 | 210 | return theme; 211 | }) 212 | ] 213 | }); 214 | } 215 | 216 | // Init configuration at start 217 | gitbook.events.bind('start', function(e, config) { 218 | var opts = config.fontsettings; 219 | 220 | // Generate buttons at start 221 | updateButtons(); 222 | 223 | // Init current settings 224 | init(opts); 225 | }); 226 | 227 | // Expose API 228 | gitbook.fontsettings = { 229 | enlargeFontSize: enlargeFontSize, 230 | reduceFontSize: reduceFontSize, 231 | setTheme: changeColorTheme, 232 | setFamily: changeFontFamily, 233 | getThemes: getThemes, 234 | setThemes: setThemes, 235 | getFamilies: getFamilies, 236 | setFamilies: setFamilies 237 | }; 238 | }); 239 | 240 | 241 | -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-fontsettings/website.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Theme 1 3 | */ 4 | .color-theme-1 .dropdown-menu { 5 | background-color: #111111; 6 | border-color: #7e888b; 7 | } 8 | .color-theme-1 .dropdown-menu .dropdown-caret .caret-inner { 9 | border-bottom: 9px solid #111111; 10 | } 11 | .color-theme-1 .dropdown-menu .buttons { 12 | border-color: #7e888b; 13 | } 14 | .color-theme-1 .dropdown-menu .button { 15 | color: #afa790; 16 | } 17 | .color-theme-1 .dropdown-menu .button:hover { 18 | color: #73553c; 19 | } 20 | /* 21 | * Theme 2 22 | */ 23 | .color-theme-2 .dropdown-menu { 24 | background-color: #2d3143; 25 | border-color: #272a3a; 26 | } 27 | .color-theme-2 .dropdown-menu .dropdown-caret .caret-inner { 28 | border-bottom: 9px solid #2d3143; 29 | } 30 | .color-theme-2 .dropdown-menu .buttons { 31 | border-color: #272a3a; 32 | } 33 | .color-theme-2 .dropdown-menu .button { 34 | color: #62677f; 35 | } 36 | .color-theme-2 .dropdown-menu .button:hover { 37 | color: #f4f4f5; 38 | } 39 | .book .book-header .font-settings .font-enlarge { 40 | line-height: 30px; 41 | font-size: 1.4em; 42 | } 43 | .book .book-header .font-settings .font-reduce { 44 | line-height: 30px; 45 | font-size: 1em; 46 | } 47 | .book.color-theme-1 .book-body { 48 | color: #704214; 49 | background: #f3eacb; 50 | } 51 | .book.color-theme-1 .book-body .page-wrapper .page-inner section { 52 | background: #f3eacb; 53 | } 54 | .book.color-theme-2 .book-body { 55 | color: #bdcadb; 56 | background: #1c1f2b; 57 | } 58 | .book.color-theme-2 .book-body .page-wrapper .page-inner section { 59 | background: #1c1f2b; 60 | } 61 | .book.font-size-0 .book-body .page-inner section { 62 | font-size: 1.2rem; 63 | } 64 | .book.font-size-1 .book-body .page-inner section { 65 | font-size: 1.4rem; 66 | } 67 | .book.font-size-2 .book-body .page-inner section { 68 | font-size: 1.6rem; 69 | } 70 | .book.font-size-3 .book-body .page-inner section { 71 | font-size: 2.2rem; 72 | } 73 | .book.font-size-4 .book-body .page-inner section { 74 | font-size: 4rem; 75 | } 76 | .book.font-family-0 { 77 | font-family: Georgia, serif; 78 | } 79 | .book.font-family-1 { 80 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 81 | } 82 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal { 83 | color: #704214; 84 | } 85 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a { 86 | color: inherit; 87 | } 88 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 89 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2, 90 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3, 91 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4, 92 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5, 93 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 94 | color: inherit; 95 | } 96 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 97 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 { 98 | border-color: inherit; 99 | } 100 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 101 | color: inherit; 102 | } 103 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr { 104 | background-color: inherit; 105 | } 106 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote { 107 | border-color: inherit; 108 | } 109 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, 110 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { 111 | background: #fdf6e3; 112 | color: #657b83; 113 | border-color: #f8df9c; 114 | } 115 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight { 116 | background-color: inherit; 117 | } 118 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th, 119 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td { 120 | border-color: #f5d06c; 121 | } 122 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr { 123 | color: inherit; 124 | background-color: #fdf6e3; 125 | border-color: #444444; 126 | } 127 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 128 | background-color: #fbeecb; 129 | } 130 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal { 131 | color: #bdcadb; 132 | } 133 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a { 134 | color: #3eb1d0; 135 | } 136 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 137 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2, 138 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3, 139 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4, 140 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5, 141 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 142 | color: #fffffa; 143 | } 144 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 145 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 { 146 | border-color: #373b4e; 147 | } 148 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 149 | color: #373b4e; 150 | } 151 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr { 152 | background-color: #373b4e; 153 | } 154 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote { 155 | border-color: #373b4e; 156 | } 157 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, 158 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { 159 | color: #9dbed8; 160 | background: #2d3143; 161 | border-color: #2d3143; 162 | } 163 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight { 164 | background-color: #282a39; 165 | } 166 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th, 167 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td { 168 | border-color: #3b3f54; 169 | } 170 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr { 171 | color: #b6c2d2; 172 | background-color: #2d3143; 173 | border-color: #3b3f54; 174 | } 175 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 176 | background-color: #35394b; 177 | } 178 | .book.color-theme-1 .book-header { 179 | color: #afa790; 180 | background: transparent; 181 | } 182 | .book.color-theme-1 .book-header .btn { 183 | color: #afa790; 184 | } 185 | .book.color-theme-1 .book-header .btn:hover { 186 | color: #73553c; 187 | background: none; 188 | } 189 | .book.color-theme-1 .book-header h1 { 190 | color: #704214; 191 | } 192 | .book.color-theme-2 .book-header { 193 | color: #7e888b; 194 | background: transparent; 195 | } 196 | .book.color-theme-2 .book-header .btn { 197 | color: #3b3f54; 198 | } 199 | .book.color-theme-2 .book-header .btn:hover { 200 | color: #fffff5; 201 | background: none; 202 | } 203 | .book.color-theme-2 .book-header h1 { 204 | color: #bdcadb; 205 | } 206 | .book.color-theme-1 .book-body .navigation { 207 | color: #afa790; 208 | } 209 | .book.color-theme-1 .book-body .navigation:hover { 210 | color: #73553c; 211 | } 212 | .book.color-theme-2 .book-body .navigation { 213 | color: #383f52; 214 | } 215 | .book.color-theme-2 .book-body .navigation:hover { 216 | color: #fffff5; 217 | } 218 | /* 219 | * Theme 1 220 | */ 221 | .book.color-theme-1 .book-summary { 222 | color: #afa790; 223 | background: #111111; 224 | border-right: 1px solid rgba(0, 0, 0, 0.07); 225 | } 226 | .book.color-theme-1 .book-summary .book-search { 227 | background: transparent; 228 | } 229 | .book.color-theme-1 .book-summary .book-search input, 230 | .book.color-theme-1 .book-summary .book-search input:focus { 231 | border: 1px solid transparent; 232 | } 233 | .book.color-theme-1 .book-summary ul.summary li.divider { 234 | background: #7e888b; 235 | box-shadow: none; 236 | } 237 | .book.color-theme-1 .book-summary ul.summary li i.fa-check { 238 | color: #33cc33; 239 | } 240 | .book.color-theme-1 .book-summary ul.summary li.done > a { 241 | color: #877f6a; 242 | } 243 | .book.color-theme-1 .book-summary ul.summary li a, 244 | .book.color-theme-1 .book-summary ul.summary li span { 245 | color: #877f6a; 246 | background: transparent; 247 | font-weight: normal; 248 | } 249 | .book.color-theme-1 .book-summary ul.summary li.active > a, 250 | .book.color-theme-1 .book-summary ul.summary li a:hover { 251 | color: #704214; 252 | background: transparent; 253 | font-weight: normal; 254 | } 255 | /* 256 | * Theme 2 257 | */ 258 | .book.color-theme-2 .book-summary { 259 | color: #bcc1d2; 260 | background: #2d3143; 261 | border-right: none; 262 | } 263 | .book.color-theme-2 .book-summary .book-search { 264 | background: transparent; 265 | } 266 | .book.color-theme-2 .book-summary .book-search input, 267 | .book.color-theme-2 .book-summary .book-search input:focus { 268 | border: 1px solid transparent; 269 | } 270 | .book.color-theme-2 .book-summary ul.summary li.divider { 271 | background: #272a3a; 272 | box-shadow: none; 273 | } 274 | .book.color-theme-2 .book-summary ul.summary li i.fa-check { 275 | color: #33cc33; 276 | } 277 | .book.color-theme-2 .book-summary ul.summary li.done > a { 278 | color: #62687f; 279 | } 280 | .book.color-theme-2 .book-summary ul.summary li a, 281 | .book.color-theme-2 .book-summary ul.summary li span { 282 | color: #c1c6d7; 283 | background: transparent; 284 | font-weight: 600; 285 | } 286 | .book.color-theme-2 .book-summary ul.summary li.active > a, 287 | .book.color-theme-2 .book-summary ul.summary li a:hover { 288 | color: #f4f4f5; 289 | background: #252737; 290 | font-weight: 600; 291 | } 292 | -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-highlight/ebook.css: -------------------------------------------------------------------------------- 1 | pre, 2 | code { 3 | /* http://jmblog.github.io/color-themes-for-highlightjs */ 4 | /* Tomorrow Comment */ 5 | /* Tomorrow Red */ 6 | /* Tomorrow Orange */ 7 | /* Tomorrow Yellow */ 8 | /* Tomorrow Green */ 9 | /* Tomorrow Aqua */ 10 | /* Tomorrow Blue */ 11 | /* Tomorrow Purple */ 12 | } 13 | pre .hljs-comment, 14 | code .hljs-comment, 15 | pre .hljs-title, 16 | code .hljs-title { 17 | color: #8e908c; 18 | } 19 | pre .hljs-variable, 20 | code .hljs-variable, 21 | pre .hljs-attribute, 22 | code .hljs-attribute, 23 | pre .hljs-tag, 24 | code .hljs-tag, 25 | pre .hljs-regexp, 26 | code .hljs-regexp, 27 | pre .hljs-deletion, 28 | code .hljs-deletion, 29 | pre .ruby .hljs-constant, 30 | code .ruby .hljs-constant, 31 | pre .xml .hljs-tag .hljs-title, 32 | code .xml .hljs-tag .hljs-title, 33 | pre .xml .hljs-pi, 34 | code .xml .hljs-pi, 35 | pre .xml .hljs-doctype, 36 | code .xml .hljs-doctype, 37 | pre .html .hljs-doctype, 38 | code .html .hljs-doctype, 39 | pre .css .hljs-id, 40 | code .css .hljs-id, 41 | pre .css .hljs-class, 42 | code .css .hljs-class, 43 | pre .css .hljs-pseudo, 44 | code .css .hljs-pseudo { 45 | color: #c82829; 46 | } 47 | pre .hljs-number, 48 | code .hljs-number, 49 | pre .hljs-preprocessor, 50 | code .hljs-preprocessor, 51 | pre .hljs-pragma, 52 | code .hljs-pragma, 53 | pre .hljs-built_in, 54 | code .hljs-built_in, 55 | pre .hljs-literal, 56 | code .hljs-literal, 57 | pre .hljs-params, 58 | code .hljs-params, 59 | pre .hljs-constant, 60 | code .hljs-constant { 61 | color: #f5871f; 62 | } 63 | pre .ruby .hljs-class .hljs-title, 64 | code .ruby .hljs-class .hljs-title, 65 | pre .css .hljs-rules .hljs-attribute, 66 | code .css .hljs-rules .hljs-attribute { 67 | color: #eab700; 68 | } 69 | pre .hljs-string, 70 | code .hljs-string, 71 | pre .hljs-value, 72 | code .hljs-value, 73 | pre .hljs-inheritance, 74 | code .hljs-inheritance, 75 | pre .hljs-header, 76 | code .hljs-header, 77 | pre .hljs-addition, 78 | code .hljs-addition, 79 | pre .ruby .hljs-symbol, 80 | code .ruby .hljs-symbol, 81 | pre .xml .hljs-cdata, 82 | code .xml .hljs-cdata { 83 | color: #718c00; 84 | } 85 | pre .css .hljs-hexcolor, 86 | code .css .hljs-hexcolor { 87 | color: #3e999f; 88 | } 89 | pre .hljs-function, 90 | code .hljs-function, 91 | pre .python .hljs-decorator, 92 | code .python .hljs-decorator, 93 | pre .python .hljs-title, 94 | code .python .hljs-title, 95 | pre .ruby .hljs-function .hljs-title, 96 | code .ruby .hljs-function .hljs-title, 97 | pre .ruby .hljs-title .hljs-keyword, 98 | code .ruby .hljs-title .hljs-keyword, 99 | pre .perl .hljs-sub, 100 | code .perl .hljs-sub, 101 | pre .javascript .hljs-title, 102 | code .javascript .hljs-title, 103 | pre .coffeescript .hljs-title, 104 | code .coffeescript .hljs-title { 105 | color: #4271ae; 106 | } 107 | pre .hljs-keyword, 108 | code .hljs-keyword, 109 | pre .javascript .hljs-function, 110 | code .javascript .hljs-function { 111 | color: #8959a8; 112 | } 113 | pre .hljs, 114 | code .hljs { 115 | display: block; 116 | background: white; 117 | color: #4d4d4c; 118 | padding: 0.5em; 119 | } 120 | pre .coffeescript .javascript, 121 | code .coffeescript .javascript, 122 | pre .javascript .xml, 123 | code .javascript .xml, 124 | pre .tex .hljs-formula, 125 | code .tex .hljs-formula, 126 | pre .xml .javascript, 127 | code .xml .javascript, 128 | pre .xml .vbscript, 129 | code .xml .vbscript, 130 | pre .xml .css, 131 | code .xml .css, 132 | pre .xml .hljs-cdata, 133 | code .xml .hljs-cdata { 134 | opacity: 0.5; 135 | } 136 | -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.eot -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-katex/katex.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.eot);src:url(fonts/KaTeX_AMS-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'),url(fonts/KaTeX_AMS-Regular.woff) format('woff'),url(fonts/KaTeX_AMS-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.eot);src:url(fonts/KaTeX_Caligraphic-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.eot);src:url(fonts/KaTeX_Caligraphic-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.eot);src:url(fonts/KaTeX_Fraktur-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'),url(fonts/KaTeX_Fraktur-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.eot);src:url(fonts/KaTeX_Fraktur-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'),url(fonts/KaTeX_Fraktur-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.eot);src:url(fonts/KaTeX_Main-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Bold.woff2) format('woff2'),url(fonts/KaTeX_Main-Bold.woff) format('woff'),url(fonts/KaTeX_Main-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.eot);src:url(fonts/KaTeX_Main-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Italic.woff2) format('woff2'),url(fonts/KaTeX_Main-Italic.woff) format('woff'),url(fonts/KaTeX_Main-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.eot);src:url(fonts/KaTeX_Main-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Regular.woff2) format('woff2'),url(fonts/KaTeX_Main-Regular.woff) format('woff'),url(fonts/KaTeX_Main-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.eot);src:url(fonts/KaTeX_Math-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Math-Italic.woff2) format('woff2'),url(fonts/KaTeX_Math-Italic.woff) format('woff'),url(fonts/KaTeX_Math-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_SansSerif;src:url(fonts/KaTeX_SansSerif-Regular.eot);src:url(fonts/KaTeX_SansSerif-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'),url(fonts/KaTeX_SansSerif-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.eot);src:url(fonts/KaTeX_Script-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Script-Regular.woff2) format('woff2'),url(fonts/KaTeX_Script-Regular.woff) format('woff'),url(fonts/KaTeX_Script-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.eot);src:url(fonts/KaTeX_Size1-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size1-Regular.woff) format('woff'),url(fonts/KaTeX_Size1-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.eot);src:url(fonts/KaTeX_Size2-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size2-Regular.woff) format('woff'),url(fonts/KaTeX_Size2-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.eot);src:url(fonts/KaTeX_Size3-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size3-Regular.woff) format('woff'),url(fonts/KaTeX_Size3-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.eot);src:url(fonts/KaTeX_Size4-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size4-Regular.woff) format('woff'),url(fonts/KaTeX_Size4-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.eot);src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('ttf');font-weight:400;font-style:normal}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block}.katex{font:400 1.21em KaTeX_Main;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .textstyle>.mord+.mop{margin-left:.16667em}.katex .textstyle>.mord+.mbin{margin-left:.22222em}.katex .textstyle>.mord+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.mop,.katex .textstyle>.mop+.mord,.katex .textstyle>.mord+.minner{margin-left:.16667em}.katex .textstyle>.mop+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.minner{margin-left:.16667em}.katex .textstyle>.mbin+.minner,.katex .textstyle>.mbin+.mop,.katex .textstyle>.mbin+.mopen,.katex .textstyle>.mbin+.mord{margin-left:.22222em}.katex .textstyle>.mrel+.minner,.katex .textstyle>.mrel+.mop,.katex .textstyle>.mrel+.mopen,.katex .textstyle>.mrel+.mord{margin-left:.27778em}.katex .textstyle>.mclose+.mop{margin-left:.16667em}.katex .textstyle>.mclose+.mbin{margin-left:.22222em}.katex .textstyle>.mclose+.mrel{margin-left:.27778em}.katex .textstyle>.mclose+.minner,.katex .textstyle>.minner+.mop,.katex .textstyle>.minner+.mord,.katex .textstyle>.mpunct+.mclose,.katex .textstyle>.mpunct+.minner,.katex .textstyle>.mpunct+.mop,.katex .textstyle>.mpunct+.mopen,.katex .textstyle>.mpunct+.mord,.katex .textstyle>.mpunct+.mpunct,.katex .textstyle>.mpunct+.mrel{margin-left:.16667em}.katex .textstyle>.minner+.mbin{margin-left:.22222em}.katex .textstyle>.minner+.mrel{margin-left:.27778em}.katex .mclose+.mop,.katex .minner+.mop,.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.mop,.katex .textstyle>.minner+.minner,.katex .textstyle>.minner+.mopen,.katex .textstyle>.minner+.mpunct{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.enspace{width:.5em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border-style:solid;position:relative}.katex .overline .overline-line{width:100%}.katex .overline .overline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .overline .overline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right} -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-lunr/lunr.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 3 | * Copyright (C) 2015 Oliver Nightingale 4 | * MIT Licensed 5 | * @license 6 | */ 7 | !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\s\-]+/):[]},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;no;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n element for each result 48 | res.results.forEach(function(res) { 49 | var $li = $('
        • ', { 50 | 'class': 'search-results-item' 51 | }); 52 | 53 | var $title = $('

          '); 54 | 55 | var $link = $('', { 56 | 'href': gitbook.state.basePath + '/' + res.url, 57 | 'text': res.title 58 | }); 59 | 60 | var content = res.body.trim(); 61 | if (content.length > MAX_DESCRIPTION_SIZE) { 62 | content = content.slice(0, MAX_DESCRIPTION_SIZE).trim()+'...'; 63 | } 64 | var $content = $('

          ').html(content); 65 | 66 | $link.appendTo($title); 67 | $title.appendTo($li); 68 | $content.appendTo($li); 69 | $li.appendTo($searchList); 70 | }); 71 | } 72 | 73 | function launchSearch(q) { 74 | // Add class for loading 75 | $body.addClass('with-search'); 76 | $body.addClass('search-loading'); 77 | 78 | // Launch search query 79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS) 80 | .then(function(results) { 81 | displayResults(results); 82 | }) 83 | .always(function() { 84 | $body.removeClass('search-loading'); 85 | }), 1000); 86 | } 87 | 88 | function closeSearch() { 89 | $body.removeClass('with-search'); 90 | $bookSearchResults.removeClass('open'); 91 | } 92 | 93 | function launchSearchFromQueryString() { 94 | var q = getParameterByName('q'); 95 | if (q && q.length > 0) { 96 | // Update search input 97 | $searchInput.val(q); 98 | 99 | // Launch search 100 | launchSearch(q); 101 | } 102 | } 103 | 104 | function bindSearch() { 105 | // Bind DOM 106 | $searchInput = $('#book-search-input input'); 107 | $bookSearchResults = $('#book-search-results'); 108 | $searchList = $bookSearchResults.find('.search-results-list'); 109 | $searchTitle = $bookSearchResults.find('.search-results-title'); 110 | $searchResultsCount = $searchTitle.find('.search-results-count'); 111 | $searchQuery = $searchTitle.find('.search-query'); 112 | 113 | // Launch query based on input content 114 | function handleUpdate() { 115 | var q = $searchInput.val(); 116 | 117 | if (q.length == 0) { 118 | closeSearch(); 119 | } 120 | else { 121 | launchSearch(q); 122 | } 123 | } 124 | 125 | // Detect true content change in search input 126 | // Workaround for IE < 9 127 | var propertyChangeUnbound = false; 128 | $searchInput.on('propertychange', function(e) { 129 | if (e.originalEvent.propertyName == 'value') { 130 | handleUpdate(); 131 | } 132 | }); 133 | 134 | // HTML5 (IE9 & others) 135 | $searchInput.on('input', function(e) { 136 | // Unbind propertychange event for IE9+ 137 | if (!propertyChangeUnbound) { 138 | $(this).unbind('propertychange'); 139 | propertyChangeUnbound = true; 140 | } 141 | 142 | handleUpdate(); 143 | }); 144 | 145 | // Push to history on blur 146 | $searchInput.on('blur', function(e) { 147 | // Update history state 148 | if (usePushState) { 149 | var uri = updateQueryString('q', $(this).val()); 150 | history.pushState({ path: uri }, null, uri); 151 | } 152 | }); 153 | } 154 | 155 | gitbook.events.on('page.change', function() { 156 | bindSearch(); 157 | closeSearch(); 158 | 159 | // Launch search based on query parameter 160 | if (gitbook.search.isInitialized()) { 161 | launchSearchFromQueryString(); 162 | } 163 | }); 164 | 165 | gitbook.events.on('search.ready', function() { 166 | bindSearch(); 167 | 168 | // Launch search from query param at start 169 | launchSearchFromQueryString(); 170 | }); 171 | 172 | function getParameterByName(name) { 173 | var url = window.location.href; 174 | name = name.replace(/[\[\]]/g, '\\$&'); 175 | var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i'), 176 | results = regex.exec(url); 177 | if (!results) return null; 178 | if (!results[2]) return ''; 179 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 180 | } 181 | 182 | function updateQueryString(key, value) { 183 | value = encodeURIComponent(value); 184 | 185 | var url = window.location.href; 186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'), 187 | hash; 188 | 189 | if (re.test(url)) { 190 | if (typeof value !== 'undefined' && value !== null) 191 | return url.replace(re, '$1' + key + '=' + value + '$2$3'); 192 | else { 193 | hash = url.split('#'); 194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); 195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 196 | url += '#' + hash[1]; 197 | return url; 198 | } 199 | } 200 | else { 201 | if (typeof value !== 'undefined' && value !== null) { 202 | var separator = url.indexOf('?') !== -1 ? '&' : '?'; 203 | hash = url.split('#'); 204 | url = hash[0] + separator + key + '=' + value; 205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 206 | url += '#' + hash[1]; 207 | return url; 208 | } 209 | else 210 | return url; 211 | } 212 | } 213 | }); 214 | -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-sharing/buttons.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | var SITES = { 3 | 'facebook': { 4 | 'label': 'Facebook', 5 | 'icon': 'fa fa-facebook', 6 | 'onClick': function(e) { 7 | e.preventDefault(); 8 | window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href)); 9 | } 10 | }, 11 | 'twitter': { 12 | 'label': 'Twitter', 13 | 'icon': 'fa fa-twitter', 14 | 'onClick': function(e) { 15 | e.preventDefault(); 16 | window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href)); 17 | } 18 | }, 19 | 'google': { 20 | 'label': 'Google+', 21 | 'icon': 'fa fa-google-plus', 22 | 'onClick': function(e) { 23 | e.preventDefault(); 24 | window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href)); 25 | } 26 | }, 27 | 'weibo': { 28 | 'label': 'Weibo', 29 | 'icon': 'fa fa-weibo', 30 | 'onClick': function(e) { 31 | e.preventDefault(); 32 | window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)); 33 | } 34 | }, 35 | 'instapaper': { 36 | 'label': 'Instapaper', 37 | 'icon': 'fa fa-instapaper', 38 | 'onClick': function(e) { 39 | e.preventDefault(); 40 | window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href)); 41 | } 42 | }, 43 | 'vk': { 44 | 'label': 'VK', 45 | 'icon': 'fa fa-vk', 46 | 'onClick': function(e) { 47 | e.preventDefault(); 48 | window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href)); 49 | } 50 | } 51 | }; 52 | 53 | 54 | 55 | gitbook.events.bind('start', function(e, config) { 56 | var opts = config.sharing; 57 | 58 | // Create dropdown menu 59 | var menu = $.map(opts.all, function(id) { 60 | var site = SITES[id]; 61 | 62 | return { 63 | text: site.label, 64 | onClick: site.onClick 65 | }; 66 | }); 67 | 68 | // Create main button with dropdown 69 | if (menu.length > 0) { 70 | gitbook.toolbar.createButton({ 71 | icon: 'fa fa-share-alt', 72 | label: 'Share', 73 | position: 'right', 74 | dropdown: [menu] 75 | }); 76 | } 77 | 78 | // Direct actions to share 79 | $.each(SITES, function(sideId, site) { 80 | if (!opts[sideId]) return; 81 | 82 | gitbook.toolbar.createButton({ 83 | icon: site.icon, 84 | label: site.text, 85 | position: 'right', 86 | onClick: site.onClick 87 | }); 88 | }); 89 | }); 90 | }); 91 | -------------------------------------------------------------------------------- /docs/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /docs/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheogo/learn-javascript/0d441b241553a3277de90d996f4efbb740e18404/docs/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 目录 · GitBook 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |

          72 |
          73 | 74 | 75 | 78 | 79 | 80 | 251 | 252 | 253 |
          254 | 255 |
          256 | 257 |
          258 | 259 | 260 | 261 | 270 | 271 | 272 | 273 | 274 |
          275 |
          276 | 277 |
          278 |
          279 | 280 |
          281 | 282 |

          《前端基础漫游指南》

          283 |

          欢迎 Star,关注请 Watch,探讨 Issues。

          284 |

          目录

          285 | 297 | 298 | 299 |
          300 | 301 |
          302 |
          303 |
          304 | 305 |

          results matching ""

          306 |
            307 | 308 |
            309 |
            310 | 311 |

            No results matching ""

            312 | 313 |
            314 |
            315 |
            316 | 317 |
            318 |
            319 | 320 |
            321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 |
            332 | 333 | 339 |
            340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "learn-javascript", 3 | "version": "1.0.0", 4 | "description": "欢迎 Star,关注请 Watch", 5 | "main": "index.js", 6 | "directories": { 7 | "doc": "docs" 8 | }, 9 | "dependencies": { 10 | "gitbook-plugin-comment": "^1.0.5", 11 | "gitbook-plugin-disqus": "^0.1.0", 12 | "gitbook-plugin-katex": "^1.1.4" 13 | }, 14 | "devDependencies": {}, 15 | "scripts": { 16 | "serve": "gitbook serve ./ ./docs", 17 | "build": "gitbook build ./ ./docs" 18 | }, 19 | "keywords": [ 20 | "javascript", 21 | "nodejs" 22 | ], 23 | "author": "xiaomuchen", 24 | "license": "MIT" 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "learn-javascript", 3 | "version": "1.0.0", 4 | "description": "欢迎 Star,关注请 Watch", 5 | "main": "index.js", 6 | "directories": { 7 | "doc": "docs" 8 | }, 9 | "dependencies": { 10 | "gitbook-plugin-comment": "^1.0.5", 11 | "gitbook-plugin-disqus": "^0.1.0", 12 | "gitbook-plugin-katex": "^1.1.4" 13 | }, 14 | "devDependencies": {}, 15 | "scripts": { 16 | "serve": "gitbook serve ./ ./docs", 17 | "build": "gitbook build ./ ./docs" 18 | }, 19 | "keywords": [ 20 | "javascript", 21 | "nodejs" 22 | ], 23 | "author": "xiaomuchen", 24 | "license": "MIT" 25 | } 26 | --------------------------------------------------------------------------------