├── posts
├── drafts
│ ├── javascript
│ │ ├── js_regexp.md
│ │ ├── js_class.md
│ │ ├── js_object-boolean.md
│ │ ├── js_objects.md
│ │ ├── js_object-regexp.md
│ │ ├── js_object_function.md
│ │ ├── js_object-number.md
│ │ ├── js_variable.md
│ │ ├── javascript.md
│ │ ├── js_grammer.md
│ │ ├── js_object.md
│ │ ├── js_datatype.md
│ │ ├── js_statements.md
│ │ ├── js_object-string.md
│ │ ├── js_object-math.md
│ │ └── js_array.md
│ ├── w3c
│ │ ├── web-design
│ │ │ ├── accessibility.md
│ │ │ ├── math-on-the-web.md
│ │ │ ├── privacy.md
│ │ │ └── mobile-web.md
│ │ ├── web-of-services
│ │ │ ├── security.md
│ │ │ ├── internationalization.md
│ │ │ ├── protocols.md
│ │ │ └── service-description.md
│ │ ├── web-of-devices
│ │ │ ├── mobile-web.md
│ │ │ ├── web-and-tv.md
│ │ │ ├── multimodal-access.md
│ │ │ ├── device-independece-and-content-adaptation.md
│ │ │ └── voice-browsing.md
│ │ ├── xml
│ │ │ ├── internationalization.md
│ │ │ ├── query.md
│ │ │ ├── security.md
│ │ │ ├── publishing.md
│ │ │ ├── components.md
│ │ │ ├── processing.md
│ │ │ └── schema.md
│ │ ├── web-arch
│ │ │ ├── internationalization.md
│ │ │ ├── protocols.md
│ │ │ ├── identifiers.md
│ │ │ ├── architecture-principles.md
│ │ │ ├── protocol-and-meta-format-considerations.md
│ │ │ └── meta-formats.md
│ │ ├── web-of-services.md
│ │ ├── browser-and-authoring-tools.md
│ │ ├── web-architecture.md
│ │ ├── web-of-devices.md
│ │ ├── xnl-technology.md
│ │ ├── standards
│ │ │ ├── dom-events
│ │ │ │ └── DOM-EVENTS.md
│ │ │ └── dom
│ │ │ │ └── DOM.md
│ │ ├── semantic-web.md
│ │ ├── semantic-web
│ │ │ ├── vertical-applications.md
│ │ │ ├── linked-data.md
│ │ │ ├── query.md
│ │ │ └── inference.md
│ │ └── agents
│ │ │ └── browser-media-players.md
│ ├── html
│ │ ├── html_tag_br.md
│ │ ├── html_tag_hr.md
│ │ ├── images
│ │ │ ├── html-index.html.png
│ │ │ ├── html-tag-ruby.png
│ │ │ ├── html-tag-meta-01.png
│ │ │ ├── html-tag-title-01.png
│ │ │ ├── html-tag-title-02.png
│ │ │ ├── html-tag-link-icon.png
│ │ │ └── html-semantic-blog-template.png
│ │ ├── html_tag_body.md
│ │ ├── html_tag_html.md
│ │ ├── html_tag_title.md
│ │ ├── html_tag_head.md
│ │ ├── html_tag_style.md
│ │ ├── html_tag_base.md
│ │ ├── html_tag_canvas.md
│ │ ├── html_tag_audio.md
│ │ ├── html_tag_link.md
│ │ ├── html_doctype.md
│ │ ├── html_tag_script.md
│ │ ├── html_tags_list.md
│ │ ├── html_tag_meta.md
│ │ ├── html_tag_form.md
│ │ ├── html_tags_div.md
│ │ ├── html_tag_a.md
│ │ ├── html_semantic.md
│ │ ├── html_tags_text.md
│ │ ├── html_tags_table.md
│ │ └── html_tags_media.md
│ ├── browser-apis
│ │ ├── dom
│ │ │ ├── element.md
│ │ │ ├── dom-objects.md
│ │ │ ├── selector-apis.md
│ │ │ ├── document.md
│ │ │ ├── range.md
│ │ │ ├── selection.md
│ │ │ ├── html-elements
│ │ │ │ └── HTMLAudio.md
│ │ │ └── dom.md
│ │ ├── bom
│ │ │ ├── bom.md
│ │ │ ├── history.md
│ │ │ ├── bom-in-action.md
│ │ │ ├── screen.md
│ │ │ ├── location.md
│ │ │ └── navigator.md
│ │ └── event.md
│ ├── userstyles-generator
│ │ ├── scheme.md
│ │ └── UI design.ddd
│ ├── web_basic.md
│ ├── css
│ │ ├── css_box-shadow.md
│ │ ├── css_filter.md
│ │ ├── css_outline.md
│ │ ├── css_dimension.md
│ │ ├── css_margin.md
│ │ ├── css_padding.md
│ │ ├── css_overflow.md
│ │ ├── css_table.md
│ │ ├── css_border-image.md
│ │ ├── css_column.md
│ │ ├── css_font-face.md
│ │ ├── css_units.md
│ │ ├── css_position.md
│ │ ├── css_transition.md
│ │ ├── css_content.md
│ │ ├── css_color.md
│ │ ├── css_font.md
│ │ ├── css_animation.md
│ │ ├── css_list.md
│ │ ├── css_border-radius.md
│ │ ├── css_transform.md
│ │ ├── css_gradient.md
│ │ ├── css_background.md
│ │ ├── css_border.md
│ │ ├── css.md
│ │ └── css_text.md
│ └── demo
│ │ └── html
│ │ └── html-tag-base
│ │ └── index.html
├── about-me.md
├── images
│ ├── common-sense-01.jpg
│ ├── common-sense-02.png
│ ├── common-sense-03.png
│ ├── common-sense-04.jpg
│ ├── common-sense-05.jpg
│ ├── common-sense-06.jpg
│ ├── common-sense-07.jpg
│ ├── common-sense-08.jpg
│ ├── common-sense-09.jpg
│ ├── common-sense-10.jpg
│ ├── third-party-logging-01.png
│ ├── third-party-logging-02.png
│ ├── position-and-size-screen.png
│ ├── position-and-size-window.png
│ └── position-and-size-element.png
├── css-preprocessor.md
├── project-in-my-mind.md
├── web-applications-profermance-and-optimizing.md
├── posts.json
├── position-and-size.md
├── common-sense-in-design.md
├── third-party-logging.md
├── tools-and-softwares-on-my-computer.md
└── sublime-text2-install-and-config.md
└── README.md
/posts/drafts/javascript/js_regexp.md:
--------------------------------------------------------------------------------
1 | 正则表达式
--------------------------------------------------------------------------------
/posts/drafts/w3c/web-design/accessibility.md:
--------------------------------------------------------------------------------
1 | accessibility
--------------------------------------------------------------------------------
/posts/about-me.md:
--------------------------------------------------------------------------------
1 | About LearnShare
2 | ================
3 |
4 |
--------------------------------------------------------------------------------
/posts/drafts/w3c/web-of-services/security.md:
--------------------------------------------------------------------------------
1 | SECURITY
2 |
3 | same as xml/security.md
--------------------------------------------------------------------------------
/posts/drafts/html/html_tag_br.md:
--------------------------------------------------------------------------------
1 | br 标签
2 | =======
3 |
4 | `
` 元素用于在页面中插入换行符,常用于连续的文本中。
--------------------------------------------------------------------------------
/posts/drafts/html/html_tag_hr.md:
--------------------------------------------------------------------------------
1 | hr 标签
2 | =======
3 |
4 | `
some text
75 | 76 | 这段代码中的 `` 元素同时受到三组颜色属性的控制,它的文本会是什么颜色呢?
77 |
78 | 在多组样式同时作用于一个元素时,会依据 __优先权__ 来选择应用哪一个样式的规则。
79 |
80 | 网页中同时存在的样式可能有三类,共 5 组:
81 |
82 | 1. 浏览器默认样式
83 | 2. 网页定义的样式(包括 内联样式、内部样式和外部样式)
84 | 3. 用户自定义样式(通过 custom.css 或通过浏览器插件设置的样式)
85 |
86 | 参考:user stylesheet
87 |
88 | 优先权从高到低依次为:
89 |
90 | 1. 用户自定义样式
91 | 2. 内联样式
92 | 3. 内部样式
93 | 4. 外部样式
94 | 5. 浏览器默认样式
95 |
96 | 附加规则:
97 |
98 | + 同一个 `style` 属性中,同一个内部或外部样式中的相同或不同样式组中,后定义的样式规则优先权高
99 | + 如果页面通过 `` 元素引用了多个外部样式文件,最后引用的样式文件优先权高
100 | + 内部样式和外部样式的位置?
101 | + @import 引入的样式?
102 |
103 | __继承__ 是来自面向对象的概念,CSS 中的继承有如下特点:
104 |
105 | + 外部元素(父元素,祖先元素)中定义的样式规则会同时应用于内部元素(子元素,后代元素)
106 | + 子元素中定义的样式规则会取代父元素中定义的同一规则
107 |
108 | ###语法规则
109 |
110 | __CSS 规则__ 的语法如下:
111 |
112 | selector{
113 | declaration1;
114 | declaration2;
115 | ...
116 | declarationN;
117 | }
118 |
119 | 上面的代码称为一条 CSS 规则。每个规则分为两个部分:
120 |
121 | 1. 选择器
122 | 选择器通过一系列的规则,指定了应用当前样式规则的目标元素。
123 | 2. 声明列表
124 | 列表中包含了一系列的样式声明。样式声明列表需要包含在 `{}`中。
125 |
126 | __样式声明__ 由属性和值两部分组成:
127 |
128 | property:value;
129 |
130 | 属性名和属性值通常为小写字母,每条样式声明都必须以 `;` 结尾。
131 |
132 | __CSS 注释__ 的语法如下:
133 |
134 | /* CSS 单行注释 */
135 |
136 | 注释可以是单行的,也可以是多行的。
137 |
138 | /*
139 | * CSS
140 | * 多行注释
141 | */
142 |
143 | ###颜色和单位
144 |
145 | 参考:css_color css_units
146 |
147 | ###选择器
148 |
149 | 参考:css_selectors
150 |
151 | ###样式属性
152 |
153 | 参考:css_properties
--------------------------------------------------------------------------------
/posts/drafts/w3c/semantic-web/linked-data.md:
--------------------------------------------------------------------------------
1 | LINKED DATA
2 |
3 | current status:
4 | + RDF
5 | + RDF Best Pratices
6 | + RDF Relationship to Other Formats
7 | + GRDDL
8 | + POWDER
9 | + Semantic Annotation for WSDL and XML Schema
10 | + Provenance
11 | + RDB2RDF
12 | + Linded Data
13 |
14 | What is Linked Data?
15 |
16 | The Semantic Web is a Web of Data — of dates and titles and part numbers and chemical properties and any other data one might conceive of. The collection of Semantic Web technologies (RDF, OWL, SKOS, SPARQL, etc.) provides an environment where application can query that data, draw inferences using vocabularies, etc.
17 |
18 | However, to make the Web of Data a reality, it is important to have the huge amount of data on the Web available in a standard format, reachable and manageable by Semantic Web tools. Furthermore, not only does the Semantic Web need access to data, but relationships among data should be made available, too, to create a Web of Data (as opposed to a sheer collection of datasets). This collection of interrelated datasets on the Web can also be referred to as Linked Data.
19 |
20 | To achieve and create Linked Data, technologies should be available for a common format (RDF), to make either conversion or on-the-fly access to existing databases (relational, XML, HTML, etc). It is also important to be able to setup query endpoints to access that data more conveniently. W3C provides a palette of technologies (RDF, GRDDL, POWDER, RDFa, the upcoming R2RML, RIF, SPARQL) to get access to the data.
21 |
22 | What is Linked Data Used For?
23 |
24 | Linked Data lies at the heart of what Semantic Web is all about: large scale integration of, and reasoning on, data on the Web. Almost all applications listed in, say collection of Semantic Web Case Studies and Use Cases are essentially based on the accessibility of, and integration of Linked Data at various level of complexities.
25 |
26 | Examples
27 |
28 | A typical case of a large Linked Dataset is DBPedia, which, essentially, makes the content of Wikipedia available in RDF. The importance of DBPedia is not only that it includes Wikipedia data, but also that it incorporates links to other datasets on the Web, e.g., to Geonames. By providing those extra links (in terms of RDF triples) applications may exploit the extra (and possibly more precise) knowledge from other datasets when developing an application; by virtue of integrating facts from several datasets, the application may provide a much better user experience.
29 |
30 | Learn More
31 |
32 | Tim Berners-Lee's note on Linked Data gives a succinct description of the Linked Data principles. The Semantic Web community also maintains a list of books on a W3C Wiki page. Some of those books are introductory in nature while others are conference proceedings or textbook that address more advanced topics. Details of recent and upcoming Semantic Web related talks, given by the W3C Staff, the staff of the W3C Offices, and members of the W3C Working Groups are available separately; the slides are usually publicly available. The W3C also maintains a collection of Semantic Web Case Studies and Use Cases that show how Semantic Web technologies, including Linked Data, are used in practice.
--------------------------------------------------------------------------------
/posts/drafts/w3c/web-arch/meta-formats.md:
--------------------------------------------------------------------------------
1 | META FORMATS
2 |
3 | Metaformats are generic formats that people can adopt when creating their own application-specific languages without having to reinvent syntax. The terms that people use to specialise a metaformat are often called vocabularies. Examples of metaformats are XML, RDF and JSON. Metaformats offer advantages over creating a custom syntax for a language because they can be processed by generic tools, and languages that use them can be understood by people who have learned about the metaformat.
4 |
5 | Metaformats usually have a schema language that can be used to define or describe a vocabulary that uses that metaformat, and query or transformation languages that can be used to access information within documents that use that metaformat.
6 |
7 | current status:
8 | + XML
9 | + RDF
10 | + XHTML Modularization
11 |
12 | What is XML?
13 |
14 | XML provides a simple standardised way to serialize information representable as labelled trees with annotations and cross-references, allowing a free choice of markup vocabulary. This not only makes it well-suited for human-authored documents, particularly given its facility for mixed content (plain and marked-up text) and built-in support for Unicode, but also means it is a useful syntax for all kinds of machine-to-machine data transfer. XHTML, Docbook and DITA are examples of XML-based languages primarily intended for documents; machine-to-machine uses include Atom, UPnP (for networked device discovery) and AEMP (for construction equipment). There are several schema languages for XML, including XML Schema and RELAX NG, which enable XML-based languages to be validated. There are also generic methods for querying and transforming XML through XPath and XSLT, XQuery, and XML Processing pipelines.
15 |
16 | What is RDF?
17 |
18 | RDF is a language designed for the expression of arbitrary information about arbitrary things. It has variant surface syntaxes including Turtle and RDFa, the latter allowing embedding in HTML and thus promoting machine readability of information found in HTML documents. RDF is useful for expressing graph structured information in which each entity is linkable through a URL and is thus the core data model for the Semantic Web. Common RDF vocabularies, which can be used with any RDF syntax, are Dublin Core Terms, FOAF, SKOS, and schema.org.
19 |
20 | RDF vocabularies can be described by RDF Schemas or OWL Ontologies. These are primarily used for inference: to deduce new information from data expressed in RDF. More flexible reasoning for RDF can be described using RIF. Data stored within RDF stores, known as triplestores, can be queried and updated using SPARQL.
21 |
22 | What is JSON?
23 |
24 | JSON is a metaformat that is useful for expressing tree-based data structures. JSON's key benefit is that it tersely expresses the kinds of data structures commonly used in programming languages, particularly Javascript, which makes it very easy to create and consume.
25 |
26 | JSON is rarely used with a declarative schema and it is usually processed by being parsed into the native data structures used by a particular programming language. However, there are several query languages currently under development, including JSON Path, Jaql, and JSONiq.
--------------------------------------------------------------------------------
/posts/drafts/w3c/web-of-devices/device-independece-and-content-adaptation.md:
--------------------------------------------------------------------------------
1 | DEVICE INDEPENDENCE AND CONTENT ADAPTATION
2 |
3 | current status:
4 | + Device Description Repository
5 | + Device Independence Authoring
6 | + CC/PP
7 | + Content Transformation
8 | + DCCI
9 |
10 | What is Device Independence?
11 |
12 | At it's inception, virtually the only way to access the Web was through a personal computer or workstation. While there were lots of variations, accessing the Web almost always involved using a modern computer with a reasonably large color display.
13 |
14 | Computers may still be the primary means of accessing the Web, but in recent years the number of different kinds of devices accessing the Web has grown by leaps and bounds. Mobile phones, personal digital assistants, eBook readers, television systems, voice response systems, music players, kiosks, digital picture frames, in-car navigation systems and even domestic appliances are all starting to access the Web more and more.
15 |
16 | Device Independence refers to the goal of having a single Web that is accessible from any of these devices.
17 |
18 | What is Content Adaptation Used For?
19 |
20 | Content Adaptation is a process that based on factors such as the capabilities of the displaying device or network, or the user's preferences, adapts the content that has been requested to provide an optimized user experience. This adaptation can occur in a number of places in the content delivery chain: the author may make choices when writing the content, or intermediary automated content transformation proxies could adapt the content based on heuristics and knowledge of the user, or the adaptation could occur within the browser itself.
21 |
22 | Examples
23 |
24 | Content that is adapted to the user's device is commonplace on the mobile Web. Two different mobile devices may have radically different display capabilities, for instance one may have a black and white display that is very low resolution, while another mobile device may have a full color 480x320 resolution display. Yet sites that use content adaptation techniques can provide both devices access to the same information.
25 |
26 | For example, the content author may wish to use one set of colors when displaying their content on the color display, but may find the results illegible when displayed in black and white. The author could use the following HTML to style the page in full color only when a color display has been detected:
27 |
28 |
29 |
30 | This code would cause the browser to evaluate what type of display the content is being rendered on, and determine whether or not to use the style information included in the "color.css" style-sheet.
31 |
32 | Learn More
33 |
34 | To learn more about authoring content that can be delivered to a wide variety of devices, please see the Authoring Techniques for Device Independence.
35 |
36 | The Guidelines for Web Content Transformation Proxies provides guidance to Content Transformation proxies as to whether and how to transform Web content.
37 |
38 | And lastly, the Glossary of Terms for Device Independence provides a detailed explanation of all of the terms that are commonly used in the area of Device Independence.
--------------------------------------------------------------------------------
/posts/drafts/browser-apis/dom/range.md:
--------------------------------------------------------------------------------
1 | Range
2 | =====
3 |
4 | `Range` 对象代表了包含文本节点片段或其他节点的文档片段(范围)。
5 |
6 | 有三种方式获得 Range 对象:
7 |
8 | var range=document.createRange();
9 | var range=selection.getRangeAt(index);
10 | var range=new Range();
11 |
12 | 属性
13 | ----
14 |
15 | ###collapsed
16 |
17 | 范围的起点与终点是否重合(空,未包含任何内容)。
18 |
19 | ###commonAncestorContainer
20 |
21 | 获取文档中包含 Range.startContainer 和 Range.endContainer 节点的最深层节点(最小包含节点)。
22 |
23 | ###endContainer
24 |
25 | 范围终点所在的节点。
26 |
27 | ###endOffset
28 |
29 | 范围终点在 endContainer 节点中的位置。
30 |
31 | ###startContainer
32 |
33 | 范围起点所在的节点。
34 |
35 | ###startOffset
36 |
37 | 范围起点在 endContainer 节点中的位置。
38 |
39 | 方法
40 | ----
41 |
42 | ###setStart()
43 |
44 | 设置范围的起点。
45 |
46 | 语法:
47 | >range.setStart(startNode, startOffset);
48 |
49 | ###setEnd()
50 |
51 | 设置范围的起点。
52 |
53 | 语法:
54 | >range.setEnd(endNode, endOffset);
55 |
56 | ###setStartBefore()
57 |
58 | 设置范围起点在指定节点之前,目标节点与范围起点所在节点的父节点相同。
59 |
60 | 语法:
61 | >range.setStartBefore(referenceNode);
62 |
63 | 参数:
64 | >用作参考的节点
65 |
66 | ###setStartAfter()
67 |
68 | 设置范围起点在指定节点之后,目标节点与范围起点所在节点的父节点相同。
69 |
70 | ###setEndBefore()
71 |
72 | 设置范围终点在指定节点之前,目标节点与范围终点所在节点的父节点相同。
73 |
74 | ###setEndAfter()
75 |
76 | 设置范围终点在指定节点之后,目标节点与范围终点所在节点的父节点相同。
77 |
78 | ###selectNode()
79 |
80 | 设置范围包含指定节点,目标节点与范围起点/终点所在节点的父节点相同。
81 |
82 | 语法:
83 | >range.selectNode(referenceNode);
84 |
85 | ###selectNodeContents()
86 |
87 | 设置范围包含指定节点的所有内容,目标节点就是范围起点/终点所在节点,startOffset 为 0,endOffset 为目标节点包含的字符数。
88 |
89 | 语法:
90 | >range.selectNodeContents(referenceNode);
91 |
92 | ###collapse(toStart)
93 |
94 | 折叠范围,并将光标定位在范围起点/终点。
95 |
96 | 语法:
97 | >range.collapse(toStart);
98 |
99 | 参数:
100 | >toStart 是否将光标定位在起点(true:定位在起点;false:定位在终点(默认))
101 |
102 | ###cloneContents()
103 |
104 | 以 DocumentFragment 对象的形式返回 Range 的内容。
105 |
106 | ###deleteContents()
107 |
108 | 从文档中删除 Range 包含的内容。
109 |
110 | ###extractContents()
111 |
112 | 从文档中删除 Range 包含的内容,以 DocumentFragment 对象的形式返回。
113 |
114 | ###insertNode()
115 |
116 | 将指定节点添加到范围的开始。如果目标节点将要插入到文本节点中,则该文本节点被分割成两部分。
117 |
118 | 语法:
119 | >range.insertNode(newNode);
120 |
121 | ###surroundContents(newNode)
122 |
123 | 将 Range 的内容插入到指定节点中,并将目标节点放置在 Range 的起始位置。操作完成后,Range 将会包含目标节点。(如果 Range 中包含了非完整元素(被起点/终点截断),则无法完成该操作)。
124 |
125 | 语法:
126 | >range.surroundContents(newNode);
127 |
128 | ###compareBoundaryPoints()
129 |
130 | 比较指定范围与当前范围的起点/终点位置关系。
131 |
132 | 语法:
133 | >range.compareBoundaryPoints(how, sourceRange);
134 |
135 | 参数:
136 | >how 比较方式。可使用的参数:
137 | >>Range.END_TO_END 比较二者的终点
138 | >>Range.END_TO_START 比较目标范围的终点与当前范围的起点
139 | >>Range.START_TO_END 比较目标范围的起点与当前范围的终点
140 | >>Range.START_TO_START 比较二者的起点
141 |
142 | >sourceRange 目标范围
143 |
144 | 返回值:
145 | >-1 之前
146 | >0 相同
147 | >1 之后
148 |
149 | ###cloneRange()
150 |
151 | 复制当前范围,返回其副本,而非引用。
152 |
153 | ###detach()
154 |
155 | 释放当前范围对象。
156 |
157 | ###toString()
158 |
159 | 返回当前范围内的文本。
160 |
161 | ###
162 |
163 | ###
164 |
165 | ###
166 |
167 | ###
168 |
169 | ###
--------------------------------------------------------------------------------
/posts/drafts/javascript/js_object-string.md:
--------------------------------------------------------------------------------
1 | String 对象
2 | =========
3 |
4 | `String` 对象对应于原始类型中的字符串。
5 |
6 | 属性
7 | ----
8 |
9 | ###1.length
10 |
11 | 字符串的长度。
12 |
13 | 方法
14 | ----
15 |
16 | ###1.charAt()
17 |
18 | 获取指定位置的字符。
19 |
20 | 语法:
21 | >str.charAt(index);
22 |
23 | 参数:
24 | >index 索引值(0~length-1)
25 |
26 | 返回值:
27 | >char 指定索引位置的字符
28 |
29 | ###2.concat()
30 |
31 | 将多个字符串与当前字符串连接。
32 |
33 | 语法:
34 | >str.concat(str1[,str2,str3,...]);
35 |
36 | 参数:
37 | >str 一个或多个字符串
38 |
39 | 返回值:
40 | >str 连接后的字符串
41 |
42 | ###3.fromCharCode()
43 |
44 | 从 Unicode 值创建字符串。
45 |
46 | 语法:
47 | >String.fromCharCode(u1[,u2,u3,...]);
48 |
49 | 参数:
50 | >一个或多个 unicode 数值
51 |
52 | 返回值:
53 | >所有 unicode 对应字符连接成的字符串
54 |
55 | ###4.indexOf()
56 |
57 | 搜索指定的字符串,并返回其首次出现的位置。
58 |
59 | 语法:
60 | >str.indexOf(search[,index]);
61 |
62 | 参数:
63 | >search 要搜索的字符串
64 | >index 搜索的起始索引。该参数可省略,如果省略,则默认为 0,即从字符串开始出搜索
65 |
66 | 返回值:
67 | >index 字符串首次出现的位置
68 | >-1 未搜索到指定的字符串
69 |
70 | ###5.lastIndexOf()
71 |
72 | 与 indexOf() 类似,不过搜索方向为从右向左。
73 |
74 | ###6.match()
75 |
76 | 使用指定的字符串或正则表达式在当前字符串中进行匹配。
77 |
78 | 语法:
79 | >str.match(search);
80 | >str.match(reg);
81 |
82 | 参数:
83 | >search 用于匹配的字符串
84 | >reg 用于匹配的正则表达式
85 |
86 | 返回值:
87 | >array 包含所有匹配字符串的数组
88 |
89 | ###7.replace()
90 |
91 | 使用指定的字符串或正则表达式在当前字符串中进行匹配,并将匹配到的字符串替换为指定字符串。
92 |
93 | 语法:
94 | >str.replace(search,strN);
95 | >str.replace(reg,strN);
96 |
97 | 参数:
98 | >strN 用于替换的新字符串
99 |
100 | 返回值:
101 | >string 匹配和替换之后的新字符串
102 |
103 | ###8.search()
104 |
105 | 搜索与指定的字符串或正则表达式匹配的字符串的位置。
106 |
107 | 语法:
108 | >str.search(search);
109 | >str.search(reg);
110 |
111 | 返回值:
112 | >index 首次匹配成功的位置
113 | >-1 无匹配的字符串
114 |
115 | ###9.slice()
116 |
117 | 截取字符串。
118 |
119 | 语法:
120 | >str.slice(start[,end]);
121 |
122 | 参数:
123 | >start 截取开始的位置
124 | >end 截取终止的位置。该参数可省略,如果省略,则默认为 length-1,即截取到字符串末尾
125 |
126 | 返回值:
127 | >string 截取到的字符串(包含 start 位置,但不包含 end 位置)
128 |
129 | ###10.split()
130 |
131 | 将字符串分割为字符串数组。
132 |
133 | 语法:
134 | >str.split(separator,n);
135 |
136 | 参数:
137 | >separator 分割分隔符,可以是字符串或正则表达式
138 | >n 结果数组的最大长度。该参数可省略,如果省略,则返回整个结果数组;否则,返回的数组长度最大为 n
139 |
140 | 返回值:
141 | >array 字符串分割产生的数组
142 |
143 | ###11.substr()
144 |
145 | 截取字符串中从指定位置开始、指定长度的字符串。
146 |
147 | 语法:
148 | >str.substr(start,length);
149 |
150 | 参数:
151 | >start 截取开始的位置
152 | >length 截取的长度。该参数可省略,如果省略,则默认为 length-start,即截取到字符串末尾
153 |
154 | 返回值:
155 | >string 截取到的字符串
156 |
157 | ###12.substring()
158 |
159 | 截取字符串中包含在指定索引之间的字符串。
160 |
161 | 语法:
162 | >str.substring(start,stop);
163 |
164 | 参数:
165 | >start 截取开始的位置
166 | >stop 截取结束的位置
167 |
168 | 与 slice() 的不同之处是,substring() 不接受负值作为参数。
169 |
170 | 返回值:
171 | >string 截取到的字符串
172 |
173 | ###13.toLowerCase()
174 |
175 | 将字符串转换为小写形式。
176 |
177 | 语法:
178 | >str.toLowerCase();
179 |
180 | 返回值:
181 | >string 仅包含小写字母的字符串
182 |
183 | ###14.toUpperCase()
184 |
185 | 将字符串转换为大写形式。
186 |
187 | 语法:
188 | >str.toUpperCase();
189 |
190 | 返回值:
191 | >string 仅包含大写字母的字符串
--------------------------------------------------------------------------------
/posts/drafts/css/css_text.md:
--------------------------------------------------------------------------------
1 | 文本(text)
2 | =========
3 |
4 | color
5 | -----
6 |
7 | 设置文本的颜色。
8 |
9 | 属性值:
10 |
11 | 1. css_color
12 |
13 | direction
14 | ---------
15 |
16 | 设置文本的方向(书写方向)。
17 |
18 | 属性值:
19 |
20 | 1. ltr 从左到右(默认)
21 | 2. rtl 从右到左
22 |
23 | unicode-bidi
24 | ------------
25 |
26 | 设置文本的方向。
27 |
28 | 属性值:
29 |
30 | 1. normal
31 | 2. embed
32 | 3. bidi-override
33 |
34 | letter-spacing
35 | --------------
36 |
37 | 设置字符间距。
38 |
39 | 属性值:
40 |
41 | 1. normal 默认
42 | 2. CSS 尺寸值(可以为负值)
43 |
44 | line-height
45 | -----------
46 |
47 | 设置行高。
48 |
49 | 属性值:
50 |
51 | 1. normal 默认
52 | 2. CSS 尺寸值(可以为负值)
53 | 3. 整数(与字体大小相乘,作为行间距)
54 | 4. 百分值(与字体大小相乘,作为行间距)
55 |
56 | text-transform
57 | --------------
58 |
59 | 设置字母大小写的方式。
60 |
61 | 属性值:
62 |
63 | 1. none 默认效果(默认)
64 | 2. capitalize 单词首字母大写
65 | 3. uppercase 所有字母大写
66 | 4. lowercase 所有字母小写
67 |
68 | word-spacing
69 | ------------
70 |
71 | 设置词间距。
72 |
73 | 属性值:
74 |
75 | 1. normal 默认
76 | 2. CSS 尺寸值(可以为负值)
77 |
78 | text-align
79 | ----------
80 |
81 | 设置文本的对齐方式。
82 |
83 | 属性值:
84 |
85 | 1. left 左对齐(默认)
86 | 2. right 右对齐
87 | 3. center 居中对齐
88 | 4. justify 两端对齐
89 |
90 | `text-align:justify;` 时,可使用 `text-justify` 属性设置两端对齐的方式。
91 |
92 | text-justify
93 | ------------
94 |
95 | 设置两端对齐的方式。
96 |
97 | 属性值:
98 |
99 | 1. auto
100 | 2. none
101 | 3. inter-word
102 | 4. inter-ideograph
103 | 5. inter-cluster
104 | 6. distribute
105 | 7. kashida
106 |
107 | text-decoration
108 | ---------------
109 |
110 | 设置文本的装饰效果。
111 |
112 | 属性值:
113 |
114 | 1. none 无效果(默认)
115 | 2. underline 下划线
116 | 3. overline 上划线
117 | 4. line-through 删除线
118 |
119 | text-indent
120 | -----------
121 |
122 | 设置文本块中首行的缩进值。
123 |
124 | 属性值:
125 |
126 | 1. CSS 尺寸值(默认为 0)
127 | 2. 百分值(与父元素的宽度相乘,作为首行的缩进值)
128 |
129 | text-shadow
130 | -----------
131 |
132 | 设置文本阴影。
133 |
134 | 属性值:
135 |
136 | 1. h-shadow 阴影的水平偏移量(可以为负值)
137 | 2. v-shadow 阴影的垂直偏移量(可以为负值)
138 | 3. blur 模糊值(可选,默认为 0)
139 | 4. color 阴影的颜色(可选,默认为文本的颜色)
140 |
141 | hanging-punctuation
142 | -------------------
143 |
144 | punctuation-trim
145 | ----------------
146 |
147 | text-align-list
148 | ---------------
149 |
150 | text-emphasis
151 | -------------
152 |
153 | text-outline
154 | ------------
155 |
156 | text-overflow
157 | -------------
158 |
159 | white-space
160 | -----------
161 |
162 | 规定如何处理元素中的空白字符。
163 |
164 | 属性值:
165 |
166 | 1. normal 忽略换行符,合并其他字符(多个空白字符看作一个空格)(默认)
167 | 2. pre 保留
168 | 3. nowrap 忽略换行符,保留其他字符
169 | 4. pre-wrap 保留换行符,忽略其他字符
170 | 5. pre-line 保留换行符,合并其他字符
171 |
172 | text-wrap
173 | ---------
174 |
175 | 设置文本换行规则。
176 |
177 | 属性值:
178 |
179 | 1. normal 默认
180 | 2. none 不换行
181 | 3. unrestricted 任意位置可换行
182 | 4. suppress 压缩元素中换行??
183 |
184 | word-break
185 | ----------
186 |
187 | 设置自动换行的规则。
188 |
189 | 属性值:
190 |
191 | 1. normal 默认
192 | 2. break-all 单词内可换行
193 | 3. keep-all 只在空格或连字符出换行
194 |
195 | word-wrap
196 | ---------
197 |
198 | 设置长文本或 URL 的换行方式。
199 |
200 | 属性值:
201 |
202 | 1. normal 默认
203 | 2. break-word 允许文本或 URL 内换行
--------------------------------------------------------------------------------
/posts/drafts/w3c/semantic-web/query.md:
--------------------------------------------------------------------------------
1 | QUERY
2 |
3 | current status:
4 | + SPARQL
5 |
6 | What is Query?
7 |
8 | “Query” in the Semantic Web context means technologies and protocols that can programmatically retrieve information from the Web of Data.
9 |
10 | What is Query Used For?
11 |
12 | The Semantic Web is a Web of data — of dates and titles and part numbers and chemical properties and any other data one might conceive of. RDF provides the foundation for publishing and linking your data. Various technologies allow you to embed data in documents (RDFa, GRDDL) or expose what you have in SQL databases, or make it available as RDF files.
13 |
14 | However, just as relational databases or XML need specific query languages (SQL and XQuery, respectively), the Web of Data, typically represented using RDF as a data format, needs its own, RDF-specific query language and facilities. This is provided by the SPARQLquery language and the accompanying protocols. SPARQL makes it possible to send queries and receive results, e.g., through HTTP or SOAP.
15 |
16 | Technically, SPARQL queries are based on (triple) patterns. RDF can be seen as a set of relationships among resources (i.e., RDF triples); SPARQL queries provide one or more patterns against such relationships. These triple patterns are similar to RDF triples, except that one or more of the constituent resource references are variables. A SPARQL engine would returns the resources for all triples that match these patterns.
17 |
18 | Using SPARQL consumers of the Web of Data can extract possibly complex information (i.e., existing resource references and their relationships) which are returned, for example, in a table format. This table can be incorporated into another Web page; using this approach SPARQL provides a powerful tool to build, for example, complex mash-up sites or search engines that include data stemming from the Semantic Web.
19 |
20 | Examples
21 |
22 | The short introduction on inferences includes a small example with a dataset containing the triple (Flipper isA Dolphin). Using SPARQL the user may issue a query of the form (Flipper isA ?species) where ?species denotes a variable. The query engine checks through the data and retrieves the value of Dolphin as a possible value for ?species which constitutes a possible answer to the query. The dataset may also contain the triple (Flipper isA Mammal) (e.g., as a result of an inference); in this case Mammal is also a possible value for ?species which should also be returned as a result of the query. By providing several triple patterns, complex queries can be created and used by the application.
23 |
24 | Learn More
25 |
26 | The Semantic Web community maintains a list of books on a W3C Wiki page. Some of those books are introductory in nature while others are conference proceedings or textbook that address more advanced topics. Details of recent and upcoming Semantic Web related talks, given by the W3C Staff, the staff of the W3C Offices, and members of the W3C Working Groups are available separately; the slides are usually publicly available. The W3C also maintains a collection of Semantic Web Case Studies and Use Cases that show how Semantic Web technologies, including queries, are used in practice. Finally, the Semantic Web FAQ may also be of help in understanding the various concepts.
--------------------------------------------------------------------------------
/posts/drafts/w3c/agents/browser-media-players.md:
--------------------------------------------------------------------------------
1 | BROWSERS, MEDIA PLAYERS
2 |
3 | current status:
4 | + Security or User Agents
5 | + DOM
6 | + HTML
7 | + HTML for User Agents
8 | + User Agent Accessibility Guidelines (UAAG)
9 | + Plugins
10 | + Web IDL
11 |
12 | 'User agents' - web browsers, media players, browser extensions, on-the-fly converters, plug-ins, bots, aggregators and mobile browsers - provide a human or machine interface to the web. At their best, they allow all of us to explore a universal space of web content.
13 |
14 | Examples of user agent standards issues
15 |
16 | User agent developers need to pay particular heed to issues surrounding use of their agents by people in other parts of the world, speaking other languages, using other devices and with a variety of assistive technologies that allow users to use different modes of input and output (such as speech input, tactile displays, semantic navigation, and a variety of display preferences).
17 |
18 | Example 1: An online app developer wants to provide context-sensitive help in a tooltip that is displayed when the user (with a mouse) hovers over or (with a keyboard) focuses a "Help" icon. In most browsers, the functionality automatically works for hover; the title element is displayed. However, most browsers don't provide the same functionality for keyboard users on focus. To compensate for the missing functionality in the browsers, the developer has to create scripts to provide it for her content. Unfortunately most developers don't do this - and indeed, they shouldn't have to because the browser should provide the same functionality for people who cannot use the mouse.
19 |
20 | Example 2: A developer uses the css declaration text-transform: lowercase to style a magazine headline (about fresh orange juice) originally composed in caps. The content is then internationalised for a Turkish-language audience, and a language of Turkish declared using the attribute lang="tr". The lower case of the Turkish character İ (a capital I dotted) should return a i. Major browsers, however convert the Turkish character I to i. An innocuous headline "Squeeze Often" suddenly becomes rather rude...
21 |
22 | W3C staff documented some Common User Agent Problems in a Team Submission, still a useful document although it was published in 2003.
23 |
24 | Accessibility Guidelines for User Agents
25 |
26 | W3C publishes guidelines for creating accessible authoring tools: User Agent Accessibility Guidelines (UAAG). UAAG 2.0 is intended for the current and future generation of user agents. You can implement the latest draft of the User Agent Accessibility Guidelines (UAAG 2.0) by following Implementing UAAG 2.0 - a guide to implementing and understanding the guidelines.
27 |
28 | You may also wish to consult the current formally approved, stable and referenceable technical recommendation for accessibility is UAAG 1.0.
29 |
30 | Browser developers need some help at making the web readable by all; extension developers can respond to limitations of particular browser functionality, and the best extensions can be incorporated into the browsers' standard functionality. Whether you develop browsers, extensions, bots, aggregators, media players or an as-yet undreamed of way of reading the web, to create that web that is readable by all, the User Agent Accessibility Guidelines provide the place to start.
--------------------------------------------------------------------------------
/posts/drafts/w3c/web-design/mobile-web.md:
--------------------------------------------------------------------------------
1 | MOBILE WEB
2 |
3 | The widespread deployment of Web-enabled mobile devices (such as phones) make them a target of choice for content creators. Understanding their strengths and their limitations, and using technologies that fit these conditions are key to create success mobile-friendly Web content.
4 |
5 | See also the Mobile Web Initiative pages.
6 |
7 | current status:
8 | + Mobile Web Authoring
9 | + Device Independence Authoring
10 | + CSS Mobile
11 | + SVG Tiny
12 | + XHTML For Mobile
13 | + Mobile Web Applications
14 | + Mobile Web For Social Development
15 | + Geospatial
16 |
17 | What is specific to authoring for mobile devices?
18 |
19 | Ideally, site authors would be able to meet the growing demand for a quality mobile experience without changing a line of code. But the reality is that a site designed specifically with mobility in mind will always provide a much better user experience to mobile users, even when they are equipped with the device du jour.
20 |
21 | The reasons for that include the challenges posed by network costs and delays, memory and CPU limitations, keyboard and pointing devices differences. As importantly, they feature a growing set of advantages with their personal and always-available nature, and their increasingly context-aware capabilities.
22 |
23 | As a result, the mobile experience often merit its own set of design considerations, as discussed in a growing body of literature, including W3C’s mobile Web authoring and device independent authoring guidelines. Mobile users operate in a very different usage context than PC users, and providing them with an experience customized to their needs is likely to be the best service to them.
24 |
25 | A number of the barriers that mobile users face are similar to those experienced by people with disabilities. These similarities make it natural to aim at developing Web sites that are accessible both for people with disabilities and for mobile devices. The two reference documents in this space, the Web Content Accessibility Guidelines (WCAG) and the Mobile Web Best Practices have thus a number of links and similarities.
26 |
27 | What technologies have been developed to fit mobile devices?
28 |
29 | Over the past years, W3C has developed a number of Web technologies that explicitly take into account the specificities of mobile devices:
30 |
31 | + CSS Mobile, a profile of the cascading style sheet language that matches the need of mobile Web authors
32 | + SVG Tiny, a profile of the Web’s scalable vector graphics format well-suited to the capabilities of mobile devices
33 | + XHTML For Mobile, which defines a subset of XHTML for mobile
34 |
35 | The latest generation of mobile browsers are capable of using more advanced Web technologies, including features from HTML5, CSS 2.1 and 3, a number of rich JavaScript APIs, opening the way for Web-based mobile applications (including widgets).
36 |
37 | Learn more
38 |
39 | The Mobile Web Initiative has set up a training program to help Web designers and content producers who are already familiar with the desktop world to become familiar with the Web as delivered on mobile devices.
40 |
41 | Standards for Web Applications on Mobile provide a complete overview of all the technologies in development in W3C that help making the Web the best platform for developing Web applications.
--------------------------------------------------------------------------------
/posts/drafts/browser-apis/dom/selection.md:
--------------------------------------------------------------------------------
1 | Selection
2 | ========
3 |
4 | `Selection` 对象代表了当前页面中被选中的文本,可通过 getSelection() 方法获取该对象:
5 |
6 | var se=window.getSelection();
7 | var se=document.getSelection();
8 |
9 | 属性
10 | ----
11 |
12 | ###anchorNode/baseNode
13 |
14 | 选择起点所在的节点/元素。
15 |
16 | ###anchorOffset/baseOffset
17 |
18 | 选择起点相对于其所在的节点/元素的位置。
19 |
20 | ###focusNode/extentNode
21 |
22 | 选择终点所在的节点/元素。
23 |
24 | ###focusOffset/extentOffset
25 |
26 | 选择终点相对于其所在的节点/元素的位置。
27 |
28 | ###isCollapsed
29 |
30 | 选择起点与终点是否重合(未选择任何内容)。
31 |
32 | ###rangeCount
33 |
34 | 选择范围总数(1:已选择;0:未选择)。
35 |
36 | ###type
37 |
38 | 已选择的类型("Range":范围(已选择);"Caret":插入光标(未选择))。
39 |
40 | ###
41 |
42 | 方法
43 | ----
44 |
45 | ###getRangeAt()
46 |
47 | 获取指定位置的 Range 对象。
48 |
49 | 语法:
50 | >selection.getRangeAt(index);
51 |
52 | 参数:
53 | >index Range 的索引
54 |
55 | 返回值:
56 | >Range 对象
57 |
58 | ###collapse()
59 |
60 | 将 Selection 对象折叠为插入点(不修改文档内容)。
61 |
62 | 语法:
63 | >selection.collapse(parentNode, offset);
64 |
65 | 参数:
66 | >parentNode 折叠后光标所在的元素
67 | >offset 0:光标位于元素文本的开头;1:光标位于元素文本的末尾
68 |
69 | ###extend()
70 |
71 | 将 Selection 对象的焦点移动到指定元素的指定位置。
72 |
73 | 语法:
74 | >selection.extend(parentNode, offset);
75 |
76 | 参数:
77 | >parentNode 目标元素
78 | >offset 目标位置
79 |
80 | ###modify()
81 |
82 | 修改 Selection 对象选择的内容。
83 |
84 | 语法:
85 | >selection.modify(alter, direction, granularity);
86 |
87 | 参数:
88 | >alter 修改类型("move":移动;"extend":扩展)
89 | >direction 修改进行的方向。可指定的值:
90 | >>forward 向前(根据语言的方向)
91 | >>backward 向后(根据语言的方向)
92 | >>left 向左
93 | >>right 向右
94 |
95 | >granularity 指定修改的间隔。可指定的值:
96 | >>character 按字符
97 | >>word 按单词
98 | >>sentence 按句子
99 | >>line 按行
100 | >>paragraph 按段落
101 | >>lineboundary 行边界
102 | >>sentenceboundary 句边界
103 | >>paragraphboundary 段落边界
104 | >>documentboundary 文档边界
105 |
106 | ###collapseToStart()
107 |
108 | 将光标定位到 Selection 对象首个 Range 的起点。
109 |
110 | 语法:
111 | >selection.collapseToStart();
112 |
113 | ###collapseToEnd()
114 |
115 | 将光标定位到 Selection 对象最后一个个 Range 的终点。
116 |
117 | 语法:
118 | >selection.collapseToEnd();
119 |
120 | ###selectAllChildren()
121 |
122 | 选中指定元素的所有子元素(之前选中的内容会被丢弃)。
123 |
124 | 语法:
125 | >selection.selectAllChildren(parentNode);
126 |
127 | ###addRange()
128 |
129 | 将 Range 添加到 Selection 对象。
130 |
131 | 语法:
132 | >selection.addRange(range);
133 |
134 | ###removeRange()
135 |
136 | 从 Selection 对象中移除指定的 Range 对象。
137 |
138 | 语法:
139 | >selection.removeRange(range)
140 |
141 | ###removeAllRanges()
142 |
143 | 从 Selection 对象中移除所有的 Range 对象。
144 |
145 | 语法:
146 | >selection.removeAllRanges();
147 |
148 | ###deleteFromDocument()
149 |
150 | 从文档中删除选中的内容。
151 |
152 | 语法:
153 | >selection.deleteFromDocument();
154 |
155 | ###toString()
156 |
157 | 获取选中的文本内容。
158 |
159 | 语法:
160 | >selection.toString();
161 |
162 | ###containsNode(aNode, aPartlyContained)
163 |
164 | 检测指定元素知否包含(或部分包含)在 Selection 对象中。
165 |
166 | 语法:
167 | >selection.containsNode(aNode, aPartlyContained);
168 |
169 | 参数:
170 | >aNode 要检测的元素
171 | >aPartlyContained 是否检测部分包含(true:检测部分包含;false:检测完全包含)
172 |
173 | 返回值:
174 | >true 包含/部分包含
175 | >false 不包含/完全包含
176 |
--------------------------------------------------------------------------------
/posts/tools-and-softwares-on-my-computer.md:
--------------------------------------------------------------------------------
1 | 我所使用的一些工具及软件
2 | =====================
3 |
4 | 我对工具和软件是十分挑剔的,我偏爱开源和免费,喜欢跨平台的软件,速度和高效是我的终极目标。
5 |
6 | 0.目录
7 | ------
8 |
9 | 1. Chrome (网页浏览器)
10 | 2. CCleaner (系统优化管理工具)
11 | 3. Sumatra PDF (电子书阅读器)
12 | 4. Irfan View (看图工具)
13 | 5. Clover (资源管理器增强工具)
14 | 6. Dexport (虚拟桌面工具)
15 | 7. ADSafe (广告过滤工具)
16 |
17 | 1.Chrome
18 | --------
19 |
20 | Google 的浏览器产品,市场占有率第一。
21 |
22 | ###特性
23 |
24 | 1. 丰富的插件及主题
25 | 个性化方便。
26 | 2. 极速、跨平台
27 | 支持除了没人用的平台外的所有平台。只是内存占用稍大,其他方面的表现都是不错的。
28 | 3. 对 Web 新标准最好的支持
29 | 许多新的功能都是在浏览器中完善了,才写到 Web 标准中的。
30 | 4. 书签、插件和设置等内容可同步
31 | 对于使用了十几个插件和有上万个书签的用户,同步功能都是首先考虑的。
32 |
33 | 如果你还在用 IE、搜狗、360 等乱七八糟的浏览器,抓紧换掉吧。
34 |
35 | ###下载
36 |
37 | >提供了几十种语言支持:
38 | >