From 346f3a9817b1e0812565396b9811a1ce5adc97b8 Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 13 Dec 2013 15:28:31 -0500 Subject: reorganize --- vendor/FileSaver/.bower.json | 15 --- vendor/FileSaver/FileSaver.js | 232 -------------------------------------- vendor/FileSaver/LICENSE.md | 30 ----- vendor/FileSaver/README.md | 78 ------------- vendor/FileSaver/bower.json | 7 -- vendor/FileSaver/demo/demo.css | 55 --------- vendor/FileSaver/demo/demo.js | 213 ---------------------------------- vendor/FileSaver/demo/demo.min.js | 2 - vendor/FileSaver/demo/index.xhtml | 57 ---------- vendor/FileSaver/package.json | 23 ---- 10 files changed, 712 deletions(-) delete mode 100644 vendor/FileSaver/.bower.json delete mode 100644 vendor/FileSaver/FileSaver.js delete mode 100644 vendor/FileSaver/LICENSE.md delete mode 100644 vendor/FileSaver/README.md delete mode 100644 vendor/FileSaver/bower.json delete mode 100644 vendor/FileSaver/demo/demo.css delete mode 100644 vendor/FileSaver/demo/demo.js delete mode 100644 vendor/FileSaver/demo/demo.min.js delete mode 100644 vendor/FileSaver/demo/index.xhtml delete mode 100644 vendor/FileSaver/package.json (limited to 'vendor') diff --git a/vendor/FileSaver/.bower.json b/vendor/FileSaver/.bower.json deleted file mode 100644 index 586a935..0000000 --- a/vendor/FileSaver/.bower.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "FileSaver", - "main": "./FileSaver.js", - "dependencies": {}, - "homepage": "https://github.com/eligrey/FileSaver.js", - "_release": "1f4b2f1724", - "_resolution": { - "type": "branch", - "branch": "master", - "commit": "1f4b2f1724b19ddaf5eae3d1523f7a8ae9cbf812" - }, - "_source": "git://github.com/eligrey/FileSaver.js.git", - "_target": "*", - "_originalSource": "FileSaver" -} \ No newline at end of file diff --git a/vendor/FileSaver/FileSaver.js b/vendor/FileSaver/FileSaver.js deleted file mode 100644 index 378a9dc..0000000 --- a/vendor/FileSaver/FileSaver.js +++ /dev/null @@ -1,232 +0,0 @@ -/* FileSaver.js - * A saveAs() FileSaver implementation. - * 2013-10-21 - * - * By Eli Grey, http://eligrey.com - * License: X11/MIT - * See LICENSE.md - */ - -/*global self */ -/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, - plusplus: true */ - -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ - -var saveAs = saveAs - || (typeof navigator !== 'undefined' && navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator)) - || (function(view) { - "use strict"; - var - doc = view.document - // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet - , get_URL = function() { - return view.URL || view.webkitURL || view; - } - , URL = view.URL || view.webkitURL || view - , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") - , can_use_save_link = !view.externalHost && "download" in save_link - , click = function(node) { - var event = doc.createEvent("MouseEvents"); - event.initMouseEvent( - "click", true, false, view, 0, 0, 0, 0, 0 - , false, false, false, false, 0, null - ); - node.dispatchEvent(event); - } - , webkit_req_fs = view.webkitRequestFileSystem - , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem - , throw_outside = function (ex) { - (view.setImmediate || view.setTimeout)(function() { - throw ex; - }, 0); - } - , force_saveable_type = "application/octet-stream" - , fs_min_size = 0 - , deletion_queue = [] - , process_deletion_queue = function() { - var i = deletion_queue.length; - while (i--) { - var file = deletion_queue[i]; - if (typeof file === "string") { // file is an object URL - URL.revokeObjectURL(file); - } else { // file is a File - file.remove(); - } - } - deletion_queue.length = 0; // clear queue - } - , 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); - } - } - } - } - , FileSaver = function(blob, name) { - // First try a.download, then web filesystem, then object URLs - var - filesaver = this - , type = blob.type - , blob_changed = false - , object_url - , target_view - , get_object_url = function() { - var object_url = get_URL().createObjectURL(blob); - deletion_queue.push(object_url); - return object_url; - } - , dispatch_all = function() { - dispatch(filesaver, "writestart progress write writeend".split(" ")); - } - // on any filesys errors revert to saving with object URLs - , fs_error = function() { - // don't create more object URLs than needed - if (blob_changed || !object_url) { - object_url = get_object_url(blob); - } - if (target_view) { - target_view.location.href = object_url; - } else { - window.open(object_url, "_blank"); - } - filesaver.readyState = filesaver.DONE; - dispatch_all(); - } - , abortable = function(func) { - return function() { - if (filesaver.readyState !== filesaver.DONE) { - return func.apply(this, arguments); - } - }; - } - , create_if_not_found = {create: true, exclusive: false} - , slice - ; - filesaver.readyState = filesaver.INIT; - if (!name) { - name = "download"; - } - if (can_use_save_link) { - object_url = get_object_url(blob); - // FF for Android has a nasty garbage collection mechanism - // that turns all objects that are not pure javascript into 'deadObject' - // this means `doc` and `save_link` are unusable and need to be recreated - // `view` is usable though: - doc = view.document; - save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a"); - save_link.href = object_url; - save_link.download = name; - var event = doc.createEvent("MouseEvents"); - event.initMouseEvent( - "click", true, false, view, 0, 0, 0, 0, 0 - , false, false, false, false, 0, null - ); - save_link.dispatchEvent(event); - filesaver.readyState = filesaver.DONE; - dispatch_all(); - return; - } - // Object and web filesystem URLs have a problem saving in Google Chrome when - // viewed in a tab, so I force save with application/octet-stream - // http://code.google.com/p/chromium/issues/detail?id=91158 - if (view.chrome && type && type !== force_saveable_type) { - slice = blob.slice || blob.webkitSlice; - blob = slice.call(blob, 0, blob.size, force_saveable_type); - blob_changed = true; - } - // Since I can't be sure that the guessed media type will trigger a download - // in WebKit, I append .download to the filename. - // https://bugs.webkit.org/show_bug.cgi?id=65440 - if (webkit_req_fs && name !== "download") { - name += ".download"; - } - if (type === force_saveable_type || webkit_req_fs) { - target_view = view; - } - if (!req_fs) { - fs_error(); - return; - } - fs_min_size += blob.size; - req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) { - fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) { - var save = function() { - dir.getFile(name, create_if_not_found, abortable(function(file) { - file.createWriter(abortable(function(writer) { - writer.onwriteend = function(event) { - target_view.location.href = file.toURL(); - deletion_queue.push(file); - filesaver.readyState = filesaver.DONE; - dispatch(filesaver, "writeend", event); - }; - writer.onerror = function() { - var error = writer.error; - if (error.code !== error.ABORT_ERR) { - fs_error(); - } - }; - "writestart progress write abort".split(" ").forEach(function(event) { - writer["on" + event] = filesaver["on" + event]; - }); - writer.write(blob); - filesaver.abort = function() { - writer.abort(); - filesaver.readyState = filesaver.DONE; - }; - filesaver.readyState = filesaver.WRITING; - }), fs_error); - }), fs_error); - }; - dir.getFile(name, {create: false}, abortable(function(file) { - // delete file if it already exists - file.remove(); - save(); - }), abortable(function(ex) { - if (ex.code === ex.NOT_FOUND_ERR) { - save(); - } else { - fs_error(); - } - })); - }), fs_error); - }), fs_error); - } - , FS_proto = FileSaver.prototype - , saveAs = function(blob, name) { - return new FileSaver(blob, name); - } - ; - FS_proto.abort = function() { - var filesaver = this; - filesaver.readyState = filesaver.DONE; - dispatch(filesaver, "abort"); - }; - FS_proto.readyState = FS_proto.INIT = 0; - FS_proto.WRITING = 1; - FS_proto.DONE = 2; - - FS_proto.error = - FS_proto.onwritestart = - FS_proto.onprogress = - FS_proto.onwrite = - FS_proto.onabort = - FS_proto.onerror = - FS_proto.onwriteend = - null; - - view.addEventListener("unload", process_deletion_queue, false); - return saveAs; -}(this.self || this.window || this.content)); -// `self` is undefined in Firefox for Android content script context -// while `this` is nsIContentFrameMessageManager -// with an attribute `content` that corresponds to the window - -if (typeof module !== 'undefined') module.exports = saveAs; diff --git a/vendor/FileSaver/LICENSE.md b/vendor/FileSaver/LICENSE.md deleted file mode 100644 index 7eb56b9..0000000 --- a/vendor/FileSaver/LICENSE.md +++ /dev/null @@ -1,30 +0,0 @@ -This software is licensed under the MIT/X11 license. - -MIT/X11 license ---------------- - -Copyright © 2011 [Eli Grey][1]. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - - - [1]: http://eligrey.com \ No newline at end of file diff --git a/vendor/FileSaver/README.md b/vendor/FileSaver/README.md deleted file mode 100644 index 49aff62..0000000 --- a/vendor/FileSaver/README.md +++ /dev/null @@ -1,78 +0,0 @@ -FileSaver.js -============ - -FileSaver.js implements the HTML5 W3C `saveAs()` [FileSaver][1] interface in browsers that do -not natively support it. There is a [FileSaver.js demo][2] that demonstrates saving -various media types. - -FileSaver.js is the solution to saving files on the client-side, and is perfect for -webapps that need to generate files, or for saving sensitive information that shouldn't be -sent to an external server. - -Looking for `canvas.toBlob()` for saving canvases? Check out -[canvas-toBlob.js](https://github.com/eligrey/canvas-toBlob.js) for a cross-browser implementation. - -Supported Browsers ------------------- - -| Browser | Constructs as | Filenames | Max Blob Size | Dependencies | -| -------------- | ------------- | ------------ | ------------- | ------------ | -| Firefox 20+ | Blob | Yes | 800MiB | None | -| Firefox ≤ 19 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | -| Chrome | Blob | Yes | 345MiB | None | -| Chrome for Android | Blob | Yes | ? | None | -| IE 10+ | Blob | Yes | 600MiB | None | -| Opera Next | Blob | Yes | ? | None | -| Opera < 15 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | -| Safari 6.1+ | Blob | No | ? | None | -| Safari < 6 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | - -Feature detection is possible: - - try { var isFileSaverSupported = !!new Blob(); } catch(e){} - -Syntax ------- - - FileSaver saveAs(in Blob data, in DOMString filename) - -Examples --------- - -### Saving text - - var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); - saveAs(blob, "hello world.txt"); - -The standard W3C File API [`Blob`][3] interface is not available in all browsers. -[Blob.js][4] is a cross-browser `Blob` implementation that solves this. - -### Saving a canvas - - var canvas = document.getElementById("my-canvas"), ctx = canvas.getContext("2d"); - // draw to canvas... - canvas.toBlob(function(blob) { - saveAs(blob, "pretty image.png"); - }); - -Note: The standard HTML5 `canvas.toBlob()` method is not available in all browsers. -[canvas-toBlob.js][5] is a cross-browser `canvas.toBlob()` that polyfills this. - -### Aborting a save - - var filesaver = saveAs(blob, "whatever"); - cancel_button.addEventListener("click", function() { - if (filesaver.abort) { - filesaver.abort(); - } - }, false); - -This isn't that useful unless you're saving very large files (e.g. generated video). - -![Tracking image](https://in.getclicky.com/212712ns.gif) - - [1]: http://www.w3.org/TR/file-writer-api/#the-filesaver-interface - [2]: http://eligrey.com/demos/FileSaver.js/ - [3]: https://developer.mozilla.org/en-US/docs/DOM/Blob - [4]: https://github.com/eligrey/Blob.js - [5]: https://github.com/eligrey/canvas-toBlob.js diff --git a/vendor/FileSaver/bower.json b/vendor/FileSaver/bower.json deleted file mode 100644 index 0e0d7e0..0000000 --- a/vendor/FileSaver/bower.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "FileSaver", - "version": "1.0.0", - "main": "./FileSaver.js", - "dependencies": { - } -} diff --git a/vendor/FileSaver/demo/demo.css b/vendor/FileSaver/demo/demo.css deleted file mode 100644 index fe03ca5..0000000 --- a/vendor/FileSaver/demo/demo.css +++ /dev/null @@ -1,55 +0,0 @@ -html { - background-color: #DDD; -} -body { - width: 900px; - margin: 0 auto; - font-family: Verdana, Helvetica, Arial, sans-serif; - box-shadow: 0 0 5px #000; - box-shadow: 0 0 10px 2px rgba(0, 0, 0, .5); - padding: 7px 25px 70px; - background-color: #FFF; -} -h1, h2, h3, h4, h5, h6 { - font-family: Georgia, "Times New Roman", serif; -} -h2, form { - text-align: center; -} -form { - margin-top: 5px; -} -.input { - width: 500px; - height: 300px; - margin: 0 auto; - display: block; -} -section { - margin-top: 40px; -} -dt { - font-weight: bold; - font-size: larger; -} -#canvas { - cursor: crosshair; -} -#canvas, #html { - border: 1px solid black; -} -.filename { - text-align: right; -} -#html { - box-sizing: border-box; - ms-box-sizing: border-box; - webkit-box-sizing: border-box; - moz-box-sizing: border-box; - overflow: auto; - padding: 1em; -} -dt:target { - background-color: Highlight; - color: HighlightText; -} diff --git a/vendor/FileSaver/demo/demo.js b/vendor/FileSaver/demo/demo.js deleted file mode 100644 index e08497b..0000000 --- a/vendor/FileSaver/demo/demo.js +++ /dev/null @@ -1,213 +0,0 @@ -/* FileSaver.js demo script - * 2012-01-23 - * - * By Eli Grey, http://eligrey.com - * License: X11/MIT - * See LICENSE.md - */ - -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/demo/demo.js */ - -(function(view) { -"use strict"; -// The canvas drawing portion of the demo is based off the demo at -// http://www.williammalone.com/articles/create-html5-canvas-javascript-drawing-app/ -var - document = view.document - , $ = function(id) { - return document.getElementById(id); - } - , session = view.sessionStorage - // only get URL when necessary in case Blob.js hasn't defined it yet - , get_blob = function() { - return view.Blob; - } - - , canvas = $("canvas") - , canvas_options_form = $("canvas-options") - , canvas_filename = $("canvas-filename") - , canvas_clear_button = $("canvas-clear") - - , text = $("text") - , text_options_form = $("text-options") - , text_filename = $("text-filename") - - , html = $("html") - , html_options_form = $("html-options") - , html_filename = $("html-filename") - - , ctx = canvas.getContext("2d") - , drawing = false - , x_points = session.x_points || [] - , y_points = session.y_points || [] - , drag_points = session.drag_points || [] - , add_point = function(x, y, dragging) { - x_points.push(x); - y_points.push(y); - drag_points.push(dragging); - } - , draw = function(){ - canvas.width = canvas.width; - ctx.lineWidth = 6; - ctx.lineJoin = "round"; - ctx.strokeStyle = "#000000"; - var - i = 0 - , len = x_points.length - ; - for(; i < len; i++) { - ctx.beginPath(); - if (i && drag_points[i]) { - ctx.moveTo(x_points[i-1], y_points[i-1]); - } else { - ctx.moveTo(x_points[i]-1, y_points[i]); - } - ctx.lineTo(x_points[i], y_points[i]); - ctx.closePath(); - ctx.stroke(); - } - } - , stop_drawing = function() { - drawing = false; - } - - // Title guesser and document creator available at https://gist.github.com/1059648 - , guess_title = function(doc) { - var - h = "h6 h5 h4 h3 h2 h1".split(" ") - , i = h.length - , headers - , header_text - ; - while (i--) { - headers = doc.getElementsByTagName(h[i]); - for (var j = 0, len = headers.length; j < len; j++) { - header_text = headers[j].textContent.trim(); - if (header_text) { - return header_text; - } - } - } - } - , doc_impl = document.implementation - , create_html_doc = function(html) { - var - dt = doc_impl.createDocumentType('html', null, null) - , doc = doc_impl.createDocument("http://www.w3.org/1999/xhtml", "html", dt) - , doc_el = doc.documentElement - , head = doc_el.appendChild(doc.createElement("head")) - , charset_meta = head.appendChild(doc.createElement("meta")) - , title = head.appendChild(doc.createElement("title")) - , body = doc_el.appendChild(doc.createElement("body")) - , i = 0 - , len = html.childNodes.length - ; - charset_meta.setAttribute("charset", html.ownerDocument.characterSet); - for (; i < len; i++) { - body.appendChild(doc.importNode(html.childNodes.item(i), true)); - } - var title_text = guess_title(doc); - if (title_text) { - title.appendChild(doc.createTextNode(title_text)); - } - return doc; - } -; -canvas.width = 500; -canvas.height = 300; - - if (typeof x_points === "string") { - x_points = JSON.parse(x_points); -} if (typeof y_points === "string") { - y_points = JSON.parse(y_points); -} if (typeof drag_points === "string") { - drag_points = JSON.parse(drag_points); -} if (session.canvas_filename) { - canvas_filename.value = session.canvas_filename; -} if (session.text) { - text.value = session.text; -} if (session.text_filename) { - text_filename.value = session.text_filename; -} if (session.html) { - html.innerHTML = session.html; -} if (session.html_filename) { - html_filename.value = session.html_filename; -} - -drawing = true; -draw(); -drawing = false; - -canvas_clear_button.addEventListener("click", function() { - canvas.width = canvas.width; - x_points.length = - y_points.length = - drag_points.length = - 0; -}, false); -canvas.addEventListener("mousedown", function(event) { - event.preventDefault(); - drawing = true; - add_point(event.pageX - canvas.offsetLeft, event.pageY - canvas.offsetTop, false); - draw(); -}, false); -canvas.addEventListener("mousemove", function(event) { - if (drawing) { - add_point(event.pageX - canvas.offsetLeft, event.pageY - canvas.offsetTop, true); - draw(); - } -}, false); -canvas.addEventListener("mouseup", stop_drawing, false); -canvas.addEventListener("mouseout", stop_drawing, false); - -canvas_options_form.addEventListener("submit", function(event) { - event.preventDefault(); - canvas.toBlob(function(blob) { - saveAs( - blob - , (canvas_filename.value || canvas_filename.placeholder) + ".png" - ); - }, "image/png"); -}, false); - -text_options_form.addEventListener("submit", function(event) { - event.preventDefault(); - var BB = get_blob(); - saveAs( - new BB( - [text.value || text.placeholder] - , {type: "text/plain;charset=" + document.characterSet} - ) - , (text_filename.value || text_filename.placeholder) + ".txt" - ); -}, false); - -html_options_form.addEventListener("submit", function(event) { - event.preventDefault(); - var - BB = get_blob() - , xml_serializer = new XMLSerializer - , doc = create_html_doc(html) - ; - saveAs( - new BB( - [xml_serializer.serializeToString(doc)] - , {type: "application/xhtml+xml;charset=" + document.characterSet} - ) - , (html_filename.value || html_filename.placeholder) + ".xhtml" - ); -}, false); - -view.addEventListener("unload", function() { - session.x_points = JSON.stringify(x_points); - session.y_points = JSON.stringify(y_points); - session.drag_points = JSON.stringify(drag_points); - session.canvas_filename = canvas_filename.value; - - session.text = text.value; - session.text_filename = text_filename.value; - - session.html = html.innerHTML; - session.html_filename = html_filename.value; -}, false); -}(self)); diff --git a/vendor/FileSaver/demo/demo.min.js b/vendor/FileSaver/demo/demo.min.js deleted file mode 100644 index 77f9ed1..0000000 --- a/vendor/FileSaver/demo/demo.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/demo/demo.js */ -(function(n){"use strict";var s=n.document,g=function(A){return s.getElementById(A)},b=n.sessionStorage,x=function(){return n.Blob},f=g("canvas"),r=g("canvas-options"),y=g("canvas-filename"),p=g("canvas-clear"),q=g("text"),t=g("text-options"),h=g("text-filename"),m=g("html"),e=g("html-options"),i=g("html-filename"),u=f.getContext("2d"),z=false,a=b.x_points||[],o=b.y_points||[],d=b.drag_points||[],j=function(A,C,B){a.push(A);o.push(C);d.push(B)},l=function(){f.width=f.width;u.lineWidth=6;u.lineJoin="round";u.strokeStyle="#000000";var B=0,A=a.length;for(;B - - - -FileSaver.js demo - - - -

FileSaver.js demo

-

-The following examples demonstrate how it is possible to generate and save any type of data right in the browser using the W3C saveAs() FileSaver interface, without contacting any servers. -

-
-

Saving an image

- -
- - - -
-
-
-

Saving text

-