1var progress_array_global = new Array(); 2var count_uploads = 0; 3var cur_uploads = 0; 4var progress_global; 5var upload_data = new Object(); 6 7 8jQuery(document).ready(function($){ 9 10 $(document).bind('drop dragover', function (e) { 11 e.preventDefault(); 12 }); 13 14 $(document).bind('dragover', function (e) { 15 var dropZone = $('.js-dropzone'), 16 timeout = window.dropZoneTimeout; 17 if (!timeout) { 18 dropZone.addClass('in'); 19 } else { 20 clearTimeout(timeout); 21 } 22 var found = false, 23 node = e.target; 24 do { 25 if (node === dropZone[0]) { 26 found = true; 27 break; 28 } 29 node = node.parentNode; 30 } while (node != null); 31 if (found) { 32 dropZone.addClass('hover'); 33 } else { 34 dropZone.removeClass('hover'); 35 } 36 window.dropZoneTimeout = setTimeout(function () { 37 window.dropZoneTimeout = null; 38 dropZone.removeClass('in hover'); 39 }, 100); 40 }); 41 42 InitFileupload(); 43 44 $('body').on('click', '.js-upload-btn', function(){ 45 OpenFancyBox($(this), 'upload'); 46 }); 47 48}); 49 50 51function InitFileupload() { 52 jQuery('.js-upload').each(function(){ 53 var element = jQuery(this); 54 var temp_url = window.URL || window.webkitURL; 55 56 if (true) { 57 jQuery(this).fileupload({ 58 url: '/fme_checkout/includes/upload.php?main', 59 dataType: 'json', 60 dropZone: jQuery('.js-dropzone'), 61 autoUpload: true, 62 singleFileUploads: true, 63 sequentialUploads: true, 64 acceptFileTypes: /(\.|\/)(jpe?g)$/i, 65 disableImageResize: false, 66 disableExif: true, 67 disableImageMetaDataSave: true, 68 disableImageMetaDataLoad: true, 69 disableImagePreview: true, 70 loadImageMaxFileSize: 1000000000, 71 imageMaxWidth: 6000, 72 imageMaxHeight: 6000 73 }).on('fileuploadadd', function (e, data) { 74 upload_data['object'] = null; 75 if (jQuery(e.target).attr('data-upload-type') == 3) { // 3 = contact 76 SetContactUploadProgress(0); 77 //data.url = '/global/functions/upload.php?contact'; 78 data.url = '/global/functions/upload-contact.php', 79 jQuery('.contact-upload .loading').addClass('progressing'); 80 jQuery('.contact-upload p').text(data.files[0].name); 81 upload_data['object'] = data.submit(); 82 } 83 }).on('fileuploadprocessfail', function (e, data) { 84 var error = data.files[0]['error']; 85 if (error == 'File type not allowed') { 86 OpenFancyBox('<p>'+data.files[0]['name']+':</p><p>'+translate['error_accept_file_types']+'</p>', 'error'); 87 progress_array = new Array(); 88 SetUploadProgress(0); 89 } 90 }).on('fileuploadstart', function () { 91 progress_array = new Array(); 92 SetUploadProgress(0); 93 jQuery('.upload-step-1').hide(); 94 jQuery('.upload-step-2').show(); 95 }).on('fileuploadprogress', function (e, data) { 96 var progress = parseInt(data.loaded / (data.total * 1.05) * 100, 10); 97 if (progress > getMaxOfArray(progress_array)) { 98 if (jQuery(e.target).attr('data-upload-type') == 3) { 99 progress_array.push(progress); 100 SetContactUploadProgress(progress); 101 } else { 102 progress_array.push(progress); 103 SetUploadProgress(progress) 104 } 105 } 106 }).on('fileuploaddone', function (e, data) { 107 var error = data.result.files[0]['error']; 108 if (jQuery(e.target).attr('data-upload-type') == 3) { 109 jQuery('.contact-upload .loading, .contact-upload input').remove(); 110 //jQuery('.contact-upload .loading').removeClass('progressing'); 111 jQuery('.contact-upload').attr('data-filename', data.result.files[0].name);
112 jQuery('form[name="contact"]').prepend('<input type="hidden" name="file" value="'+data.result.files[0].name+'" />'); 113 jQuery('.help-widget-form input[name="file"]').val(data.result.files[0].name); // temp for new form 114 jQuery('.contact-upload p').text(translate['contact_upload_finished']); 115 } else { 116 if (typeof data.result.files[0]['error'] !== 'undefined') { 117 OpenFancyBox('<p>'+data.files[0]['name']+':</p><p>'+translate['error_'+error]+'</p>', 'error'); 118 jQuery('.upload-step-1').show(); 119 jQuery('.upload-step-2').hide(); 120 } else { 121 SetUploadProgress(100); 122 ToggleAreaLoading('fixed', 1); 123 Redirect(translate['order_url']) 124 } 125 } 126 }); 127 } else { 128 jQuery(this).fileupload({ 129 url: '/fme_checkout/includes/upload.php?main', 130 dataType: 'json', 131 dropZone: jQuery('.js-dropzone'), 132 autoUpload: true, 133 singleFileUploads: true, 134 sequentialUploads: true, 135 acceptFileTypes: /(\.|\/)(jpe?g)$/i, 136 disableExif: true, 137 disableImageMetaDataSave: true, 138 disableImageMetaDataLoad: true, 139 disableImagePreview: true, 140 loadImageMaxFileSize: 1000000000, 141 }).on('fileuploadadd', function (e, data) { 142 // file add 143 }).on('fileuploadprocessfail', function (e, data) { 144 var error = data.files[0]['error']; 145 if (error == 'File type not allowed') { 146 OpenFancyBox('<p>'+data.files[0]['name']+':</p><p>'+translate['error_accept_file_types']+'</p>', 'error'); 147 progress_array = new Array(); 148 SetUploadProgress(0); 149 } 150 }).on('fileuploadstart', function () { 151 progress_array = new Array(); 152 SetUploadProgress(0); 153 jQuery('.upload-step-1').hide(); 154 jQuery('.upload-step-2').show(); 155 }).on('fileuploadprogress', function (e, data) { 156 var progress = parseInt(data.loaded / (data.total * 1.05) * 100, 10); 157 if (progress > getMaxOfArray(progress_array)) { 158 progress_array.push(progress); 159 SetUploadProgress(progress) 160 } 161 }).on('fileuploaddone', function (e, data) { 162 var error = data.result.files[0]['error']; 163 if (typeof data.result.files[0]['error'] !== 'undefined') { 164 OpenFancyBox('<p>'+data.files[0]['name']+':</p><p>'+translate['error_'+error]+'</p>', 'error'); 165 jQuery('.upload-step-1').show(); 166 jQuery('.upload-step-2').hide(); 167 } else { 168 SetUploadProgress(100); 169 ToggleAreaLoading('fixed', 1); 170 Redirect(translate['order_url']) 171 } 172 }); 173 } 174 175 }); 176} 177 178 179function SetUploadProgress(progress) { 180 var output = progress+'%'; 181 var percent = progress; 182 183 jQuery('.upload-progress > div').css( 184 'width', 185 percent + '%' 186 ); 187 jQuery('.upload-progress div span').text(output); 188} 189 190 191function SetContactUploadProgress(progress) { 192 jQuery('.contact-upload .loading').css( 193 'width', 194 progress + '%' 195 ); 196}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.