server/php/basic/public_html/static/lib/FileSaver/FileSaver.js
changeset 472 6dcff4438175
parent 461 48235ed6b07d
child 488 1324bd8747ff
equal deleted inserted replaced
471:e0c7be5dc02c 472:6dcff4438175
     1 /* FileSaver.js
     1 /* FileSaver.js
     2  * A saveAs() FileSaver implementation.
     2  * A saveAs() FileSaver implementation.
     3  * 2014-12-17
     3  * 2015-03-04
     4  *
     4  *
     5  * By Eli Grey, http://eligrey.com
     5  * By Eli Grey, http://eligrey.com
     6  * License: X11/MIT
     6  * License: X11/MIT
     7  *   See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
     7  *   See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
     8  */
     8  */
   132 				click(save_link);
   132 				click(save_link);
   133 				filesaver.readyState = filesaver.DONE;
   133 				filesaver.readyState = filesaver.DONE;
   134 				dispatch_all();
   134 				dispatch_all();
   135 				revoke(object_url);
   135 				revoke(object_url);
   136 				return;
   136 				return;
       
   137 			}
       
   138 			// prepend BOM for UTF-8 XML and text/plain types
       
   139 			if (/^\s*(?:text\/(?:plain|xml)|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
       
   140 				blob = new Blob(["\ufeff", blob], {type: blob.type});
   137 			}
   141 			}
   138 			// Object and web filesystem URLs have a problem saving in Google Chrome when
   142 			// Object and web filesystem URLs have a problem saving in Google Chrome when
   139 			// viewed in a tab, so I force save with application/octet-stream
   143 			// viewed in a tab, so I force save with application/octet-stream
   140 			// http://code.google.com/p/chromium/issues/detail?id=91158
   144 			// http://code.google.com/p/chromium/issues/detail?id=91158
   141 			// Update: Google errantly closed 91158, I submitted it again:
   145 			// Update: Google errantly closed 91158, I submitted it again:
   234 // `self` is undefined in Firefox for Android content script context
   238 // `self` is undefined in Firefox for Android content script context
   235 // while `this` is nsIContentFrameMessageManager
   239 // while `this` is nsIContentFrameMessageManager
   236 // with an attribute `content` that corresponds to the window
   240 // with an attribute `content` that corresponds to the window
   237 
   241 
   238 if (typeof module !== "undefined" && module.exports) {
   242 if (typeof module !== "undefined" && module.exports) {
   239   module.exports = saveAs;
   243   module.exports.saveAs = saveAs;
   240 } else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
   244 } else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
   241   define([], function() {
   245   define([], function() {
   242     return saveAs;
   246     return saveAs;
   243   });
   247   });
   244 }
   248 }