Skip to content
Snippets Groups Projects
Select Git revision
  • 6307dd3c11ac630394f26639f3b78ee809d51e4a
  • master default protected
  • 1.31
  • 4.34.1
  • 4.34.0
  • 4.33.1
  • 4.33.0
  • 4.32.2
  • 4.32.1
  • 4.32.0
  • 4.31.0
  • 4.30.1
  • 4.30.0
  • 4.29.1
  • 4.29.0
  • 4.28.0
  • 4.27.0
  • 4.26.0
  • 4.25.5
  • 4.25.4
  • 4.25.3
  • 4.25.2
  • 4.25.1
23 results

tutorial-form-example.html

Blame
  • FileSaver.js 5.83 KiB
    /* FileSaver.js
     * A saveAs() FileSaver implementation.
     * 1.3.2
     * 2016-06-16 18:25:19
     *
     * By Eli Grey, http://eligrey.com
     * License: MIT
     *   See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
     */
    
    /*global self */
    /*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
    
    /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
    
    var saveAs = saveAs || (function(view) {
    	"use strict";
    	// IE <10 is explicitly unsupported
    	if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
    		return;
    	}
    	var
    		  doc = view.document
    		  // only get URL when necessary in case Blob.js hasn't overridden it yet
    		, get_URL = function() {
    			return view.URL || view.webkitURL || view;
    		}
    		, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
    		, can_use_save_link = "download" in save_link
    		, click = function(node) {
    			var event = new MouseEvent("click");
    			node.dispatchEvent(event);
    		}
    		, is_safari = /constructor/i.test(view.HTMLElement) || view.safari
    		, is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)
    		, throw_outside = function(ex) {
    			(view.setImmediate || view.setTimeout)(function() {
    				throw ex;
    			}, 0);
    		}
    		, force_saveable_type = "application/octet-stream"
    		// the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to
    		, arbitrary_revoke_timeout = 1000 * 40 // in ms
    		, revoke = function(file) {
    			var revoker = function() {
    				if (typeof file === "string") { // file is an object URL
    					get_URL().revokeObjectURL(file);
    				} else { // file is a File
    					file.remove();
    				}
    			};
    			setTimeout(revoker, arbitrary_revoke_timeout);
    		}
    		, dispatch = function(filesaver, event_types, event) {
    			event_types = [].concat(event_types);
    			var i = event_types.length;
    			while (i--) {
    				var listener = filesaver["on" + event_types[i]];
    				if (typeof listener === "function") {
    					try {
    						listener.call(filesaver, event || filesaver);
    					} catch (ex) {
    						throw_outside(ex);
    					}
    				}
    			}
    		}
    		, auto_bom = function(blob) {
    			// prepend BOM for UTF-8 XML and text/* types (including HTML)
    			// note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF