Skip to content

Commit 9a0d4b9

Browse files
committed
grunt
1 parent 9f53ec3 commit 9a0d4b9

File tree

5 files changed

+131
-107
lines changed

5 files changed

+131
-107
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ test/uploadsTemp/
99
.*.sw[a-z]
1010
build/*
1111
release/*
12+
node_modules

Gruntfile.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module.exports = function(grunt) {
2+
gzip = require("gzip-js");
3+
grunt.initConfig({
4+
pkg: grunt.file.readJSON('package.json'),
5+
compare_size: {
6+
files: [ "./client/uploader.js", "./client/uploader.min.js" ],
7+
options: {
8+
compress: {
9+
gz: function( contents ) {
10+
return gzip.zip( contents, {} ).length;
11+
}
12+
},
13+
cache: "./client/.sizecache.json"
14+
}
15+
},
16+
concat: {
17+
options: {
18+
separator: '\n\n'
19+
},
20+
dist: {
21+
src: ["./client/js/header.js", "./client/js/util.js", "./client/js/button.js", "./client/js/ajax.requester.js", "./client/js/deletefile.ajax.requester.js", "./client/js/handler.base.js", "./client/js/window.receive.message.js", "./client/js/handler.form.js", "./client/js/handler.xhr.js", "./client/js/uploader.basic.js", "./client/js/dnd.js", "./client/js/uploader.js"],
22+
dest: './client/uploader.js'
23+
}
24+
},
25+
uglify: {
26+
options: {
27+
banner: '/**\n' +
28+
' * https://github.com/SimonWaldherr/uploader\n' +
29+
' *\n' +
30+
' * Multiple file upload component with progress-bar, drag-and-drop, support for all modern browsers.\n' +
31+
' *\n' +
32+
' * Original version: 1.0 © 2010 Andrew Valums ( andrew(at)valums.com )\n' +
33+
' * Next Maintainer (2.0+): © 2012, Ray Nicholus ( fineuploader(at)garstasio.com )\n' +
34+
' * Current Maintainer (3.X (MIT Branch)): © 2013, Simon Waldherr ( contact(at)simonwaldherr.de )\n' +
35+
' *\n' +
36+
' * Licensed under MIT license see license.txt.\n' +
37+
' */\n\n',
38+
footer: '\n\n\n\n /* foo */'
39+
},
40+
dist: {
41+
files: {
42+
'./client/uploader.min.js': ['./client/uploader.js']
43+
}
44+
}
45+
}
46+
});
47+
grunt.loadNpmTasks("grunt-compare-size");
48+
grunt.loadNpmTasks('grunt-contrib-uglify');
49+
grunt.loadNpmTasks('grunt-contrib-concat');
50+
grunt.registerTask('default', ['concat', 'uglify', 'compare_size']);
51+
};

client/uploader.js

+22
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
/*jslint browser: true, unparam: true, indent: 2 */
1414

15+
16+
1517
/*jslint browser: true, unparam: true, indent: 2, bitwise: true */
1618
/*globals window, navigator, document, FormData, File, HTMLInputElement, XMLHttpRequest, Blob*/
1719

@@ -494,6 +496,8 @@ qq.DisposeSupport = function () {
494496
};
495497
};
496498

499+
500+
497501
/*jslint browser: true, unparam: true, indent: 2 */
498502
/*globals qq */
499503

@@ -592,6 +596,8 @@ qq.UploadButton.prototype = {
592596
}
593597
};
594598

599+
600+
595601
/** Generic class for sending non-upload ajax requests and handling the associated responses **/
596602
/*jslint browser: true, unparam: true, indent: 2 */
597603
/*globals qq, XMLHttpRequest */
@@ -757,6 +763,8 @@ qq.AjaxRequestor = function (o) {
757763
};
758764
};
759765

766+
767+
760768
/** Generic class for sending non-upload ajax requests and handling the associated responses **/
761769
/*jslint browser: true, unparam: true, indent: 2 */
762770
/*globals qq, XMLHttpRequest*/
@@ -799,6 +807,8 @@ qq.DeleteFileAjaxRequestor = function (o) {
799807
};
800808
};
801809

810+
811+
802812
/**
803813
* Class for uploading files, uploading itself is handled by child classes
804814
*/
@@ -979,6 +989,8 @@ qq.UploadHandler = function (o) {
979989
};
980990
};
981991

992+
993+
982994
/*jslint browser: true, unparam: true, indent: 2 */
983995
/*globals qq */
984996

@@ -1007,6 +1019,8 @@ qq.WindowReceiveMessage = function (o) {
10071019
};
10081020
};
10091021

1022+
1023+
10101024
/*globals qq, document, setTimeout*/
10111025

10121026
/*jslint browser: true, unparam: true, indent: 2 */
@@ -1246,6 +1260,8 @@ qq.UploadHandlerForm = function (o, uploadCompleteCallback, logCallback) {
12461260
return api;
12471261
};
12481262

1263+
1264+
12491265
/*jslint browser: true, unparam: true, indent: 2 */
12501266
/*globals qq, File, XMLHttpRequest, FormData, Blob */
12511267

@@ -1818,6 +1834,8 @@ qq.UploadHandlerXhr = function (o, uploadCompleteCallback, logCallback) {
18181834
return api;
18191835
};
18201836

1837+
1838+
18211839
/*jslint browser: true, unparam: true, indent: 2 */
18221840
/*globals qq */
18231841

@@ -2525,6 +2543,8 @@ qq.FineUploaderBasic.prototype = {
25252543
}
25262544
};
25272545

2546+
2547+
25282548
/*jslint browser: true, unparam: true, indent: 2 */
25292549
/*globals qq, document*/
25302550

@@ -2836,6 +2856,8 @@ qq.UploadDropZone = function (o) {
28362856
};
28372857
};
28382858

2859+
2860+
28392861
/**
28402862
* Class that creates upload widget with drag-and-drop and file list
28412863
* @inherits qq.FineUploaderBasic

0 commit comments

Comments
 (0)