From 5107671a2846e53caf8e3da3ae3ec2fd122c76ac Mon Sep 17 00:00:00 2001 From: ruanyf Date: Sun, 20 Apr 2014 21:02:54 +0800 Subject: [PATCH] initial commit --- LICENSE | 22 + README.md | 15 + .../normalize-css/.bower.json | 24 + app/bower_components/normalize-css/LICENSE.md | 19 + app/bower_components/normalize-css/README.md | 57 +++ app/bower_components/normalize-css/bower.json | 13 + .../normalize-css/normalize.css | 425 ++++++++++++++++++ css/app.css | 261 +++++++++++ css/normalize.css | 1 + index.html | 40 ++ intro.md | 25 ++ sidebar.md | 7 + 12 files changed, 909 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 app/bower_components/normalize-css/.bower.json create mode 100644 app/bower_components/normalize-css/LICENSE.md create mode 100644 app/bower_components/normalize-css/README.md create mode 100644 app/bower_components/normalize-css/bower.json create mode 100644 app/bower_components/normalize-css/normalize.css create mode 100644 css/app.css create mode 120000 css/normalize.css create mode 100644 index.html create mode 100644 intro.md create mode 100644 sidebar.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..eecb76bc1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +# Creative Commons Attribution-NonCommercial 4.0 International License + +Disclaimer: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-nc/4.0/legalcode). + +You are free to: + +- Share — copy and redistribute the material in any medium or format +- Adapt — remix, transform, and build upon the material + +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. +- NonCommercial — You may not use the material for commercial purposes. +- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation. + +No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material. diff --git a/README.md b/README.md new file mode 100644 index 000000000..4223e8d98 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# ECMAScript 6入门 + +《ECMAScript 6入门》是一本开源的JavaScript语言教程,介绍ECMAScript 6新增的语法特性。 + +本书力争覆盖ES6与ES5的所有不同之处,对涉及的语法知识给予详细介绍,并给出大量简洁易懂的示例代码。 + +本书为中级难度,适合已有一定JavaScript语言基础的读者,了解这门语言的最新进展;也可当作参考手册,查寻新增的语法点。 + +## 版权许可 + +本书采用“保持署名—非商用”创意共享4.0许可证。 + +只要保持原作者署名和非商用,您可以自由地阅读、分享、修改本书。 + +详细的法律条文请参加[创意共享](http://creativecommons.org/licenses/by-nc/4.0/)网站。 diff --git a/app/bower_components/normalize-css/.bower.json b/app/bower_components/normalize-css/.bower.json new file mode 100644 index 000000000..a3bb648e8 --- /dev/null +++ b/app/bower_components/normalize-css/.bower.json @@ -0,0 +1,24 @@ +{ + "name": "normalize-css", + "version": "3.0.1", + "main": "normalize.css", + "author": "Nicolas Gallagher", + "ignore": [ + "CHANGELOG.md", + "CONTRIBUTING.md", + "component.json", + "package.json", + "test.html" + ], + "homepage": "https://github.com/necolas/normalize.css", + "_release": "3.0.1", + "_resolution": { + "type": "version", + "tag": "3.0.1", + "commit": "e3c71c911b0c0ebc0ee14d2421543ce1476fd761" + }, + "_source": "git://github.com/necolas/normalize.css.git", + "_target": "~3.0.1", + "_originalSource": "normalize-css", + "_direct": true +} \ No newline at end of file diff --git a/app/bower_components/normalize-css/LICENSE.md b/app/bower_components/normalize-css/LICENSE.md new file mode 100644 index 000000000..c6bcc9bf2 --- /dev/null +++ b/app/bower_components/normalize-css/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (c) Nicolas Gallagher and Jonathan Neal + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/app/bower_components/normalize-css/README.md b/app/bower_components/normalize-css/README.md new file mode 100644 index 000000000..80ec51a20 --- /dev/null +++ b/app/bower_components/normalize-css/README.md @@ -0,0 +1,57 @@ +# normalize.css v3 + +Normalize.css is a customisable CSS file that makes browsers render all +elements more consistently and in line with modern standards. + +The project relies on researching the differences between default browser +styles in order to precisely target only the styles that need or benefit from +normalizing. + +[View the test file](http://necolas.github.io/normalize.css/latest/test.html) + +## Install + +Download from the [project page](http://necolas.github.io/normalize.css/). + +Install with [Component(1)](https://github.com/component/component/): `component install necolas/normalize.css` + +Install with [npm](http://npmjs.org/): `npm install --save normalize.css` + +Install with [Bower](http://bower.io/): `bower install --save normalize.css` + +## What does it do? + +* Preserves useful defaults, unlike many CSS resets. +* Normalizes styles for a wide range of elements. +* Corrects bugs and common browser inconsistencies. +* Improves usability with subtle improvements. +* Explains what code does using detailed comments. + +## How to use it + +No other styles should come before Normalize.css. + +It is recommended that you include the `normalize.css` file as untouched +library code. + +## Browser support + +* Google Chrome (latest) +* Mozilla Firefox (latest) +* Mozilla Firefox 4 +* Opera (latest) +* Apple Safari 6+ +* Internet Explorer 8+ + +[Normalize.css v1 provides legacy browser +support](https://github.com/necolas/normalize.css/tree/v1) (IE 6+, Safari 4+), +but is no longer actively developed. + +## Contributing + +Please read the CONTRIBUTING.md + +## Acknowledgements + +Normalize.css is a project by [Nicolas Gallagher](https://github.com/necolas), +co-created with [Jonathan Neal](https://github.com/jonathantneal). diff --git a/app/bower_components/normalize-css/bower.json b/app/bower_components/normalize-css/bower.json new file mode 100644 index 000000000..9ddcdd0ae --- /dev/null +++ b/app/bower_components/normalize-css/bower.json @@ -0,0 +1,13 @@ +{ + "name": "normalize-css", + "version": "3.0.1", + "main": "normalize.css", + "author": "Nicolas Gallagher", + "ignore": [ + "CHANGELOG.md", + "CONTRIBUTING.md", + "component.json", + "package.json", + "test.html" + ] +} diff --git a/app/bower_components/normalize-css/normalize.css b/app/bower_components/normalize-css/normalize.css new file mode 100644 index 000000000..08f895079 --- /dev/null +++ b/app/bower_components/normalize-css/normalize.css @@ -0,0 +1,425 @@ +/*! normalize.css v3.0.1 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/css/app.css b/css/app.css new file mode 100644 index 000000000..0a8d1a263 --- /dev/null +++ b/css/app.css @@ -0,0 +1,261 @@ +/* General Setting */ + +/* Small screens (default) */ +html { font-size: 100%; } + +/* Medium screens (640px) */ +@media (min-width: 40rem) { + html { font-size: 112%; } +} + +/* Large screens (1024px) */ +@media (min-width: 64rem) { + html { font-size: 120%; } +} + +/* Grid */ + +/* Ditto */ + +body { + color: #333; + margin: 0; + padding: 0; + + font-family: Verdana, Arial; + font-size: 0.8em; +} + +#sidebar { + position: fixed; + width: 220px; + height: 100%; + + overflow-y: scroll; + overflow: -moz-scrollbars-vertical; + + margin-right: 20px; + margin-top: 0; + padding-left: 25px; + padding-top: 0; + + box-shadow: 0 0 40px #CCC; + -webkit-box-shadow: 0 0 40px #CCC; + -moz-box-shadow: 0 0 40px #CCC; + border-right: 1px solid #BBB; +} + +#sidebar h1 { + font-size: 25px; + margin-bottom: 0px; + padding-bottom: 0px; +} + +#sidebar h1 a:link, #sidebar h1 a:visited { + color: #333; +} + +#sidebar h2 { + font-size: 15px; +} + +#sidebar h5 { + margin-top: 20px; + margin-bottom: 0; +} + +#sidebar a:visited, #sidebar a:link { + color: #4682BE; + text-decoration: none; +} + +#sidebar ul { + list-style-type: none; + margin: 0; + padding-left: 10px; + padding-top: 0; +} + +#sidebar ul li:before { /* a hack to have dashes as a list style */ + content: "-"; + position: relative; + left: -5px; +} + +#sidebar ul li { + margin-top: 0; + margin-bottom: 2px; + margin-left: 10px; + padding: 0; + + text-indent: -5px; /* to compensate for the padding for the dash */ + font-size: 12px; +} + +#content { + width: 580px; + + margin-left: 300px; + padding-top: 10px; + padding-bottom: 150px; + + text-align: justify; + font-size: 13px; + + /* border: 1px solid black; */ +} + +#content pre { + margin-left: auto; + margin-right: auto; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 13px; + + color: #FFF; + + background: #444; + border-radius: 5px; +} + +#content code { + padding-left: 5px; + padding-right: 5px; + + color: #FFF; + font-size: 10px; + font-weight: normal; + font-family: Consolas, monospace; + + background: #444; + border-radius: 2px; +} + +#content h2 { + margin-top: 50px; + margin-bottom: 0px; + + padding-top: 20px; + padding-bottom: 0px; + + font-size: 18px; + text-align: left; + + border-top: 2px solid #666; +} + +#content h3 { + margin-top: 50px; + margin-bottom: 0px; + + padding-top: 20px; + padding-bottom: 0px; + + text-align: left; + border-top: 1px dotted #777; +} + +#content img { + max-width: 90%; + display: block; + + margin-left: auto; + margin-right: auto; + margin-top: 40px; + margin-bottom: 40px; + + border-radius: 5px; +} + +#content ul { + display: block; + list-style-type: none; +} + +#content ul li:before { /* a hack to have dashes as a list style */ + content: "-"; + position: relative; + left: -5px; +} + +#content ul li { + text-indent: -5px; /* to compensate for the padding for the dash */ + font-size: 13px; +} + +#content ul li.link { + color: #4682BE; + text-decoration: none; + font-size: 13px; + font-weight: bold; + cursor: pointer; +} + +#content a:link, #content a:visited { + color: #4682BE; + text-decoration: none; +} + +#back_to_top { + display: none; + position: fixed; + + height: 20px; + width: 70px; + top: 20px; + + margin-left: 890px; + margin-top: 0px; + + color: #FFF; + line-height: 20px; + text-align: center; + font-size: 10px; + + + border-radius: 5px; + background-color: #AAA; +} + +#back_to_top:hover { + background-color: #444; + cursor: pointer; +} + +#edit { + display: none; + position: fixed; + + height: 17px; + width: 70px; + top: 45px; + + margin-left: 890px; + margin-top: 0px; + + color: #FFF; + line-height: 17px; + text-align: center; + font-size: 10px; + + + border-radius: 5px; + background-color: #AAA; +} + +#edit:hover { + background-color: #444; + cursor: pointer; +} + +#loading, #error { + display: none; + position: fixed; + + height: 17px; + top: 45%; + + margin-left: 560px; + + font-size: 14px; +} diff --git a/css/normalize.css b/css/normalize.css new file mode 120000 index 000000000..3d9454653 --- /dev/null +++ b/css/normalize.css @@ -0,0 +1 @@ +../app/bower_components/normalize-css/normalize.css \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 000000000..eb890fa55 --- /dev/null +++ b/index.html @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + +
+ + +
back to top
+
edit
+
Loading ...
+
Opps! ... File not found!
+ + + + diff --git a/intro.md b/intro.md new file mode 100644 index 000000000..3c2a807b3 --- /dev/null +++ b/intro.md @@ -0,0 +1,25 @@ +# ECMAScript 6简介 + +ECMAScript是JavaScript语言的国际标准,JavaScript是ECMAScript的实现。 + +1996年11月,JavaScript的创造者Netscape公司,决定将JavaScript提交给国际标准化组织ECMA,希望这种语言能够成为国际标准。次年,ECMA发布262号标准文件(ECMA-262)的第一版,规定了浏览器脚本语言的标准,并将这种语言称为ECMAScript。这个版本就是ECMAScript 1.0版。 + +之所以不叫JavaScript,有两个原因。一是商标,Java是Sun公司的商标,根据授权协议,只有Netscape公司可以合法地使用JavaScript这个名字,且JavaScript本身也已经被Netscape公司注册为商标。二是想体现这门语言的制定者是ECMA,不是Netscape,这样有利于保证这门语言的开放性和中立性。因此,ECMAScript和JavaScript的关系是,前者是后者的规格,后者是前者的一种实现。在日常场合,这两个词是可以互换的。 + +1998年6月,ECMAScript 2.0版发布。 + +1999年12月,ECMAScript 3.0版发布,成为JavaScript的通行标准,得到了广泛支持。 + +2008年7月,由于对于下一个版本应该包括哪些功能,各方差异太大,争论过于激进,ECMA开会决定,中止ECMAScript 4.0的开发,将其中涉及现有功能改善的一小部分,发布为ECMAScript 3.1,而将其他激进的设想扩大范围,放入以后的版本,由于会议的气氛,该版本的项目代号起名为Harmony(和谐)。会后不久,ECMAScript 3.1就改名为ECMAScript 5。 + +2009年9月,ECMAScript 5.0版正式发布。Harmony项目则一分为二,一些较为可行的设想定名为Javascript.next继续开发,后来演变成ECMAScript 6;一些不是很成熟的设想,则被视为JavaScript.next.next,在更远的将来再考虑推出。 + +2011年6月,ECMAscript 5.1版发布,并且成为ISO国际标准(ISO/IEC 16262:2011)。 + +2013年3月,ECMAScript 6草案冻结,不再添加新功能。新的功能设想将被放到ECMAScript 7。 + +2013年12月,ECMAScript 6草案预计将会发布。然后是12个月的讨论期,听取各方反馈。 + +2014年12月,ECMAScript 6预计将发布正式版本。 + +ECMA的第39号技术专家委员会(Technical Committee 39,简称TC39)负责制订ECMAScript标准,成员包括Microsoft、Mozilla、Google等。TC39的总体考虑是,ECMAScript 5与ECMAScript 3基本保持兼容,较大的语法修正和新功能加入,将由JavaScript.next完成。当前,JavaScript.next指的是ECMAScript 6,当第六版发布以后,将指ECMAScript 7。TC39预计,ECMAScript 5会在2013年的年中成为JavaScript开发的主流标准,并在今后五年中一直保持这个位置。 diff --git a/sidebar.md b/sidebar.md new file mode 100644 index 000000000..57f1eb58d --- /dev/null +++ b/sidebar.md @@ -0,0 +1,7 @@ +# ECMAScript 6 入门 + +作者:阮一峰 + +1. [ECMAScript 6简介](#docs/intro) + +- [Github Repository](http://github.com/ruanyf/es6tutorial/)