Browse Source

Upgrade to release v2.4.0

Kartik Visweswaran 10 years ago
parent
commit
ed75b24b77
5 changed files with 9 additions and 7 deletions
  1. 1 0
      CHANGE.md
  2. 1 1
      README.md
  3. 1 0
      examples/index.html
  4. 6 6
      js/fileinput.js
  5. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -5,6 +5,7 @@ version 2.4.0
 - (enh #30): Enhanced generic support for more preview formats (audio, video, html, flash, and other objects).
 - (enh #31): Better control and configuration of preview templates.
 - (enh #32): Added checks for file api support
+- (enh #33): Better text format validation and correct modal preview
 
 > **Note:** There are BC Breaking Changes with release v2.4.0.
 

+ 1 - 1
README.md

@@ -111,7 +111,7 @@ Step 1: Load the following assets in your header.
 <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
 <link href="path/to/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
-<script src="path/to/js/fileinput.min.js" type="text/javascript"></script>
+<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js" type="text/javascript"></script>
 ```
 
 If you noticed, you need to load the `jquery.min.js` and `bootstrap.min.css` in addition to the `fileinput.min.css` and `fileinput.min.js`.

+ 1 - 0
examples/index.html

@@ -8,6 +8,7 @@
         <link href="../css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
         <script src="../js/fileinput.js" type="text/javascript"></script>
+        <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js" rel="stylesheet">
     </head>
     <body>
         <div class="container">

+ 6 - 6
js/fileinput.js

@@ -124,16 +124,16 @@
             return (typeof vType !== "undefined") ? vType == 'text/html' : vName.match(/\.(htm|html)$/i);
         },
         text: function(vType, vName) {
-            return (typeof vType !== "undefined") ? vType.match('text.*') : vName.match(/\.(txt|md|csv|nfo|php|ini)$/i);
+            return typeof vType !== "undefined" && vType.match('text.*') || vName.match(/\.(txt|md|csv|nfo|php|ini)$/i);
         },
         video: function (vType, vName) {
-            return (typeof vType !== "undefined" && vType.match(/\.video\/(ogg|mp4|webm)$/i)) || vName.match(/\.(og?|mp4|webm)$/i);
+            return typeof vType !== "undefined" && vType.match(/\.video\/(ogg|mp4|webm)$/i) || vName.match(/\.(og?|mp4|webm)$/i);
         },
         audio: function (vType, vName) {
-            return (typeof vType !== "undefined" && vType.match(/\.audio\/(ogg|mp3|wav)$/i)) || vName.match(/\.(ogg|mp3|wav)$/i);
+            return typeof vType !== "undefined" && vType.match(/\.audio\/(ogg|mp3|wav)$/i) || vName.match(/\.(ogg|mp3|wav)$/i);
         },
         flash: function (vType, vName) {
-            return (typeof vType !== "undefined" && vType == 'application/x-shockwave-flash') || vName.match(/\.(swf)$/i);
+            return typeof vType !== "undefined" && vType == 'application/x-shockwave-flash' || vName.match(/\.(swf)$/i);
         },
         object: function (vType, vName) {
             return true;
@@ -470,7 +470,7 @@
                     var strText = theFile.target.result;
                     vUrl.revokeObjectURL(data);
                     if (strText.length > wrapLen) {
-                        var id = uniqId(), height = window.innerHeight * .75,
+                        var id = 'text-' + uniqId(), height = window.innerHeight * .75,
                             modal = self.getLayoutTemplate('modal').replace(/\{id\}/g, id).replace(/\{title\}/g,
                                 caption).replace(/\{body\}/g, strText).replace(/\{height\}/g, height);
                         wrapInd = wrapInd.replace(/\{title\}/g, caption).replace(/\{dialog\}/g,
@@ -480,7 +480,7 @@
                     content = template
                         .replace(/\{previewId\}/g, previewId).replace(/\{caption\}/g, caption)
                         .replace(/\{type\}/g, file.type).replace(/\{data\}/g, strText)
-                        .replace(/\{width\}/g, config.width).replace(/\{height\}/g, config.height);
+                        .replace(/\{width\}/g, config.width).replace(/\{height\}/g, config.height) + modal;
                 } else {
                     content = template
                         .replace(/\{previewId\}/g, previewId).replace(/\{caption\}/g, caption)

File diff suppressed because it is too large
+ 0 - 0
js/fileinput.min.js


Some files were not shown because too many files changed in this diff