From 038dc47828251752fb2bfc11f738301522edc249 Mon Sep 17 00:00:00 2001 From: Alexey Belousov Date: Sun, 22 Sep 2013 20:31:30 +0600 Subject: [PATCH 1/4] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D1=82=D0=BA=D0=B0?= =?UTF-8?q?=20JavaScript=5FEnlightenment.pdf=20=D0=B2=20=D0=BC=D0=BC=20?= =?UTF-8?q?=D0=BE=5F=D0=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + JavaScript_Enlightenment.MD | 16 + JavaScript_Enlightenment.html | 109 +++++++ css/main.css | 73 +++++ css/normalize.css | 533 ++++++++++++++++++++++++++++++++++ image/code-begin.png | Bin 0 -> 961 bytes image/code-end.png | Bin 0 -> 934 bytes image/h1.png | Bin 0 -> 931 bytes image/h2.png | Bin 0 -> 927 bytes 9 files changed, 732 insertions(+) create mode 100644 .gitignore create mode 100644 JavaScript_Enlightenment.MD create mode 100644 JavaScript_Enlightenment.html create mode 100644 css/main.css create mode 100644 css/normalize.css create mode 100644 image/code-begin.png create mode 100644 image/code-end.png create mode 100644 image/h1.png create mode 100644 image/h2.png diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/JavaScript_Enlightenment.MD b/JavaScript_Enlightenment.MD new file mode 100644 index 0000000..8db68fb --- /dev/null +++ b/JavaScript_Enlightenment.MD @@ -0,0 +1,16 @@ +# Fonts + +[SO question](http://superuser.com/questions/117443/how-to-know-which-fonts-are-used-in-selected-part-of-a-pdf-document). + +```xpdfbin-win-3.03\bin64\pdffonts.exe -f 1 -l 1 C:\Users\alex\Downloads\JavaScript_Enlightenment.pdf + +
+    name                                 type              emb sub uni object ID
+    ------------------------------------ ----------------- --- --- --- ---------
+    IDJMWJ+ArialNarrow                   TrueType          yes yes no       8  0
+    KDOYAX+Tahoma-Bold                   TrueType          yes yes no      10  0
+    YNNMXN+Helvetica                     TrueType          yes yes yes     12  0
+    ORHRTX+Helvetica                     TrueType          yes yes no      18  0
+    DLGPBW+Helvetica                     TrueType          yes yes no       9  0
+    EJLCOX+Courier-Bold                  TrueType          yes yes no      14  0
+
\ No newline at end of file diff --git a/JavaScript_Enlightenment.html b/JavaScript_Enlightenment.html new file mode 100644 index 0000000..387ebb3 --- /dev/null +++ b/JavaScript_Enlightenment.html @@ -0,0 +1,109 @@ + + + + + + JavaScript_Enlightenment.pdf + + + + + + + +
+
+
+
+

Preface

+ +

Before you begin, it is important to understand various styles employed in this book. Please do not + skip + this section, because it contains important information that will aid you as you read the book.

+ +

More code, less words

+ +

Please examine the code examples in detail. The text should be viewed as secondary to the code + itself. + It is my opinion that a code example is worth a thousand words. Do not worry if youʼre initially + confused + by explanations. Examine the code. Tinker with it. Reread the code comments. Repeat this process + until the concept being explained becomes clear. + I hope you achieve a level of expertise such that welldocumented code is all you need to grok + a programming concept.

+ +

Exhaustive code and repetition

+ +

You will probably curse me for repeating myself and for being so comprehensive with my code + examples. And while I might deserve it, I prefer to err on the side of being exact, verbose, and + repetitive, rather than make false assumptions authors often make about their reader. Yes, both can + be + annoying, depending upon what knowledge you bring to the subject, but they can also serve a useful + purpose for those who want to learn a subject in detail.

+ +

Color-coding Conventions

+ +

In the JavaScript code examples (example shown below), orange is used to highlight code directly + relevant to the concept being discussed. Any additional code used to support the orange colored code + will be green. The color gray in the code examples is reserved for JavaScript comments (example + shown below).

+ +
+ +
<!DOCTYPE html><html lang="en"><body><script>
+
+ +
+
+
+
+
// this is a comment about a specific part of the code
+var foo = 'calling out this part of the code';
+</script></body></html>
+
+ +

In addition to code examples being color-coded, the text in this book is colored so as to denote + JavaScript words/keywords v.s. JavaScript code v.s. regular text. Below, I take an excerpt from the + book to demonstrate this coloring semantic.

+ +

"Consider that the cody object created from the + Object() constructor function (i.e var cody = new + Object()) is not really different from a string object created via + the String() constructor function. To + drive this fact home, examine the code below:"

+ +

Notice the use of gray italic text for code references, orange text for JavaScript words/keywords, and + regular black text for everything in-between.

+ +

jsFiddle, JS Bin, and Firebug lite-dev

+ +

The majority of code examples in this book are linked to a corresponding jsFiddle page, where the code + can be tweaked and executed online. The jsFiddle examples have been configured to use the + Firebug + lite-dev plugin so that the log function (i.e. console.log) will work in most any modern browser + regardless of if the browser has its own console. Before reading this book make sure you are + comfortable with the + usage and + purpose of console.log.

+ +

In situations where jsFiddle & Firebug lite-dev caused complications with the JavaScript code + JS Bin & Firebug Lite-dev will be used. + I've tried to avoid a dependency on a browser console by using Firebug + lite-dev but with certain code examples the solution itself gets in the way of code execution. In these + situations the console built into your web browser will have to be leveraged to output logs. If you are not + using a browser with a built in JavaScript console I would suggest + upgrading or switching browsers.

+ +

When JS Bin is used, keep in mind that the code has to be executed manually (clicking 'Render') which + differs from the page load execution done by jsFiddle.

+
+ +
+
+ + + diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..99a0fe7 --- /dev/null +++ b/css/main.css @@ -0,0 +1,73 @@ +html { + background: #cccccc; + + font-family: "Tahoma", sans-serif; + font-size: 14px; + line-height: 1.5; +} +h1 { + color: #444444; + font-size: 36px; + font-family: "Helvetica", sans-serif; + font-weight: normal; + text-align: right; + background: url(../image/h1.png) left bottom transparent repeat-x; + padding-bottom: 4mm; + margin: 0 0 28mm; +} +h2 { + font-size: 18px; + margin: 16mm 0 5mm; + padding-bottom: 3mm; + color: #444444; + background: url(../image/h2.png) left bottom transparent repeat-x; +} +p { + margin: 0 0 9mm 0; +} +pre { + margin: 0; +} +code { + color: #37571e; + font-family: Courier, "Courier New", monospace; +} +code .comment { + color: #7a7a7a; +} +code .string { + color: #b45e09; +} +.code-block-begin { + background: url(../image/code-begin.png) left bottom transparent repeat-x; + height: 22px; + margin-bottom: 4mm; +} +.code-block-end { + background: url(../image/code-end.png) left bottom transparent repeat-x; + height: 4px; + margin: 3mm 0 9mm; +} +.pdf {} +.pdf .page { + width: 210mm; + height: 297mm; + box-shadow: 0 2px 5px 2px gray; + background: #FFF; + margin: 5px auto 30px; + position: relative; + padding: 15mm 20mm; + box-sizing: border-box; +} +.pdf .body {} +.pdf .header {} +.pdf .footer { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 10mm; +} +.pdf .footer .page-num { + text-align: center; +} \ No newline at end of file diff --git a/css/normalize.css b/css/normalize.css new file mode 100644 index 0000000..8d57e3c --- /dev/null +++ b/css/normalize.css @@ -0,0 +1,533 @@ +/*! normalize.css v1.1.1 | MIT License | git.io/normalize */ + +/* ========================================================================== + HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. + * Known issue: no IE 6 support. + */ + +[hidden] { + display: none; +} + +/* ========================================================================== + Base + ========================================================================== */ + +/** + * 1. Prevent system color scheme's background color being used in Firefox, IE, + * and Opera. + * 2. Prevent system color scheme's text color being used in Firefox, IE, and + * Opera. + * 3. Correct text resizing oddly in IE 6/7 when body `font-size` is set using + * `em` units. + * 4. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + background: #fff; /* 1 */ + color: #000; /* 2 */ + font-size: 100%; /* 3 */ + -webkit-text-size-adjust: 100%; /* 4 */ + -ms-text-size-adjust: 100%; /* 4 */ +} + +/** + * Address `font-family` inconsistency between `textarea` and other form + * elements. + */ + +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} + +/** + * Address margins handled incorrectly in IE 6/7. + */ + +body { + margin: 0; +} + +/* ========================================================================== + Links + ========================================================================== */ + +/** + * Address `outline` inconsistency between Chrome and other browsers. + */ + +a:focus { + outline: thin dotted; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* ========================================================================== + Typography + ========================================================================== */ + +/** + * Address font sizes and margins set differently in IE 6/7. + * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, + * and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +h2 { + font-size: 1.5em; + margin: 0.83em 0; +} + +h3 { + font-size: 1.17em; + margin: 1em 0; +} + +h4 { + font-size: 1em; + margin: 1.33em 0; +} + +h5 { + font-size: 0.83em; + margin: 1.67em 0; +} + +h6 { + font-size: 0.67em; + margin: 2.33em 0; +} + +/** + * Address styling not present in IE 7/8/9, Safari 5, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +blockquote { + margin: 1em 40px; +} + +/** + * Address styling not present in Safari 5 and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address differences between Firefox and other browsers. + * Known issue: no IE 6/7 normalization. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Address styling not present in IE 6/7/8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address margins set differently in IE 6/7. + */ + +p, +pre { + margin: 1em 0; +} + +/** + * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; +} + +/** + * Improve readability of pre-formatted text in all browsers. + */ + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +/** + * Address CSS quotes not supported in IE 6/7. + */ + +q { + quotes: none; +} + +/** + * Address `quotes` property not supported in Safari 4. + */ + +q:before, +q:after { + content: ''; + content: none; +} + +/** + * 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; +} + +/* ========================================================================== + Lists + ========================================================================== */ + +/** + * Address margins set differently in IE 6/7. + */ + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +/** + * Address paddings set differently in IE 6/7. + */ + +menu, +ol, +ul { + padding: 0 0 0 40px; +} + +/** + * Correct list images handled incorrectly in IE 7. + */ + +nav ul, +nav ol { + list-style: none; + list-style-image: none; +} + +/* ========================================================================== + Embedded content + ========================================================================== */ + +/** + * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. + * 2. Improve image quality when scaled in IE 7. + */ + +img { + border: 0; /* 1 */ + -ms-interpolation-mode: bicubic; /* 2 */ +} + +/** + * Correct overflow displayed oddly in IE 9. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* ========================================================================== + Figures + ========================================================================== */ + +/** + * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. + */ + +figure { + margin: 0; +} + +/* ========================================================================== + Forms + ========================================================================== */ + +/** + * Correct margin displayed oddly in IE 6/7. + */ + +form { + margin: 0; +} + +/** + * 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 6/7/8/9. + * 2. Correct text not wrapping in Firefox 3. + * 3. Correct alignment displayed oddly in IE 6/7. + */ + +legend { + border: 0; /* 1 */ + padding: 0; + white-space: normal; /* 2 */ + *margin-left: -7px; /* 3 */ +} + +/** + * 1. Correct font size not being inherited in all browsers. + * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, + * and Chrome. + * 3. Improve appearance and consistency in all browsers. + */ + +button, +input, +select, +textarea { + font-size: 100%; /* 1 */ + margin: 0; /* 2 */ + vertical-align: baseline; /* 3 */ + *vertical-align: middle; /* 3 */ +} + +/** + * Address Firefox 3+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +button, +input { + line-height: normal; +} + +/** + * 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 Chrome, Safari 5+, and IE 6+. + * Correct `select` style inheritance in Firefox 4+ and Opera. + */ + +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. + * 4. Remove inner spacing in IE 7 without affecting normal text inputs. + * Known issue: inner spacing remains in IE 6. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ + *overflow: visible; /* 4 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * 1. Address box sizing set to content-box in IE 8/9. + * 2. Remove excess padding in IE 8/9. + * 3. Remove excess padding in IE 7. + * Known issue: excess padding remains in IE 6. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ + *height: 13px; /* 3 */ + *width: 13px; /* 3 */ +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari 5 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 5 and Chrome + * on OS X. + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Remove inner padding and border in Firefox 3+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * 1. Remove default vertical scrollbar in IE 6/7/8/9. + * 2. Improve readability and alignment in all browsers. + */ + +textarea { + overflow: auto; /* 1 */ + vertical-align: top; /* 2 */ +} + +/* ========================================================================== + Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/image/code-begin.png b/image/code-begin.png new file mode 100644 index 0000000000000000000000000000000000000000..4a739c67b423f6309b651e9eae21f6ac712a8667 GIT binary patch literal 961 zcmaJ=zi-n(7sR}<^x7(p zS@kYZFu{l@2p7@>Yq^4k2^f7)L<^m5tzlG0vBXY?9nJ#{p>DS;cQY~zcMwrk6=4M_ zN?IV&(SgscIPFJEV+DgocIXD&Wj;t0tv1`|IuuUNQ}BX`tRIcaBnpOND?miXNlIg& zY5pJTc@uQR8}!2OKZT>_K|oQ1Mr=Q{#l>weC7}YX98!z3u*uloxQg`-<1Fg10F*a# zG67qz@33w(#G9s8^CNEgHmw;t6biEIIvOtJOE^;{N=7AwR5Ht@JXu~gszoJREflhN z%r%(3?@^zRxy}VwnaWLC!3#uWgNE)C>QqDKfnmy;JJn02I#qAPb*6j4Q@Kc(LCMAb zb(zaqVX?*I7ZVyFU_oX%zPa;<{ip}_Q``6&>?2Y&R)%9zGqvxs9!C>Y~ z|Nhx+c>T@O@`uA$Cr3Zej$iz^dc1g;y1XD=`F7{gr-jp($)l=OHjKBWhsS>aCoNf`*1&iA3`dEV!J@4e^k*8Sa`y&XXicI_jx!{;k} zY+t|1{~z9d4Ec16S$)=}LzcM-5e|JiAixgYQ_>->KYjF>)CFNn40?UmcaAlWhLT%g zq&$o{TM+68dF*;)!oYx>29YlQc=uiefv<}vRR=k-K}NyREFs-ltLM$ep6ZJScR@YZ zxIjpl3-a(hO0`@U7rGi>7spTp3kVzQ;)SWc(*_1j2&hV^?{ihg!#ME@SbXE{+(BH3+jTld`fzlT(OQRfR}~vRvYbQaX*8 zo0p<=f2ClO)JuYx1vCPMqC21yriy(ExGPvQpky1b8 zY(Z$Aq@nH12?G;y?ghGd{b?-%&(+1Vs)el3AT#fD6_MepH*!{UM|H)Mr=Xc?T)-#H z2C07$#9FG08(odBvtuZN4TQ~g@z&JX>H~vD1XLwda!^eMwTdKHkXlin00qei$_hmF zl8m%!T|+Y1ej<++xl?U`yW3cNr;9VjLJh(sNu;DK(dZn?s;WYyKt(BWL@8bd%uY)| zT+9_PiJiy`nMVVVDcTddV7kbi-lpJ(JJ}%KmWdY(rgjKr31uneK+F0+)c1Gjm<`Au zzyB1DN6V1F0g34%a`?qfi&>~pGa_O$8jUEu$g9|&QAXn#4S_MNN-{X}0+%N725(uK z8N|#E9AaW!VcmdPLM literal 0 HcmV?d00001 diff --git a/image/h2.png b/image/h2.png new file mode 100644 index 0000000000000000000000000000000000000000..d6be98dec923488859fc51bb88336447c110e366 GIT binary patch literal 927 zcmaJ=yN=U96g5FeXvJ1YAhy|AZwc|tI8R$KQPy@?OE`*>NSlHJ$DSls)*fR|u#=LG zik>f^qM@XK7Fs%5K7a}dQ8CWOfr4OZJP)07?zwmFyzKWL9UdGV2!e2Eof`u_U*n^6 zv&8>*zMVvTy2s2h8`3FDotOw6k4^}%0%t}B#PL?oK9QCnTo?V(n2qhns!IdO$uUwE z`m2y(cQ-4J58K37O4=XX)2`^iN-UC6-9wahO%7dh;p(DnUj^n z+~M6E+}! z{Qgro8Lc7$2PC1(*yR^DJ z@kz+LJ?3qF{N~9!{v>W&MrV|Lo&5auOSpS<c E4VXL{Z2$lO literal 0 HcmV?d00001 From 81d230dbdda8638e7a0a0d8f3c2a080ef43f3903 Mon Sep 17 00:00:00 2001 From: Alexey Belousov Date: Sun, 22 Sep 2013 21:38:51 +0600 Subject: [PATCH 2/4] =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=B5=D1=87=D0=B0=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JavaScript_Enlightenment.html | 6 ++---- css/main.css | 36 ++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/JavaScript_Enlightenment.html b/JavaScript_Enlightenment.html index 387ebb3..cef5096 100644 --- a/JavaScript_Enlightenment.html +++ b/JavaScript_Enlightenment.html @@ -13,7 +13,6 @@
-

Preface

@@ -52,12 +51,11 @@

Color-coding Conventions

<!DOCTYPE html><html lang="en"><body><script>
-
-
// this is a comment about a specific part of the code
 var foo = 'calling out this part of the code';
@@ -99,7 +97,7 @@ 

jsFiddle, JS Bin, and Firebug lite-dev

When JS Bin is used, keep in mind that the code has to be executed manually (clicking 'Render') which differs from the page load execution done by jsFiddle.

- diff --git a/css/main.css b/css/main.css index 99a0fe7..923cb44 100644 --- a/css/main.css +++ b/css/main.css @@ -12,6 +12,7 @@ h1 { font-weight: normal; text-align: right; background: url(../image/h1.png) left bottom transparent repeat-x; + /*border-bottom: 3px solid #EAEBEB;*/ padding-bottom: 4mm; margin: 0 0 28mm; } @@ -21,6 +22,7 @@ h2 { padding-bottom: 3mm; color: #444444; background: url(../image/h2.png) left bottom transparent repeat-x; + /*border-bottom: 2px solid #EBECEC;*/ } p { margin: 0 0 9mm 0; @@ -60,7 +62,6 @@ code .string { box-sizing: border-box; } .pdf .body {} -.pdf .header {} .pdf .footer { position: absolute; bottom: 0; @@ -70,4 +71,37 @@ code .string { } .pdf .footer .page-num { text-align: center; +} + +@media print { + .pdf .page { + width: auto; + height: auto; + box-shadow: none; + background: #FFF; + margin: 0; + position: static; + padding: 0; + box-sizing: content-box; + } + .visible-screen { + display: none; + } + h1 { + border-bottom: 3px solid #EAEBEB; + } + h2 { + border-bottom: 2px solid #EBECEC; + } + .code-block-begin { + height: 0; + border-bottom: 15px solid #FDECAD; + } + .code-block-end { + height: 0; + border-bottom: 4px solid #FDD95D; + } + a:after { + content:" (" attr(href) ") ";font-size:0.8em;font-weight:normal; + } } \ No newline at end of file From 27ea5bd69879461801394a821ff2b3d305cf8da9 Mon Sep 17 00:00:00 2001 From: Alexey Belousov Date: Wed, 25 Sep 2013 21:06:17 +0600 Subject: [PATCH 3/4] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=D0=B4=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=D0=BC?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JavaScript_Enlightenment.html | 18 +- css/main.css | 86 +++--- css/normalize.css | 533 ---------------------------------- image/code-begin.png | Bin 961 -> 0 bytes image/code-end.png | Bin 934 -> 0 bytes image/h1.png | Bin 931 -> 0 bytes image/h2.png | Bin 927 -> 0 bytes 7 files changed, 39 insertions(+), 598 deletions(-) delete mode 100644 css/normalize.css delete mode 100644 image/code-begin.png delete mode 100644 image/code-end.png delete mode 100644 image/h1.png delete mode 100644 image/h2.png diff --git a/JavaScript_Enlightenment.html b/JavaScript_Enlightenment.html index cef5096..f7377c5 100644 --- a/JavaScript_Enlightenment.html +++ b/JavaScript_Enlightenment.html @@ -7,7 +7,6 @@ - @@ -47,20 +46,10 @@

Color-coding Conventions

will be green. The color gray in the code examples is reserved for JavaScript comments (example shown below).

-
- -
<!DOCTYPE html><html lang="en"><body><script>
-
- -
-
-
-
// this is a comment about a specific part of the code
+                
<!DOCTYPE html><html lang="en"><body><script>
+// this is a comment about a specific part of the code
 var foo = 'calling out this part of the code';
 </script></body></html>
-

In addition to code examples being color-coded, the text in this book is colored so as to denote JavaScript words/keywords v.s. JavaScript code v.s. regular text. Below, I take an excerpt from the @@ -97,9 +86,6 @@

jsFiddle, JS Bin, and Firebug lite-dev

When JS Bin is used, keep in mind that the code has to be executed manually (clicking 'Render') which differs from the page load execution done by jsFiddle.

-
diff --git a/css/main.css b/css/main.css index 923cb44..20dd51c 100644 --- a/css/main.css +++ b/css/main.css @@ -1,64 +1,61 @@ html { - background: #cccccc; - - font-family: "Tahoma", sans-serif; - font-size: 14px; - line-height: 1.5; + background: #ccc; + font: 14px/1.5 "Tahoma", sans-serif; } h1 { - color: #444444; - font-size: 36px; - font-family: "Helvetica", sans-serif; - font-weight: normal; + color: #444; + font: normal 36px "Helvetica", sans-serif; text-align: right; - background: url(../image/h1.png) left bottom transparent repeat-x; - /*border-bottom: 3px solid #EAEBEB;*/ - padding-bottom: 4mm; - margin: 0 0 28mm; + border-bottom: 3px solid #EAEBEB; + padding-bottom: 15px; + margin: 0 0 106px; } h2 { font-size: 18px; - margin: 16mm 0 5mm; - padding-bottom: 3mm; - color: #444444; - background: url(../image/h2.png) left bottom transparent repeat-x; - /*border-bottom: 2px solid #EBECEC;*/ + margin: 60px 0 21px; + padding-bottom: 11px; + color: #444; + border-bottom: 2px solid #EBECEC; } p { - margin: 0 0 9mm 0; + margin: 0 0 34px 0; } pre { margin: 0; } +@media screen { + .code:before { + content: ' '; + height: 15px; + margin-bottom: 15px; + background: #FDECAD; + display: block; + } + .code:after { + content: ' '; + height: 4px; + margin: 11px 0 34px; + background: #FDD95D; + display: block; + } +} code { color: #37571e; font-family: Courier, "Courier New", monospace; } code .comment { - color: #7a7a7a; + color: #7a7; } code .string { color: #b45e09; } -.code-block-begin { - background: url(../image/code-begin.png) left bottom transparent repeat-x; - height: 22px; - margin-bottom: 4mm; -} -.code-block-end { - background: url(../image/code-end.png) left bottom transparent repeat-x; - height: 4px; - margin: 3mm 0 9mm; -} .pdf {} .pdf .page { - width: 210mm; - height: 297mm; - box-shadow: 0 2px 5px 2px gray; + width: 788px; background: #FFF; margin: 5px auto 30px; position: relative; - padding: 15mm 20mm; + padding: 56px 75px; box-sizing: border-box; } .pdf .body {} @@ -67,7 +64,7 @@ code .string { bottom: 0; left: 0; width: 100%; - height: 10mm; + height: 38px; } .pdf .footer .page-num { text-align: center; @@ -77,7 +74,6 @@ code .string { .pdf .page { width: auto; height: auto; - box-shadow: none; background: #FFF; margin: 0; position: static; @@ -87,21 +83,13 @@ code .string { .visible-screen { display: none; } - h1 { - border-bottom: 3px solid #EAEBEB; - } - h2 { - border-bottom: 2px solid #EBECEC; - } - .code-block-begin { - height: 0; - border-bottom: 15px solid #FDECAD; - } - .code-block-end { - height: 0; + .code { + border-top: 15px solid #FDECAD; border-bottom: 4px solid #FDD95D; + margin: 10px 0 15px 0; } a:after { - content:" (" attr(href) ") ";font-size:0.8em;font-weight:normal; + content: " (" attr(href) ") "; + font: normal 0.8em; } } \ No newline at end of file diff --git a/css/normalize.css b/css/normalize.css deleted file mode 100644 index 8d57e3c..0000000 --- a/css/normalize.css +++ /dev/null @@ -1,533 +0,0 @@ -/*! normalize.css v1.1.1 | MIT License | git.io/normalize */ - -/* ========================================================================== - HTML5 display definitions - ========================================================================== */ - -/** - * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -nav, -section, -summary { - display: block; -} - -/** - * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. - */ - -audio, -canvas, -video { - display: inline-block; - *display: inline; - *zoom: 1; -} - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. - * Known issue: no IE 6 support. - */ - -[hidden] { - display: none; -} - -/* ========================================================================== - Base - ========================================================================== */ - -/** - * 1. Prevent system color scheme's background color being used in Firefox, IE, - * and Opera. - * 2. Prevent system color scheme's text color being used in Firefox, IE, and - * Opera. - * 3. Correct text resizing oddly in IE 6/7 when body `font-size` is set using - * `em` units. - * 4. Prevent iOS text size adjust after orientation change, without disabling - * user zoom. - */ - -html { - background: #fff; /* 1 */ - color: #000; /* 2 */ - font-size: 100%; /* 3 */ - -webkit-text-size-adjust: 100%; /* 4 */ - -ms-text-size-adjust: 100%; /* 4 */ -} - -/** - * Address `font-family` inconsistency between `textarea` and other form - * elements. - */ - -html, -button, -input, -select, -textarea { - font-family: sans-serif; -} - -/** - * Address margins handled incorrectly in IE 6/7. - */ - -body { - margin: 0; -} - -/* ========================================================================== - Links - ========================================================================== */ - -/** - * Address `outline` inconsistency between Chrome and other browsers. - */ - -a:focus { - outline: thin dotted; -} - -/** - * Improve readability when focused and also mouse hovered in all browsers. - */ - -a:active, -a:hover { - outline: 0; -} - -/* ========================================================================== - Typography - ========================================================================== */ - -/** - * Address font sizes and margins set differently in IE 6/7. - * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, - * and Chrome. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -h2 { - font-size: 1.5em; - margin: 0.83em 0; -} - -h3 { - font-size: 1.17em; - margin: 1em 0; -} - -h4 { - font-size: 1em; - margin: 1.33em 0; -} - -h5 { - font-size: 0.83em; - margin: 1.67em 0; -} - -h6 { - font-size: 0.67em; - margin: 2.33em 0; -} - -/** - * Address styling not present in IE 7/8/9, Safari 5, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -blockquote { - margin: 1em 40px; -} - -/** - * Address styling not present in Safari 5 and Chrome. - */ - -dfn { - font-style: italic; -} - -/** - * Address differences between Firefox and other browsers. - * Known issue: no IE 6/7 normalization. - */ - -hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} - -/** - * Address styling not present in IE 6/7/8/9. - */ - -mark { - background: #ff0; - color: #000; -} - -/** - * Address margins set differently in IE 6/7. - */ - -p, -pre { - margin: 1em 0; -} - -/** - * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, serif; - _font-family: 'courier new', monospace; - font-size: 1em; -} - -/** - * Improve readability of pre-formatted text in all browsers. - */ - -pre { - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; -} - -/** - * Address CSS quotes not supported in IE 6/7. - */ - -q { - quotes: none; -} - -/** - * Address `quotes` property not supported in Safari 4. - */ - -q:before, -q:after { - content: ''; - content: none; -} - -/** - * 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; -} - -/* ========================================================================== - Lists - ========================================================================== */ - -/** - * Address margins set differently in IE 6/7. - */ - -dl, -menu, -ol, -ul { - margin: 1em 0; -} - -dd { - margin: 0 0 0 40px; -} - -/** - * Address paddings set differently in IE 6/7. - */ - -menu, -ol, -ul { - padding: 0 0 0 40px; -} - -/** - * Correct list images handled incorrectly in IE 7. - */ - -nav ul, -nav ol { - list-style: none; - list-style-image: none; -} - -/* ========================================================================== - Embedded content - ========================================================================== */ - -/** - * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. - * 2. Improve image quality when scaled in IE 7. - */ - -img { - border: 0; /* 1 */ - -ms-interpolation-mode: bicubic; /* 2 */ -} - -/** - * Correct overflow displayed oddly in IE 9. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* ========================================================================== - Figures - ========================================================================== */ - -/** - * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. - */ - -figure { - margin: 0; -} - -/* ========================================================================== - Forms - ========================================================================== */ - -/** - * Correct margin displayed oddly in IE 6/7. - */ - -form { - margin: 0; -} - -/** - * 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 6/7/8/9. - * 2. Correct text not wrapping in Firefox 3. - * 3. Correct alignment displayed oddly in IE 6/7. - */ - -legend { - border: 0; /* 1 */ - padding: 0; - white-space: normal; /* 2 */ - *margin-left: -7px; /* 3 */ -} - -/** - * 1. Correct font size not being inherited in all browsers. - * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, - * and Chrome. - * 3. Improve appearance and consistency in all browsers. - */ - -button, -input, -select, -textarea { - font-size: 100%; /* 1 */ - margin: 0; /* 2 */ - vertical-align: baseline; /* 3 */ - *vertical-align: middle; /* 3 */ -} - -/** - * Address Firefox 3+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -button, -input { - line-height: normal; -} - -/** - * 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 Chrome, Safari 5+, and IE 6+. - * Correct `select` style inheritance in Firefox 4+ and Opera. - */ - -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. - * 4. Remove inner spacing in IE 7 without affecting normal text inputs. - * Known issue: inner spacing remains in IE 6. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ - *overflow: visible; /* 4 */ -} - -/** - * Re-set default cursor for disabled elements. - */ - -button[disabled], -html input[disabled] { - cursor: default; -} - -/** - * 1. Address box sizing set to content-box in IE 8/9. - * 2. Remove excess padding in IE 8/9. - * 3. Remove excess padding in IE 7. - * Known issue: excess padding remains in IE 6. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ - *height: 13px; /* 3 */ - *width: 13px; /* 3 */ -} - -/** - * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari 5 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 5 and Chrome - * on OS X. - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * Remove inner padding and border in Firefox 3+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * 1. Remove default vertical scrollbar in IE 6/7/8/9. - * 2. Improve readability and alignment in all browsers. - */ - -textarea { - overflow: auto; /* 1 */ - vertical-align: top; /* 2 */ -} - -/* ========================================================================== - Tables - ========================================================================== */ - -/** - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} diff --git a/image/code-begin.png b/image/code-begin.png deleted file mode 100644 index 4a739c67b423f6309b651e9eae21f6ac712a8667..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 961 zcmaJ=zi-n(7sR}<^x7(p zS@kYZFu{l@2p7@>Yq^4k2^f7)L<^m5tzlG0vBXY?9nJ#{p>DS;cQY~zcMwrk6=4M_ zN?IV&(SgscIPFJEV+DgocIXD&Wj;t0tv1`|IuuUNQ}BX`tRIcaBnpOND?miXNlIg& zY5pJTc@uQR8}!2OKZT>_K|oQ1Mr=Q{#l>weC7}YX98!z3u*uloxQg`-<1Fg10F*a# zG67qz@33w(#G9s8^CNEgHmw;t6biEIIvOtJOE^;{N=7AwR5Ht@JXu~gszoJREflhN z%r%(3?@^zRxy}VwnaWLC!3#uWgNE)C>QqDKfnmy;JJn02I#qAPb*6j4Q@Kc(LCMAb zb(zaqVX?*I7ZVyFU_oX%zPa;<{ip}_Q``6&>?2Y&R)%9zGqvxs9!C>Y~ z|Nhx+c>T@O@`uA$Cr3Zej$iz^dc1g;y1XD=`F7{gr-jp($)l=OHjKBWhsS>aCoNf`*1&iA3`dEV!J@4e^k*8Sa`y&XXicI_jx!{;k} zY+t|1{~z9d4Ec16S$)=}LzcM-5e|JiAixgYQ_>->KYjF>)CFNn40?UmcaAlWhLT%g zq&$o{TM+68dF*;)!oYx>29YlQc=uiefv<}vRR=k-K}NyREFs-ltLM$ep6ZJScR@YZ zxIjpl3-a(hO0`@U7rGi>7spTp3kVzQ;)SWc(*_1j2&hV^?{ihg!#ME@SbXE{+(BH3+jTld`fzlT(OQRfR}~vRvYbQaX*8 zo0p<=f2ClO)JuYx1vCPMqC21yriy(ExGPvQpky1b8 zY(Z$Aq@nH12?G;y?ghGd{b?-%&(+1Vs)el3AT#fD6_MepH*!{UM|H)Mr=Xc?T)-#H z2C07$#9FG08(odBvtuZN4TQ~g@z&JX>H~vD1XLwda!^eMwTdKHkXlin00qei$_hmF zl8m%!T|+Y1ej<++xl?U`yW3cNr;9VjLJh(sNu;DK(dZn?s;WYyKt(BWL@8bd%uY)| zT+9_PiJiy`nMVVVDcTddV7kbi-lpJ(JJ}%KmWdY(rgjKr31uneK+F0+)c1Gjm<`Au zzyB1DN6V1F0g34%a`?qfi&>~pGa_O$8jUEu$g9|&QAXn#4S_MNN-{X}0+%N725(uK z8N|#E9AaW!VcmdPLM diff --git a/image/h2.png b/image/h2.png deleted file mode 100644 index d6be98dec923488859fc51bb88336447c110e366..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 927 zcmaJ=yN=U96g5FeXvJ1YAhy|AZwc|tI8R$KQPy@?OE`*>NSlHJ$DSls)*fR|u#=LG zik>f^qM@XK7Fs%5K7a}dQ8CWOfr4OZJP)07?zwmFyzKWL9UdGV2!e2Eof`u_U*n^6 zv&8>*zMVvTy2s2h8`3FDotOw6k4^}%0%t}B#PL?oK9QCnTo?V(n2qhns!IdO$uUwE z`m2y(cQ-4J58K37O4=XX)2`^iN-UC6-9wahO%7dh;p(DnUj^n z+~M6E+}! z{Qgro8Lc7$2PC1(*yR^DJ z@kz+LJ?3qF{N~9!{v>W&MrV|Lo&5auOSpS<c E4VXL{Z2$lO From ffffe57d9e438282a2bb6547e15023ca092646ea Mon Sep 17 00:00:00 2001 From: Alexey Belousov Date: Wed, 25 Sep 2013 21:08:42 +0600 Subject: [PATCH 4/4] =?UTF-8?q?=D0=A7=D1=82=D0=BE=D0=B1=D1=8B=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D1=81=D0=BE=D1=80=D1=8F=D1=82=D1=8C=20pul?= =?UTF-8?q?l=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - JavaScript_Enlightenment.MD | 16 ---------------- 2 files changed, 17 deletions(-) delete mode 100644 .gitignore delete mode 100644 JavaScript_Enlightenment.MD diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 723ef36..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea \ No newline at end of file diff --git a/JavaScript_Enlightenment.MD b/JavaScript_Enlightenment.MD deleted file mode 100644 index 8db68fb..0000000 --- a/JavaScript_Enlightenment.MD +++ /dev/null @@ -1,16 +0,0 @@ -# Fonts - -[SO question](http://superuser.com/questions/117443/how-to-know-which-fonts-are-used-in-selected-part-of-a-pdf-document). - -```xpdfbin-win-3.03\bin64\pdffonts.exe -f 1 -l 1 C:\Users\alex\Downloads\JavaScript_Enlightenment.pdf - -
-    name                                 type              emb sub uni object ID
-    ------------------------------------ ----------------- --- --- --- ---------
-    IDJMWJ+ArialNarrow                   TrueType          yes yes no       8  0
-    KDOYAX+Tahoma-Bold                   TrueType          yes yes no      10  0
-    YNNMXN+Helvetica                     TrueType          yes yes yes     12  0
-    ORHRTX+Helvetica                     TrueType          yes yes no      18  0
-    DLGPBW+Helvetica                     TrueType          yes yes no       9  0
-    EJLCOX+Courier-Bold                  TrueType          yes yes no      14  0
-
\ No newline at end of file