Parcourir la source

Fix #392: Enhancements to allow using plugin functions directly

Kartik Visweswaran il y a 9 ans
Parent
commit
89af96d5e5
3 fichiers modifiés avec 19 ajouts et 11 suppressions
  1. 8 7
      CHANGE.md
  2. 11 4
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 8 - 7
CHANGE.md

@@ -18,13 +18,14 @@ Change Log: `bootstrap-fileinput`
 11. (enh #389): New templates and styling enhancements to caption and main buttons.
 12. (enh #390): Thumbnail error display enhancements.
 13. (enh #391): Thumbnail styling enhancements for flash, html, and object types.
-14. (enh #393): Minor enhancements to abort events before upload.
-15. (bug #398): Validate `data.errorkeys` more correctly.
-16. (enh #401): Various enhancements to preview file thumbnails and error validations.
-17. (enh #405): Create traditional Chinese translations.
-18. (enh #410): Better validation for IE 10 and below.
-19. (enh #412): Enhancements to file upload cancellation.
-20. (enh #413): Various updates to translations.
+14. (enh #392): Enhancements to allow using plugin functions directly.
+15. (enh #393): Minor enhancements to abort events before upload.
+16. (bug #398): Validate `data.errorkeys` more correctly.
+17. (enh #401): Various enhancements to preview file thumbnails and error validations.
+18. (enh #405): Create traditional Chinese translations.
+19. (enh #410): Better validation for IE 10 and below.
+20. (enh #412): Enhancements to file upload cancellation.
+21. (enh #413): Various updates to translations.
 
 ## version 4.2.5
 

+ 11 - 4
js/fileinput.js

@@ -2238,10 +2238,9 @@
         if (!hasFileAPISupport() && !isIE(9)) {
             return;
         }
-
-        var args = Array.apply(null, arguments);
+        var args = Array.apply(null, arguments), retvals = [];
         args.shift();
-        return this.each(function () {
+        this.each(function () {
             var $this = $(this), data = $this.data('fileinput'), defaults,
                 options = typeof option === 'object' && option,
                 lang = options.language || $this.data('language') || 'en';
@@ -2256,9 +2255,17 @@
             }
 
             if (typeof option === 'string') {
-                data[option].apply(data, args);
+                retvals.push(data[option].apply(data, args));
             }
         });
+        switch (retvals.length) {
+            case 0:
+                return this;
+            case 1:
+                return retvals[0];
+            default:
+                return retvals;
+        }
     };
 
     $.fn.fileinput.defaults = {

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
js/fileinput.min.js


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff