ample_assets 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,313 @@
1
+ /*
2
+ * Facebox (for jQuery)
3
+ * version: 1.3
4
+ * @requires jQuery v1.2 or later
5
+ * @homepage https://github.com/defunkt/facebox
6
+ *
7
+ * Licensed under the MIT:
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * Copyright Forever Chris Wanstrath, Kyle Neath
11
+ *
12
+ * Usage:
13
+ *
14
+ * jQuery(document).ready(function() {
15
+ * jQuery('a[rel*=facebox]').facebox()
16
+ * })
17
+ *
18
+ * <a href="#terms" rel="facebox">Terms</a>
19
+ * Loads the #terms div in the box
20
+ *
21
+ * <a href="terms.html" rel="facebox">Terms</a>
22
+ * Loads the terms.html page in the box
23
+ *
24
+ * <a href="terms.png" rel="facebox">Terms</a>
25
+ * Loads the terms.png image in the box
26
+ *
27
+ *
28
+ * You can also use it programmatically:
29
+ *
30
+ * jQuery.facebox('some html')
31
+ * jQuery.facebox('some html', 'my-groovy-style')
32
+ *
33
+ * The above will open a facebox with "some html" as the content.
34
+ *
35
+ * jQuery.facebox(function($) {
36
+ * $.get('blah.html', function(data) { $.facebox(data) })
37
+ * })
38
+ *
39
+ * The above will show a loading screen before the passed function is called,
40
+ * allowing for a better ajaxy experience.
41
+ *
42
+ * The facebox function can also display an ajax page, an image, or the contents of a div:
43
+ *
44
+ * jQuery.facebox({ ajax: 'remote.html' })
45
+ * jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')
46
+ * jQuery.facebox({ image: 'stairs.jpg' })
47
+ * jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')
48
+ * jQuery.facebox({ div: '#box' })
49
+ * jQuery.facebox({ div: '#box' }, 'my-groovy-style')
50
+ *
51
+ * Want to close the facebox? Trigger the 'close.facebox' document event:
52
+ *
53
+ * jQuery(document).trigger('close.facebox')
54
+ *
55
+ * Facebox also has a bunch of other hooks:
56
+ *
57
+ * loading.facebox
58
+ * beforeReveal.facebox
59
+ * reveal.facebox (aliased as 'afterReveal.facebox')
60
+ * init.facebox
61
+ * afterClose.facebox
62
+ *
63
+ * Simply bind a function to any of these hooks:
64
+ *
65
+ * $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
66
+ *
67
+ */
68
+ (function($) {
69
+ $.facebox = function(data, klass) {
70
+ $.facebox.loading(data.settings || [])
71
+
72
+ if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)
73
+ else if (data.image) fillFaceboxFromImage(data.image, klass)
74
+ else if (data.div) fillFaceboxFromHref(data.div, klass)
75
+ else if ($.isFunction(data)) data.call($)
76
+ else $.facebox.reveal(data, klass)
77
+ }
78
+
79
+ /*
80
+ * Public, $.facebox methods
81
+ */
82
+
83
+ $.extend($.facebox, {
84
+ settings: {
85
+ opacity : 0.2,
86
+ overlay : true,
87
+ loadingImage : '/assets/ample_assets/loading.gif',
88
+ closeImage : '/assets/ample_assets/closelabel.png',
89
+ imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
90
+ faceboxHtml : '\
91
+ <div id="facebox" style="display:none;"> \
92
+ <div class="popup"> \
93
+ <div class="content"> \
94
+ </div> \
95
+ <a href="#" class="close"></a> \
96
+ </div> \
97
+ </div>'
98
+ },
99
+
100
+ loading: function() {
101
+ init()
102
+ if ($('#facebox .loading').length == 1) return true
103
+ showOverlay()
104
+
105
+ $('#facebox .content').empty().
106
+ append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')
107
+
108
+ $('#facebox').show().css({
109
+ top: getPageScroll()[1] + (getPageHeight() / 10),
110
+ left: $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2)
111
+ })
112
+
113
+ $(document).bind('keydown.facebox', function(e) {
114
+ if (e.keyCode == 27) $.facebox.close()
115
+ return true
116
+ })
117
+ $(document).trigger('loading.facebox')
118
+ },
119
+
120
+ reveal: function(data, klass) {
121
+ $(document).trigger('beforeReveal.facebox')
122
+ if (klass) $('#facebox .content').addClass(klass)
123
+ $('#facebox .content').empty().append(data)
124
+ $('#facebox .popup').children().fadeIn('normal')
125
+ $('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2))
126
+ $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
127
+ },
128
+
129
+ close: function() {
130
+ $(document).trigger('close.facebox')
131
+ return false
132
+ }
133
+ })
134
+
135
+ /*
136
+ * Public, $.fn methods
137
+ */
138
+
139
+ $.fn.facebox = function(settings) {
140
+ if ($(this).length == 0) return
141
+
142
+ init(settings)
143
+
144
+ function clickHandler() {
145
+ $.facebox.loading(true)
146
+
147
+ // support for rel="facebox.inline_popup" syntax, to add a class
148
+ // also supports deprecated "facebox[.inline_popup]" syntax
149
+ var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
150
+ if (klass) klass = klass[1]
151
+
152
+ fillFaceboxFromHref(this.href, klass)
153
+ return false
154
+ }
155
+
156
+ return this.bind('click.facebox', clickHandler)
157
+ }
158
+
159
+ /*
160
+ * Private methods
161
+ */
162
+
163
+ // called one time to setup facebox on this page
164
+ function init(settings) {
165
+ if ($.facebox.settings.inited) return true
166
+ else $.facebox.settings.inited = true
167
+
168
+ $(document).trigger('init.facebox')
169
+ makeCompatible()
170
+
171
+ var imageTypes = $.facebox.settings.imageTypes.join('|')
172
+ $.facebox.settings.imageTypesRegexp = new RegExp('\\.(' + imageTypes + ')(\\?.*)?$', 'i')
173
+
174
+ if (settings) $.extend($.facebox.settings, settings)
175
+ $('body').append($.facebox.settings.faceboxHtml)
176
+
177
+ var preload = [ new Image(), new Image() ]
178
+ preload[0].src = $.facebox.settings.closeImage
179
+ preload[1].src = $.facebox.settings.loadingImage
180
+
181
+ $('#facebox').find('.b:first, .bl').each(function() {
182
+ preload.push(new Image())
183
+ preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
184
+ })
185
+
186
+ $('#facebox .close')
187
+ .click($.facebox.close)
188
+ .append('<img src="'
189
+ + $.facebox.settings.closeImage
190
+ + '" class="close_image" title="close">')
191
+ }
192
+
193
+ // getPageScroll() by quirksmode.com
194
+ function getPageScroll() {
195
+ var xScroll, yScroll;
196
+ if (self.pageYOffset) {
197
+ yScroll = self.pageYOffset;
198
+ xScroll = self.pageXOffset;
199
+ } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
200
+ yScroll = document.documentElement.scrollTop;
201
+ xScroll = document.documentElement.scrollLeft;
202
+ } else if (document.body) {// all other Explorers
203
+ yScroll = document.body.scrollTop;
204
+ xScroll = document.body.scrollLeft;
205
+ }
206
+ return new Array(xScroll,yScroll)
207
+ }
208
+
209
+ // Adapted from getPageSize() by quirksmode.com
210
+ function getPageHeight() {
211
+ var windowHeight
212
+ if (self.innerHeight) { // all except Explorer
213
+ windowHeight = self.innerHeight;
214
+ } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
215
+ windowHeight = document.documentElement.clientHeight;
216
+ } else if (document.body) { // other Explorers
217
+ windowHeight = document.body.clientHeight;
218
+ }
219
+ return windowHeight
220
+ }
221
+
222
+ // Backwards compatibility
223
+ function makeCompatible() {
224
+ var $s = $.facebox.settings
225
+
226
+ $s.loadingImage = $s.loading_image || $s.loadingImage
227
+ $s.closeImage = $s.close_image || $s.closeImage
228
+ $s.imageTypes = $s.image_types || $s.imageTypes
229
+ $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
230
+ }
231
+
232
+ // Figures out what you want to display and displays it
233
+ // formats are:
234
+ // div: #id
235
+ // image: blah.extension
236
+ // ajax: anything else
237
+ function fillFaceboxFromHref(href, klass) {
238
+ // div
239
+ if (href.match(/#/)) {
240
+ var url = window.location.href.split('#')[0]
241
+ var target = href.replace(url,'')
242
+ if (target == '#') return
243
+ $.facebox.reveal($(target).html(), klass)
244
+
245
+ // image
246
+ } else if (href.match($.facebox.settings.imageTypesRegexp)) {
247
+ fillFaceboxFromImage(href, klass)
248
+ // ajax
249
+ } else {
250
+ fillFaceboxFromAjax(href, klass)
251
+ }
252
+ }
253
+
254
+ function fillFaceboxFromImage(href, klass) {
255
+ var image = new Image()
256
+ image.onload = function() {
257
+ $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
258
+ }
259
+ image.src = href
260
+ }
261
+
262
+ function fillFaceboxFromAjax(href, klass) {
263
+ $.facebox.jqxhr = $.get(href, function(data) { $.facebox.reveal(data, klass) })
264
+ }
265
+
266
+ function skipOverlay() {
267
+ return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null
268
+ }
269
+
270
+ function showOverlay() {
271
+ if (skipOverlay()) return
272
+
273
+ if ($('#facebox_overlay').length == 0)
274
+ $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')
275
+
276
+ $('#facebox_overlay').hide().addClass("facebox_overlayBG")
277
+ .css('opacity', $.facebox.settings.opacity)
278
+ .click(function() { $(document).trigger('close.facebox') })
279
+ .fadeIn(200)
280
+ return false
281
+ }
282
+
283
+ function hideOverlay() {
284
+ if (skipOverlay()) return
285
+
286
+ $('#facebox_overlay').fadeOut(200, function(){
287
+ $("#facebox_overlay").removeClass("facebox_overlayBG")
288
+ $("#facebox_overlay").addClass("facebox_hide")
289
+ $("#facebox_overlay").remove()
290
+ })
291
+
292
+ return false
293
+ }
294
+
295
+ /*
296
+ * Bindings
297
+ */
298
+
299
+ $(document).bind('close.facebox', function() {
300
+ if ($.facebox.jqxhr) {
301
+ $.facebox.jqxhr.abort()
302
+ $.facebox.jqxhr = null
303
+ }
304
+ $(document).unbind('keydown.facebox')
305
+ $('#facebox').fadeOut(function() {
306
+ $('#facebox .content').removeClass().addClass('content')
307
+ $('#facebox .loading').remove()
308
+ $(document).trigger('afterClose.facebox')
309
+ })
310
+ hideOverlay()
311
+ })
312
+
313
+ })(jQuery);
@@ -0,0 +1,296 @@
1
+ /*
2
+ Uploadify v2.1.4
3
+ Release Date: November 8, 2010
4
+
5
+ Copyright (c) 2010 Ronnie Garcia, Travis Nickels
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ if(jQuery)(
27
+ function(jQuery){
28
+ jQuery.extend(jQuery.fn,{
29
+ uploadify:function(options) {
30
+ jQuery(this).each(function(){
31
+ var settings = jQuery.extend({
32
+ id : jQuery(this).attr('id'), // The ID of the object being Uploadified
33
+ uploader : 'uploadify.swf', // The path to the uploadify swf file
34
+ script : 'uploadify.php', // The path to the uploadify backend upload script
35
+ expressInstall : null, // The path to the express install swf file
36
+ folder : '', // The path to the upload folder
37
+ height : 30, // The height of the flash button
38
+ width : 120, // The width of the flash button
39
+ cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container
40
+ wmode : 'opaque', // The wmode of the flash file
41
+ scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains
42
+ fileDataName : 'Filedata', // The name of the file collection object in the backend upload script
43
+ method : 'POST', // The method for sending variables to the backend upload script
44
+ queueSizeLimit : 999, // The maximum size of the file queue
45
+ simUploadLimit : 1, // The number of simultaneous uploads allowed
46
+ queueID : false, // The optional ID of the queue container
47
+ displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item
48
+ removeCompleted : true, // Set to true if you want the queue items to be removed when a file is done uploading
49
+ onInit : function() {}, // Function to run when uploadify is initialized
50
+ onSelect : function() {}, // Function to run when a file is selected
51
+ onSelectOnce : function() {}, // Function to run once when files are added to the queue
52
+ onQueueFull : function() {}, // Function to run when the queue reaches capacity
53
+ onCheck : function() {}, // Function to run when script checks for duplicate files on the server
54
+ onCancel : function() {}, // Function to run when an item is cleared from the queue
55
+ onClearQueue : function() {}, // Function to run when the queue is manually cleared
56
+ onError : function() {}, // Function to run when an upload item returns an error
57
+ onProgress : function() {}, // Function to run each time the upload progress is updated
58
+ onComplete : function() {}, // Function to run when an upload is completed
59
+ onAllComplete : function() {} // Function to run when all uploads are completed
60
+ }, options);
61
+ jQuery(this).data('settings',settings);
62
+ var pagePath = location.pathname;
63
+ pagePath = pagePath.split('/');
64
+ pagePath.pop();
65
+ pagePath = pagePath.join('/') + '/';
66
+ var data = {};
67
+ data.uploadifyID = settings.id;
68
+ data.pagepath = pagePath;
69
+ if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg);
70
+ if (settings.buttonText) data.buttonText = escape(settings.buttonText);
71
+ if (settings.rollover) data.rollover = true;
72
+ data.script = settings.script;
73
+ data.folder = escape(settings.folder);
74
+ if (settings.scriptData) {
75
+ var scriptDataString = '';
76
+ for (var name in settings.scriptData) {
77
+ scriptDataString += '&' + name + '=' + settings.scriptData[name];
78
+ }
79
+ data.scriptData = escape(scriptDataString.substr(1));
80
+ }
81
+ data.width = settings.width;
82
+ data.height = settings.height;
83
+ data.wmode = settings.wmode;
84
+ data.method = settings.method;
85
+ data.queueSizeLimit = settings.queueSizeLimit;
86
+ data.simUploadLimit = settings.simUploadLimit;
87
+ if (settings.hideButton) data.hideButton = true;
88
+ if (settings.fileDesc) data.fileDesc = settings.fileDesc;
89
+ if (settings.fileExt) data.fileExt = settings.fileExt;
90
+ if (settings.multi) data.multi = true;
91
+ if (settings.auto) data.auto = true;
92
+ if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit;
93
+ if (settings.checkScript) data.checkScript = settings.checkScript;
94
+ if (settings.fileDataName) data.fileDataName = settings.fileDataName;
95
+ if (settings.queueID) data.queueID = settings.queueID;
96
+ if (settings.onInit() !== false) {
97
+ jQuery(this).css('display','none');
98
+ jQuery(this).after('<div id="' + jQuery(this).attr('id') + 'Uploader"></div>');
99
+ swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess},{},function(event) {
100
+ if (typeof(settings.onSWFReady) == 'function' && event.success) settings.onSWFReady();
101
+ });
102
+ if (settings.queueID == false) {
103
+ jQuery("#" + jQuery(this).attr('id') + "Uploader").after('<div id="' + jQuery(this).attr('id') + 'Queue" class="uploadifyQueue"></div>');
104
+ } else {
105
+ jQuery("#" + settings.queueID).addClass('uploadifyQueue');
106
+ }
107
+ }
108
+ if (typeof(settings.onOpen) == 'function') {
109
+ jQuery(this).bind("uploadifyOpen", settings.onOpen);
110
+ }
111
+ jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) {
112
+ if (event.data.action(event, ID, fileObj) !== false) {
113
+ var byteSize = Math.round(fileObj.size / 1024 * 100) * .01;
114
+ var suffix = 'KB';
115
+ if (byteSize > 1000) {
116
+ byteSize = Math.round(byteSize *.001 * 100) * .01;
117
+ suffix = 'MB';
118
+ }
119
+ var sizeParts = byteSize.toString().split('.');
120
+ if (sizeParts.length > 1) {
121
+ byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2);
122
+ } else {
123
+ byteSize = sizeParts[0];
124
+ }
125
+ if (fileObj.name.length > 20) {
126
+ fileName = fileObj.name.substr(0,20) + '...';
127
+ } else {
128
+ fileName = fileObj.name;
129
+ }
130
+ queue = '#' + jQuery(this).attr('id') + 'Queue';
131
+ if (event.data.queueID) {
132
+ queue = '#' + event.data.queueID;
133
+ }
134
+ jQuery(queue).append('<div id="' + jQuery(this).attr('id') + ID + '" class="uploadifyQueueItem">\
135
+ <div class="cancel">\
136
+ <a href="javascript:jQuery(\'#' + jQuery(this).attr('id') + '\').uploadifyCancel(\'' + ID + '\')"><img src="' + settings.cancelImg + '" border="0" /></a>\
137
+ </div>\
138
+ <span class="fileName">' + fileName + ' (' + byteSize + suffix + ')</span><span class="percentage"></span>\
139
+ <div class="uploadifyProgress">\
140
+ <div id="' + jQuery(this).attr('id') + ID + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\
141
+ </div>\
142
+ </div>');
143
+ }
144
+ });
145
+ jQuery(this).bind("uploadifySelectOnce", {'action': settings.onSelectOnce}, function(event, data) {
146
+ event.data.action(event, data);
147
+ if (settings.auto) {
148
+ if (settings.checkScript) {
149
+ jQuery(this).uploadifyUpload(null, false);
150
+ } else {
151
+ jQuery(this).uploadifyUpload(null, true);
152
+ }
153
+ }
154
+ });
155
+ jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) {
156
+ if (event.data.action(event, queueSizeLimit) !== false) {
157
+ alert('The queue is full. The max size is ' + queueSizeLimit + '.');
158
+ }
159
+ });
160
+ jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) {
161
+ var postData = new Object();
162
+ postData = fileQueueObj;
163
+ postData.folder = (folder.substr(0,1) == '/') ? folder : pagePath + folder;
164
+ if (single) {
165
+ for (var ID in fileQueueObj) {
166
+ var singleFileID = ID;
167
+ }
168
+ }
169
+ jQuery.post(checkScript, postData, function(data) {
170
+ for(var key in data) {
171
+ if (event.data.action(event, data, key) !== false) {
172
+ var replaceFile = confirm("Do you want to replace the file " + data[key] + "?");
173
+ if (!replaceFile) {
174
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key,true,true);
175
+ }
176
+ }
177
+ }
178
+ if (single) {
179
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true);
180
+ } else {
181
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true);
182
+ }
183
+ }, "json");
184
+ });
185
+ jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, remove, clearFast) {
186
+ if (event.data.action(event, ID, fileObj, data, clearFast) !== false) {
187
+ if (remove) {
188
+ var fadeSpeed = (clearFast == true) ? 0 : 250;
189
+ jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() });
190
+ }
191
+ }
192
+ });
193
+ jQuery(this).bind("uploadifyClearQueue", {'action': settings.onClearQueue}, function(event, clearFast) {
194
+ var queueID = (settings.queueID) ? settings.queueID : jQuery(this).attr('id') + 'Queue';
195
+ if (clearFast) {
196
+ jQuery("#" + queueID).find('.uploadifyQueueItem').remove();
197
+ }
198
+ if (event.data.action(event, clearFast) !== false) {
199
+ jQuery("#" + queueID).find('.uploadifyQueueItem').each(function() {
200
+ var index = jQuery('.uploadifyQueueItem').index(this);
201
+ jQuery(this).delay(index * 100).fadeOut(250, function() { jQuery(this).remove() });
202
+ });
203
+ }
204
+ });
205
+ var errorArray = [];
206
+ jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) {
207
+ if (event.data.action(event, ID, fileObj, errorObj) !== false) {
208
+ var fileArray = new Array(ID, fileObj, errorObj);
209
+ errorArray.push(fileArray);
210
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(" - " + errorObj.type + " Error");
211
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.uploadifyProgress').hide();
212
+ jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError');
213
+ }
214
+ });
215
+ if (typeof(settings.onUpload) == 'function') {
216
+ jQuery(this).bind("uploadifyUpload", settings.onUpload);
217
+ }
218
+ jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) {
219
+ if (event.data.action(event, ID, fileObj, data) !== false) {
220
+ jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").animate({'width': data.percentage + '%'},250,function() {
221
+ if (data.percentage == 100) {
222
+ jQuery(this).closest('.uploadifyProgress').fadeOut(250,function() {jQuery(this).remove()});
223
+ }
224
+ });
225
+ if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';
226
+ if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';
227
+ if (event.data.toDisplay == null) displayData = ' ';
228
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(displayData);
229
+ }
230
+ });
231
+ jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) {
232
+ if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {
233
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(' - Completed');
234
+ if (settings.removeCompleted) {
235
+ jQuery("#" + jQuery(event.target).attr('id') + ID).fadeOut(250,function() {jQuery(this).remove()});
236
+ }
237
+ jQuery("#" + jQuery(event.target).attr('id') + ID).addClass('completed');
238
+ }
239
+ });
240
+ if (typeof(settings.onAllComplete) == 'function') {
241
+ jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, data) {
242
+ if (event.data.action(event, data) !== false) {
243
+ errorArray = [];
244
+ }
245
+ });
246
+ }
247
+ });
248
+ },
249
+ uploadifySettings:function(settingName, settingValue, resetObject) {
250
+ var returnValue = false;
251
+ jQuery(this).each(function() {
252
+ if (settingName == 'scriptData' && settingValue != null) {
253
+ if (resetObject) {
254
+ var scriptData = settingValue;
255
+ } else {
256
+ var scriptData = jQuery.extend(jQuery(this).data('settings').scriptData, settingValue);
257
+ }
258
+ var scriptDataString = '';
259
+ for (var name in scriptData) {
260
+ scriptDataString += '&' + name + '=' + scriptData[name];
261
+ }
262
+ settingValue = escape(scriptDataString.substr(1));
263
+ }
264
+ returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);
265
+ });
266
+ if (settingValue == null) {
267
+ if (settingName == 'scriptData') {
268
+ var returnSplit = unescape(returnValue).split('&');
269
+ var returnObj = new Object();
270
+ for (var i = 0; i < returnSplit.length; i++) {
271
+ var iSplit = returnSplit[i].split('=');
272
+ returnObj[iSplit[0]] = iSplit[1];
273
+ }
274
+ returnValue = returnObj;
275
+ }
276
+ }
277
+ return returnValue;
278
+ },
279
+ uploadifyUpload:function(ID,checkComplete) {
280
+ jQuery(this).each(function() {
281
+ if (!checkComplete) checkComplete = false;
282
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, checkComplete);
283
+ });
284
+ },
285
+ uploadifyCancel:function(ID) {
286
+ jQuery(this).each(function() {
287
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, true, false);
288
+ });
289
+ },
290
+ uploadifyClearQueue:function() {
291
+ jQuery(this).each(function() {
292
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false);
293
+ });
294
+ }
295
+ })
296
+ })(jQuery);