ソースを参照

Upgrade to release v2.4.0 - Fix template fetch bug

Kartik Visweswaran 10 年 前
コミット
9e14751ac7
2 ファイル変更21 行追加2 行削除
  1. 21 2
      js/fileinput.js
  2. 0 0
      js/fileinput.min.js

+ 21 - 2
js/fileinput.js

@@ -23,6 +23,7 @@
         '      <param name="autoPlay" value="false" />\n' +
         '      <param name="autoPlay" value="false" />\n' +
         '      <param name="autoStart" value="false" />\n'+
         '      <param name="autoStart" value="false" />\n'+
         '      <param name="quality" value="high" />\n';
         '      <param name="quality" value="high" />\n';
+
     var DEFAULT_PREVIEW = '<div class="file-preview-other" ' + STYLE_SETTING + '>\n' +
     var DEFAULT_PREVIEW = '<div class="file-preview-other" ' + STYLE_SETTING + '>\n' +
         '       <h2><i class="glyphicon glyphicon-file"></i></h2>\n' +
         '       <h2><i class="glyphicon glyphicon-file"></i></h2>\n' +
         '   </div>';
         '   </div>';
@@ -149,7 +150,7 @@
             return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]';
             return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]';
         },
         },
         isSet = function (needle, haystack) {
         isSet = function (needle, haystack) {
-            return (typeof haystack == 'object' && typeof haystack[needle] !== 'undefined');
+            return (typeof haystack == 'object' && needle in haystack);
         },
         },
         getValue = function (options, param, value) {
         getValue = function (options, param, value) {
             return (isEmpty(options) || isEmpty(options[param])) ? value : options[param];
             return (isEmpty(options) || isEmpty(options[param])) ? value : options[param];
@@ -254,9 +255,11 @@
             self.$element.removeClass('file-loading');
             self.$element.removeClass('file-loading');
         },
         },
         getLayoutTemplate: function(t) {
         getLayoutTemplate: function(t) {
+            var self = this;
             return isSet(t, self.layoutTemplates) ? self.layoutTemplates[t] : defaultLayoutTemplates[t];
             return isSet(t, self.layoutTemplates) ? self.layoutTemplates[t] : defaultLayoutTemplates[t];
         },
         },
         getPreviewTemplate: function(t) {
         getPreviewTemplate: function(t) {
+            var self = this;
             return isSet(t, self.previewTemplates) ? self.previewTemplates[t] : defaultPreviewTemplates[t];
             return isSet(t, self.previewTemplates) ? self.previewTemplates[t] : defaultPreviewTemplates[t];
         },
         },
         listen: function () {
         listen: function () {
@@ -672,6 +675,22 @@
         }
         }
     }
     }
 
 
+    $.fn.fileinput = function (options) {
+        if (!hasFileAPISupport()) {
+          return;
+        }
+        
+        return this.each(function () {
+            var $this = $(this), data = $this.data('fileinput')
+            if (!data) {
+                $this.data('fileinput', (data = new FileInput(this, options)))
+            }
+            if (typeof options == 'string') {
+                data[options]()
+            }
+        })
+    };
+
     //FileInput plugin definition
     //FileInput plugin definition
     $.fn.fileinput = function (option) {
     $.fn.fileinput = function (option) {
         if (!hasFileAPISupport()) {
         if (!hasFileAPISupport()) {
@@ -761,4 +780,4 @@
         }
         }
     });
     });
 
 
-})(window.jQuery);
+})(window.jQuery);

ファイルの差分が大きいため隠しています
+ 0 - 0
js/fileinput.min.js


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません