Skip to content

Commit 47165c7

Browse files
committed
+ Setup section
1 parent 1aabf65 commit 47165c7

File tree

5 files changed

+96
-21
lines changed

5 files changed

+96
-21
lines changed

README.md

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,35 @@
1313
## FileAPI
1414
A set of javascript tools for working with files.
1515

16+
17+
<a name="FileAPI.setup"></a>
18+
### Setup
19+
Connecting the library to your project.
20+
If you need a CORS, then edit the `crossdomain.xml` and put it in the root of remote domain.
21+
22+
```html
23+
<script>
24+
window.FileAPI = {
25+
debug: false // debug mode, see Console
26+
, cors: true // if used CORS
27+
, staticPath: '/js/FileAPI/dist/' // path to '*.swf'
28+
};
29+
</script>
30+
<script src="/js/FileAPI/dist/FileAPI.min.js"></script>
31+
32+
<!-- OR -->
33+
34+
<script>
35+
window.FileAPI = { /* options */ };
36+
require(['FileAPI'], function (FileAPI){
37+
// ...
38+
});
39+
</script>
40+
```
41+
42+
---
43+
44+
1645
<a name="FileAPI.getFiles"></a>
1746
### getFiles(input`:HTMLInputElement|Event|$.Event`)`:Array`
1847
Get files from `input` element or `event` object, also support `jQuery`.
@@ -32,6 +61,7 @@ FileAPI.event.on(el, function (evt/**Event*/){
3261

3362
---
3463

64+
3565
<a name="FileAPI.getInfo"></a>
3666
### getInfo(file`:Object`, callback`:Function`)`:void`
3767
Get info of file (see also: FileAPI.addInfoReader).
@@ -988,8 +1018,10 @@ All the other codes - fatal error, user's involvement is recommend.
9881018

9891019
---
9901020

1021+
<a name="buttons.examples"></a>
9911022
## Buttons examples
9921023

1024+
<a name="buttons.examples.base"></a>
9931025
### Base
9941026
Simple input[type="file"]
9951027

@@ -1001,6 +1033,7 @@ Simple input[type="file"]
10011033

10021034
---
10031035

1036+
<a name="buttons.examples.button"></a>
10041037
### Button
10051038
Stylized button.
10061039

@@ -1050,6 +1083,7 @@ Stylized button.
10501083
---
10511084

10521085

1086+
<a name="buttons.examples.link"></a>
10531087
### Link
10541088
Button like link.
10551089

@@ -1102,29 +1136,33 @@ Button like link.
11021136
### 2.0.0
11031137
<ul>
11041138
<li>+ FileAPI.Camera (HTML5 and Flash fallback)</li>
1105-
<li>+ jquery.fileapi.js</li>
1139+
<li>+ jquery.fileapi.js, see <a href="http://rubaxa.github.io/jquery.fileapi/">demo</a></li>
11061140
<li>+ npm support</li>
11071141
<li>+ grunt support</li>
1142+
<li>+ requirejs support</li>
11081143
<li>+ [#80](https://https://github.com/mailru/FileAPI/issues/80): FileAPI.Image.fn.overlay</li>
11091144
<li>`imageTransform` — now supports: `crop`, `type`, `quality` and `overlay` properties.</li>
11101145
<li>Improved the documentation</li>
11111146
</ul>
11121147

11131148

11141149
### 1.2.5
1115-
* [#86](https://github.com/mailru/FileAPI/issues/86): Smarter upload recovery
1116-
* [#87](https://github.com/mailru/FileAPI/issues/87): Fixed upload files into browsers that do not support FormData
1117-
* Fixed support "accept" attribute for Flash.
1118-
* Fixed detection of HTML5 support for FireFox 3.6
1119-
* + FileAPI.html5 option, default "true"
1120-
1150+
<ul>
1151+
<li>[#86](https://github.com/mailru/FileAPI/issues/86): Smarter upload recovery</li>
1152+
<li>[#87](https://github.com/mailru/FileAPI/issues/87): Fixed upload files into browsers that do not support FormData</li>
1153+
<li>Fixed support "accept" attribute for Flash.</li>
1154+
<li>Fixed detection of HTML5 support for FireFox 3.6</li>
1155+
<li> + FileAPI.html5 option, default "true"</li>
1156+
</ul>
11211157

11221158
### 1.2.4
1123-
* Fixed auto orientation image by EXIF (Flash)
1124-
* Fixed image dimensions after rotate (Flash)
1125-
* [#82](https://github.com/mailru/FileAPI/issues/82): "undefined" data-fields cause exceptions
1126-
* [#83](https://github.com/mailru/FileAPI/issues/83): Allow requests without files
1127-
* [#84](https://github.com/mailru/FileAPI/pull/84): Fixed connection abort when waiting for connection recovery
1159+
<ul>
1160+
<li>Fixed auto orientation image by EXIF (Flash)</li>
1161+
<li>Fixed image dimensions after rotate (Flash)</li>
1162+
<li>[#82](https://github.com/mailru/FileAPI/issues/82): "undefined" data-fields cause exceptions</li>
1163+
<li>[#83](https://github.com/mailru/FileAPI/issues/83): Allow requests without files</li>
1164+
<li>[#84](https://github.com/mailru/FileAPI/pull/84): Fixed connection abort when waiting for connection recovery</li>
1165+
</ul>
11281166

11291167

11301168
### 1.2.3

README.ru.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@
1414
Набор JavaScript инструментов для работы с файлами.
1515

1616

17+
<a name="FileAPI.setup"></a>
18+
### Setup
19+
Подключение библиотеки к проекту.
20+
Если вы собираетесь использовать CORS, то отредактируйте файл `crossdomain.xml` и
21+
разместите в коре удаленного домена.
22+
23+
```html
24+
<script>
25+
window.FileAPI = {
26+
debug: false // дебаг режим, смотрите Console
27+
, cors: true // если используете CORS
28+
, staticPath: '/js/FileAPI/dist/' // путь к '*.swf'
29+
};
30+
</script>
31+
<script src="/js/FileAPI/dist/FileAPI.min.js"></script>
32+
33+
<!-- ИЛИ -->
34+
35+
<script>
36+
window.FileAPI = { /* etc. */ };
37+
require(['FileAPI'], function (FileAPI){
38+
// ...
39+
});
40+
</script>
41+
```
42+
43+
---
44+
45+
1746
<a name="FileAPI.getFiles"></a>
1847
### getFiles(input`:HTMLInputElement|Event|$.Event`)`:Array`
1948
Получить список файлов из `input` элемента, или `event`, также поддерживается `jQuery`.

index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ <h4 class="fn" data-anchor="prop">
9797
<x:v mod="txt.hl" output="text" bind="true">prop.descr[ctx.lang] || prop.descr.en</x:v>
9898
</div>
9999

100-
<div x:if="prop.code" x:highlight="prop.code.type">
101-
<pre>
102-
<code>
103-
{{prop.code.source[ctx.lang]}}
104-
</code>
105-
</pre>
100+
<div
101+
x:if="prop.code"
102+
data-type="{{prop.code.type}}"
103+
x:highlight="prop.code.source[ctx.lang]">
106104
</div>
105+
107106
<div x:if="prop.code" style="height: 20px;"></div>
108107
</div>
109108

@@ -179,7 +178,8 @@ <h4 data-anchor="fn" class="fn">
179178
init: function (el, code){
180179
var type = $.attr(el, 'data-type');
181180
el.className += ' language-' + (type == 'js' ? 'javascript' : type);
182-
el.innerHTML = '<pre><code>'+code+'</code></pre>';
181+
el.innerHTML = '<pre><code></code></pre>';
182+
el.firstChild.firstChild.appendChild(document.createTextNode(code));
183183
hljs.highlightBlock(el);
184184
},
185185
update: function (el, code){
@@ -190,7 +190,8 @@ <h4 data-anchor="fn" class="fn">
190190

191191

192192
xtpl.mod('txt.hl', function (text){
193-
returntext ? text.replace(/`([^`]+)`/g, '<span class="code">$1</span>') : '';
193+
text = text ? text.replace(/`([^`]+)`/g, '<span class="code">$1</span>') : '';
194+
returntext.replace(/\[([^\]]+)\]\(([^\)]+)\)/g, '<a href="$2">$1</a>');
194195
});
195196

196197

statics/docs.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

statics/main.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ body {
2525
background-image: url('body__top.png');
2626
}
2727

28+
a {
29+
color: #ddd;
30+
}
31+
a:hover {
32+
color: #fff;
33+
}
34+
2835
.logo {
2936
height: 210px;
3037
background: url('logo.png') center center no-repeat;

0 commit comments

Comments
 (0)