Skip to content

Commit 4981f24

Browse files
committed
Cleaning out some unused stuff
1 parent a1779c4 commit 4981f24

File tree

5 files changed

+16
-74
lines changed

5 files changed

+16
-74
lines changed

README

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ A very basic framework around jQueryFileUpload scripts, to host in ASP.Net.
22

33
TODO:
44
=====
5+
- Decouple UI from upload handers & templates a bit more? (less hooks by structure, more by class)
56
- Ability to add placeholders for required dependencies (like the components of a .ism file)
67
- Callbacks for current status (for post-upload processing, like transcodes)
78
- Section divisions by classifications (different targets, like documents, videos etc)
8-
- Look at http://html5doctor.com/native-drag-and-drop/ for IE9 file drop? This one works: http://sandbox.knarly.com/js/dropfiles/
9+
- Look at http://sandbox.knarly.com/js/dropfiles/ for IE9 file drop?

jQueryFileUpload.sln

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 11.00
33
# Visual Studio 2010
44
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jQueryFileUpload", "jQueryFileUpload\jQueryFileUpload.csproj", "{35500359-0CBA-4BFC-BAB6-319D14988AB9}"
55
EndProject
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{20DAA377-C02F-434A-9258-43249F3DF592}"
7+
ProjectSection(SolutionItems) = preProject
8+
README = README
9+
EndProjectSection
10+
EndProject
611
Global
712
GlobalSection(SolutionConfigurationPlatforms) = preSolution
813
Debug|Any CPU = Debug|Any CPU

jQueryFileUpload/Default.aspx

+8-5
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@
1616
<head>
1717
<meta charset="utf-8">
1818
<title>jQuery File Upload Example</title>
19-
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css" id="theme">
20-
<link rel="stylesheet" href="styles/jquery.fileupload-ui.css">
21-
<link rel="stylesheet" href="styles/style.css">
19+
<!--[if lt IE 9]>
20+
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
21+
<![endif]-->
22+
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css" id="theme" />
23+
<link rel="stylesheet" href="styles/jquery.fileupload-ui.css" />
24+
<link rel="stylesheet" href="styles/style.css" />
2225
</head>
2326
<body>
2427
<div id="fileupload">
25-
<form action="FileTransferHandler.ashx" method="POST" enctype="multipart/form-data">
28+
<form action="FileTransferHandler.ashx" method="post" enctype="multipart/form-data">
2629
<div class="fileupload-buttonbar">
2730
<label class="fileinput-button">
2831
<span>Add files...</span>
2932
<input type="file" name="files[]" multiple="multiple" />
3033
</label>
3134
<%-- <button type="submit" class="start">Start upload</button>
3235
<button type="reset" class="cancel">Cancel upload</button> --%>
33-
<button type="button" class="delete">Delete all files</button>
36+
<button type="button" class="delete button">Delete all files</button>
3437
<div class="fileupload-progressbar"></div>
3538
</div>
3639
</form>

jQueryFileUpload/Default.aspx.designer.cs

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jQueryFileUpload/scripts/jquery.fileupload-ui.js

-66
Original file line numberDiff line numberDiff line change
@@ -204,35 +204,6 @@
204204
}
205205
},
206206

207-
// Scales the given image (img HTML element)
208-
// using the given options.
209-
// Returns a canvas object if the canvas option is true
210-
// and the browser supports canvas, else the scaled image:
211-
_scaleImage: function (img, options) {
212-
options = options || {};
213-
var canvas = document.createElement('canvas'),
214-
scale = Math.min(
215-
(options.maxWidth || img.width) / img.width,
216-
(options.maxHeight || img.height) / img.height
217-
);
218-
if (scale >= 1) {
219-
scale = Math.max(
220-
(options.minWidth || img.width) / img.width,
221-
(options.minHeight || img.height) / img.height
222-
);
223-
}
224-
img.width = parseInt(img.width * scale, 10);
225-
img.height = parseInt(img.height * scale, 10);
226-
if (!options.canvas || !canvas.getContext) {
227-
return img;
228-
}
229-
canvas.width = img.width;
230-
canvas.height = img.height;
231-
canvas.getContext('2d')
232-
.drawImage(img, 0, 0, img.width, img.height);
233-
return canvas;
234-
},
235-
236207
_createObjectURL: function (file) {
237208
var undef = 'undefined',
238209
urlAPI = (typeof window.createObjectURL !== undef && window) ||
@@ -264,29 +235,6 @@
264235
return false;
265236
},
266237

267-
// Loads an image for a given File object.
268-
// Invokes the callback with an img or optional canvas
269-
// element (if supported by the browser) as parameter:
270-
_loadImage: function (file, callback, options) {
271-
var that = this,
272-
url,
273-
img;
274-
if (!options || !options.fileTypes ||
275-
options.fileTypes.test(file.type)) {
276-
url = this._createObjectURL(file);
277-
img = $('<img>').bind('load', function () {
278-
$(this).unbind('load');
279-
that._revokeObjectURL(url);
280-
callback(that._scaleImage(img[0], options));
281-
}).prop('src', url);
282-
if (!url) {
283-
this._loadFile(file, function (url) {
284-
img.prop('src', url);
285-
});
286-
}
287-
}
288-
},
289-
290238
// Link handler, that allows to download files
291239
// by drag & drop of the links to the desktop:
292240
_enableDragToDesktop: function () {
@@ -406,20 +354,6 @@
406354
text: false,
407355
icons: {primary: 'ui-icon-cancel'}
408356
});
409-
tmpl.find('.preview').each(function (index, node) {
410-
that._loadImage(
411-
files[index],
412-
function (img) {
413-
$(img).hide().appendTo(node).fadeIn();
414-
},
415-
{
416-
maxWidth: options.previewMaxWidth,
417-
maxHeight: options.previewMaxHeight,
418-
fileTypes: options.previewFileTypes,
419-
canvas: options.previewAsCanvas
420-
}
421-
);
422-
});
423357
return tmpl;
424358
},
425359

0 commit comments

Comments
 (0)