Skip to content

Commit 736d789

Browse files
committed
+ merge master
2 parents 28b468b + b2fac04 commit 736d789

20 files changed

+660
-293
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: node_js
22
node_js:
3-
- 0.8
43
- 0.10
54
before_script:
65
- npm install -g grunt-cli

Gruntfile.js

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,28 @@ module.exports = function (grunt){
3838
src: 'lib/FileAPI.core.js'
3939
},
4040

41+
connect: {
42+
server: {
43+
options: {
44+
port: 9001,
45+
base: '.'
46+
}
47+
}
48+
},
49+
4150
qunit: {
42-
options: {
43-
files: {
44-
'1px.gif':['tests/files/1px.gif']
45-
, 'hello.txt':['tests/files/hello.txt']
46-
, 'image.jpg':['tests/files/image.jpg']
47-
, 'dino.png':['tests/files/dino.png']
48-
, 'multiple':['tests/files/1px.gif', 'tests/files/hello.txt', 'tests/files/image.jpg', 'tests/files/dino.png', 'tests/files/lebowski.json']
51+
all: {
52+
options: {
53+
files: {
54+
'1px.gif':['tests/files/1px.gif']
55+
, 'hello.txt':['tests/files/hello.txt']
56+
, 'image.jpg':['tests/files/image.jpg']
57+
, 'dino.png':['tests/files/dino.png']
58+
, 'multiple':['tests/files/1px.gif', 'tests/files/hello.txt', 'tests/files/image.jpg', 'tests/files/dino.png', 'tests/files/lebowski.json']
59+
},
60+
urls: ['http://127.0.0.1:<%=connect.server.options.port%>/tests/index.html']
4961
}
50-
},
51-
all: ['tests/*.html']
62+
}
5263
},
5364

5465
concat: {
@@ -62,10 +73,10 @@ module.exports = function (grunt){
6273

6374
all: {
6475
src: [
65-
'lib/canvas-to-blob.js' // only frist
76+
'lib/canvas-to-blob.js'
6677
, 'lib/FileAPI.core.js'
6778
, 'lib/FileAPI.Image.js'
68-
, 'lib/load-image-ios.js' // after FileAPI.Image
79+
, 'lib/load-image-ios.js'
6980
, 'lib/FileAPI.Form.js'
7081
, 'lib/FileAPI.XHR.js'
7182
, 'lib/FileAPI.Camera.js'
@@ -76,10 +87,10 @@ module.exports = function (grunt){
7687

7788
html5: {
7889
src: [
79-
'lib/canvas-to-blob.js' // only frist
90+
'lib/canvas-to-blob.js'
8091
, 'lib/FileAPI.core.js'
8192
, 'lib/FileAPI.Image.js'
82-
, 'lib/load-image-ios.js' // after FileAPI.Image
93+
, 'lib/load-image-ios.js'
8394
, 'lib/FileAPI.Form.js'
8495
, 'lib/FileAPI.XHR.js'
8596
, 'lib/FileAPI.Camera.js'
@@ -114,12 +125,13 @@ module.exports = function (grunt){
114125
grunt.loadNpmTasks('grunt-contrib-concat');
115126
grunt.loadNpmTasks('grunt-contrib-uglify');
116127
grunt.loadNpmTasks('grunt-contrib-watch');
128+
grunt.loadNpmTasks('grunt-contrib-connect');
117129

118130
// Load custom QUnit task, based on grunt-contrib-qunit, but support "files" option.
119131
grunt.loadTasks('./tests/grunt-task/');
120132

121133
// "npm build" runs these tasks
122-
grunt.registerTask('test', ['jshint', 'concat', 'qunit']);
123-
grunt.registerTask('build', ['version', 'concat', 'uglify', 'qunit']);
124-
grunt.registerTask('default', ['jshint', 'build']);
134+
grunt.registerTask('tests', ['jshint', 'concat', 'connect', 'qunit']);
135+
grunt.registerTask('build', ['version', 'concat', 'uglify']);
136+
grunt.registerTask('default', ['tests', 'build']);
125137
};

README.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<a name="FileAPI"></a>
2-
## FileAPI
2+
## FileAPI <img src="https://api.travis-ci.org/mailru/FileAPI.png?branch=master"/>
33
A set of javascript tools for working with files.
44

55
<a name="started"></a>
@@ -867,12 +867,12 @@ FileAPI.Image(imageFile)
867867
---
868868

869869
<a name="FileAPI.Image.resize"></a>
870-
### resize(width`:Number`, height`:Number`[, type`:String`])`:FileAPI.Image`
870+
### resize(width`:Number`, height`:Number`[, strategy`:String`])`:FileAPI.Image`
871871
Resize image.
872872

873873
* width — new image width
874874
* height — new image height
875-
* type — enum: `min`, `max`, `preview`. By default `undefined`.
875+
* strategy — enum: `min`, `max`, `preview`. By default `undefined`.
876876

877877
```js
878878
FileAPI.Image(imageFile)
@@ -1284,10 +1284,16 @@ Submit Query
12841284
<script>
12851285
(function (ctx, jsonp){
12861286
'use strict';
1287-
if( ctx && ctx[jsonp] ){
1288-
ctx[jsonp](200/*http.status*/, 'OK' /*http.statusText*/, "response body");
1287+
var status = {{httpStatus}}, statusText = "{{httpStatusText}}", response = "{{responseBody}}";
1288+
try {
1289+
ctx[jsonp](status, statusText, response);
1290+
} catch (e){
1291+
var data = "{\"id\":\""+jsonp+"\",\"status\":"+status+",\"statusText\":\""+statusText+"\",\"response\":\""+response.replace(/\"/g, '\\\\\"')+"\"}";
1292+
try {
1293+
ctx.postMessage(data, document.referrer);
1294+
} catch (e){}
12891295
}
1290-
})(window, '{{$request_param_callback}}');
1296+
})(window.parent, '{{request_param_callback}}');
12911297
</script>
12921298
12931299
<!-- or -->
@@ -1496,6 +1502,28 @@ Button like link.
14961502
14971503
<a name="Changelog"></a>
14981504
## Changelog
1505+
<ul>
1506+
<li>+ QUnit-tests for iframe-transport</li>
1507+
<li>+ `postMessage` for iframe-transport</li>
1508+
<li>+ `jsonp: "callback"` option</li>
1509+
<li>* resize: `imageTransform.type` rename to `imageTransform.strategy` (!!!)</li>
1510+
</ul>
1511+
1512+
### 2.0.2
1513+
<ul>
1514+
<li>+ test: upload headers</li>
1515+
<li>+ test: upload + camanjs</li>
1516+
<li>+ test: upload + autoOrientation</li>
1517+
<li>FileAPI.class.php: + HTTP header Content-Type: application/json</li>
1518+
<li>#143: + `FileAPI.flashWebcamUrl` option</li>
1519+
<li>* merge v1.2.7</li>
1520+
<li>+ `FileAPI.formData: true` option</li>
1521+
</il>
1522+
1523+
### 2.0.1
1524+
<ul>
1525+
<li>+ support 'filter' prop in imageTransform</li>
1526+
</il>
14991527
15001528
### 2.1.0
15011529
<ul>

README.ru.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,12 +866,12 @@ FileAPI.Image(imageFile)
866866
---
867867

868868
<a name="FileAPI.Image.resize"></a>
869-
### resize(width`:Number`, height`:Number`[, type`:String`])`:FileAPI.Image`
869+
### resize(width`:Number`, height`:Number`[, strategy`:String`])`:FileAPI.Image`
870870
Ресайз.
871871

872872
* width — новая ширина
873873
* height — новая высота
874-
* type — enum: `min`, `max`, `preview`. По умолчанию `undefined`.
874+
* strategy — enum: `min`, `max`, `preview`. По умолчанию `undefined`.
875875

876876
```js
877877
FileAPI.Image(imageFile)
@@ -1283,10 +1283,16 @@ Submit Query
12831283
<script>
12841284
(function (ctx, jsonp){
12851285
'use strict';
1286-
if( ctx && ctx[jsonp] ){
1287-
ctx[jsonp](200/*http.status*/, 'OK' /*http.statusText*/, "response body");
1286+
var status = {{httpStatus}}, statusText = "{{httpStatusText}}", response = "{{responseBody}}";
1287+
try {
1288+
ctx[jsonp](status, statusText, response);
1289+
} catch (e){
1290+
var data = "{\"id\":\""+jsonp+"\",\"status\":"+status+",\"statusText\":\""+statusText+"\",\"response\":\""+response.replace(/\"/g, '\\\\\"')+"\"}";
1291+
try {
1292+
ctx.postMessage(data, document.referrer);
1293+
} catch (e){}
12881294
}
1289-
})(window, '{{$request_param_callback}}');
1295+
})(window.parent, '{{request_param_callback}}');
12901296
</script>
12911297
12921298
<!-- or -->

0 commit comments

Comments
 (0)