Переглянути джерело

Fix #393: Minor enhancements to abort events before upload

Kartik Visweswaran 9 роки тому
батько
коміт
04f471e42e
3 змінених файлів з 9 додано та 4 видалено
  1. 1 0
      CHANGE.md
  2. 8 4
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -17,6 +17,7 @@ Change Log: `bootstrap-fileinput`
 10. (enh #389): New templates and styling enhancements to caption and main buttons.
 11. (enh #390): Thumbnail error display enhancements.
 12. (enh #391): Thumbnail styling enhancements for flash, html, and object types.
+13. (enh #393): Minor enhancements to abort events before upload.
 
 ## version 4.2.5
 

+ 8 - 4
js/fileinput.js

@@ -430,10 +430,11 @@
             return Math.round(new Date().getTime() + (Math.random() * 100));
         },
         htmlEncode = function (str) {
-            var $el = $(document.createElement('div')).html(str),
-                out = $el.text();
-            $el.remove();
-            return out;
+            return str.replace(/\</g, '&lt;')
+                .replace(/\</g, '&gt;')
+                .replace(/\&/g, '&amp;')
+                .replace(/\"/g, '&quot;')
+                .replace(/\'/g, '&apos;');
         },
         replaceTags = function (str, tags) {
             var out = str;
@@ -699,6 +700,8 @@
                 data = $.extend(self.getOutData(), params);
                 data.abortData = self.ajaxAborted.data || {};
                 data.abortMessage = self.ajaxAborted.message;
+                self.cancel();
+                self.setProgress(100);
                 self.showUploadError(self.ajaxAborted.message, data, 'filecustomerror');
                 return true;
             }
@@ -1501,6 +1504,7 @@
                 self.raise('filebatchpreupload', [outData]);
                 if (self.abort(outData)) {
                     jqXHR.abort();
+                    self.setProgress(100);
                 }
             };
             fnSuccess = function (data, textStatus, jqXHR) {

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
js/fileinput.min.js


Деякі файли не було показано, через те що забагато файлів було змінено