0
* http://www.opensource.org/licenses/mit-license.php
0
+ if($.browser.safari && $('iframe[name=progressFrame]', parent.document).length == 0) {
0
+ iframe = document.createElement('iframe');
0
+ iframe.name = "progressFrame";
0
+ $(iframe).css({width: '0', height: '0', position: 'absolute', top: -3000});
0
+ document.body.appendChild(iframe);
0
+ var d = iframe.contentWindow.document;
0
+ /* weird - safari won't load scripts without this lines... */
0
+ d.write('<html><head></head><body></body></html>');
0
+ var s = d.createElement('script');
0
+ s.src = "../lib/jquery.js";
0
+ /* must be sure that jquery is loaded */
0
+ s.onload = function() {
0
+ var s1 = d.createElement('script');
0
+ s1.src = "../jquery.uploadProgress.js";
0
$.fn.uploadProgress = function(options) {
0
return this.each(function(){
0
$(this).bind('submit', function() {
0
$(this).attr("action", jQuery(this).attr("action") + "?X-Progress-ID=" + uuid);
0
- options.timer = window.setInterval(function() { $.uploadProgress(this, options) }, options.interval);
0
+ var uploadProgress = $.browser.safari ? progressFrame.jQuery.uploadProgress : jQuery.uploadProgress;
0
+ options.timer = window.setInterval(function() { uploadProgress(this, options) }, options.interval);
0
@@ -56,7 +81,9 @@ jQuery.uploadProgress = function(e, options) {
0
percents: Math.floor((upload.received / upload.size)*1000)/10
0
- $(options.progressBar).width(Math.floor(upload.percents) + '%');
0
+ bar = $.browser.safari ? $(options.progressBar, parent.document) : $(options.progressBar);
0
+ bar.width(Math.floor(upload.percents) + '%');
0
options.uploading(upload);
0
/* we are done, stop the interval */
0
@@ -68,4 +95,4 @@ jQuery.uploadProgress = function(e, options) {
0
\ No newline at end of file