first commit
This commit is contained in:
22
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/LICENSE.txt
generated
vendored
Normal file
22
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Downloadify: Client Side File Creation
|
||||
JavaScript + Flash Library
|
||||
|
||||
Copyright (c) 2009 Douglas C. Neiner
|
||||
|
||||
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.
|
||||
113
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/README.textile
generated
vendored
Normal file
113
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/README.textile
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
h2. Downloadify: Client Side File Creation
|
||||
|
||||
*_Important! The swf has been compiled for online use only. Testing from the file path (i.e. file:// ) will not work as it will violate the security sandbox._*
|
||||
|
||||
h3. Overview
|
||||
|
||||
This library is a tiny JavaScript + Flash library that allows you to generate files on the fly, in the browser, without server interaction. Web applications that allow you to generate vCards, color palettes, custom code, etc would benefit from using this library. In addition to increasing speed (no round trip to the server) this solution can reduce the database and server load of existing web applications. _This is not a library to 'force download' a file from a server. It does not interact with a server at all._
|
||||
|
||||
h3. Demo
|
||||
|
||||
A "very simple demo is available":http://pixelgraphics.us/downloadify/test.html that lets you supply your own content and filename and test out saving, canceling, and the error functionality when the file is blank.
|
||||
|
||||
For a real world usage, see "Starter for jQuery":http://starter.pixelgraphics.us . To quickly demo the usage, just click "Load Example Data" then click Download. After the initial page load, no further contact is made with the server. Everything happens on the client side.
|
||||
|
||||
h3. Download
|
||||
|
||||
Please download from the "Downloads":http://github.com/dcneiner/Downloadify/downloads section of this project.
|
||||
|
||||
h3. Support
|
||||
|
||||
For support, please use the "Issues":http://github.com/dcneiner/Downloadify/issues section of this project. You can also try to hit me up on "Twitter at @dougneiner":http://twitter.com/dougneiner but I might just ask you to file an issue. :)
|
||||
|
||||
h3. Dependencies
|
||||
|
||||
_The end user must have Flash 10 or higher installed for this plugin to work. As of September 2009, it was at a 93% saturation, so most users should already have it installed._
|
||||
|
||||
Downloadify is only dependent on "SWFObject 2.0":http://code.google.com/p/swfobject/ which is included with the download. It is compatible with any JavaScript framework but has a helper for both jQuery and MooTools. Neither helper will be activatd if Downloadify is inserted prior to including the framework library.
|
||||
|
||||
h3. Usage
|
||||
|
||||
*Any JavaScript framework*:
|
||||
|
||||
<pre>Downloadify.create( id_or_DOM_element, options );</pre>
|
||||
|
||||
*jQuery*:
|
||||
|
||||
<pre>$("#element").downloadify( options );</pre>
|
||||
|
||||
*MooTools:*
|
||||
|
||||
<pre>$("elementid").downloadify( options );</pre>
|
||||
|
||||
h3. Options
|
||||
|
||||
Unless you are using the jQuery plugin included with Downloadify, you must supply all required options with your call to the <tt>Downloadify.create</tt> function.
|
||||
|
||||
*Defaults and Required Options*
|
||||
|
||||
* <tt>swf</tt>: <tt>'media/downloadify.swf'</tt> <span style="color:red">*Required*</span> <br />_Path to the SWF File. Can be relative from the page, or an absolute path._
|
||||
* <tt>downloadImage</tt>: <tt>'images/download.png'</tt> <span style="color:red">*Required*</span> <br />_Path to the Button Image. Can be relative from the page or an absolute path._
|
||||
* <tt>width</tt>: 175 <span style="color:red">*Required*</span> <br />_Width of the button (and the flash movie)_
|
||||
* <tt>height</tt>: 55 <span style="color:red">*Required*</span> <br />_Height of the button. This will be 1/4 the height of the image._
|
||||
* <tt>filename</tt>: <span style="color:red">*Required*</span><br /> _Can be a String or a function callback. If a function, the return value of the function will be used as the filename._
|
||||
* <tt>data</tt>: <span style="color:red">*Required*</span><br /> _Can be a normal String, base64 encoded String, or a function callback. If a function, the return value of the function will be used as the file data._
|
||||
* <tt>dataType</tt>: <tt>'string'</tt><br /> _Must be a String with the value <tt>string</tt> or <tt>base64</tt>. Data paired with the <tt>dataType</tt> of <tt>base64</tt> will be decoded into a <tt>ByteArray</tt> prior to saving._
|
||||
* <tt>transparent</tt>: false <br />_Set this to true to use wmode=transparent on the flash movie._
|
||||
* <tt>append</tt>: false <br />_By default the contents of the targeted DOM element are removed. Set this to true to keep the contents and append the button._
|
||||
|
||||
*Event Callbacks*
|
||||
|
||||
No data is passed into these functions, they are simply called.
|
||||
|
||||
* <tt>onError</tt>: _Called when the Download button is clicked but your <tt>data</tt> callback returns <tt>""</tt>._
|
||||
* <tt>onCancel</tt>: _Called when the Download button is clicked but the user then cancels without saving._
|
||||
* <tt>onComplete</tt>: _Called when the Download button is clicked and the file is saved to the user's computer._
|
||||
|
||||
h3. Setting Up the Image
|
||||
|
||||
Downloadify supports (i.e. requires) three button states with limited support for a fourth. The states are:
|
||||
|
||||
* *Normal*
|
||||
* *Over* ( When the mouse hovers over the button )
|
||||
* *Down* ( When the button is pressed )
|
||||
* *Disabled* ( Limited support, when .disable() is called on the Downloadify.Container object )
|
||||
|
||||
In trying to keep this plugin as simple as possible, all four states are always assumed to be present. You should prepare your button image as a single image the width you want your button, and four times the height of the button. All four states should then live in that one image in the same order as the previous list from top to bottom.
|
||||
|
||||
h3. Potential Issues
|
||||
|
||||
When working with different button images, you may find Flash has cached your image. This is the desired behavior on a live site, but not during development. To get around this, simply supply a ?rev=1 or ?rev=2 etc on the end of your downloadImage url.
|
||||
|
||||
h3. Compiling Notes
|
||||
|
||||
I develop locally using Xcode and the Flex 4 SDK Beta 2. Please do not submit request on how to setup a local testing environment. If you are interested in my Xcode project files, send me a message.
|
||||
|
||||
h3. Developers
|
||||
|
||||
*Core Developer:* "Doug Neiner":http://dougneiner.com
|
||||
|
||||
*Contributors:*
|
||||
|
||||
* "David Walsh":http://davidwalsh.name -- Contributed the MooTools helper
|
||||
|
||||
h3. Change Log
|
||||
|
||||
* *Version 0.2*:
|
||||
** Added support for <tt>base64</tt> via the "as3base64 Library":http://github.com/spjwebster/as3base64
|
||||
** Added <tt>dataType</tt> option
|
||||
** Added MooTools helper (Thanks David!)
|
||||
** Upgraded SWFObject to v2.2
|
||||
* *Original Release:* Version 0.1
|
||||
|
||||
h3. License Information: MIT
|
||||
|
||||
as3base64: "Copyright (c) 2006 Steve Webster":http://github.com/spjwebster/as3base64
|
||||
|
||||
All Downloadify Code: Copyright (c) 2009 Douglas C. Neiner
|
||||
|
||||
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.
|
||||
BIN
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/images/download.png
generated
vendored
Normal file
BIN
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/images/download.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
3
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/js/downloadify.min.js
generated
vendored
Normal file
3
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/js/downloadify.min.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* Downloadify 0.2 (c) 2009 by Douglas Neiner. Licensed under the MIT license */
|
||||
/* See http://github.com/dcneiner/Downloadify for license and more info */
|
||||
(function(){Downloadify=window.Downloadify={queue:{},uid:new Date().getTime(),getTextForSave:function(a){var b=Downloadify.queue[a];if(b)return b.getData();return""},getFileNameForSave:function(a){var b=Downloadify.queue[a];if(b)return b.getFilename();return""},getDataTypeForSave:function(a){var b=Downloadify.queue[a];if(b)return b.getDataType();return""},saveComplete:function(a){var b=Downloadify.queue[a];if(b)b.complete();return true},saveCancel:function(a){var b=Downloadify.queue[a];if(b)b.cancel();return true},saveError:function(a){var b=Downloadify.queue[a];if(b)b.error();return true},addToQueue:function(a){Downloadify.queue[a.queue_name]=a},getUID:function(a){if(a.id=="")a.id='downloadify_'+Downloadify.uid++;return a.id}};Downloadify.create=function(a,b){var c=(typeof(a)=="string"?document.getElementById(a):a);return new Downloadify.Container(c,b)};Downloadify.Container=function(d,e){var f=this;f.el=d;f.enabled=true;f.dataCallback=null;f.filenameCallback=null;f.data=null;f.filename=null;var g=function(){f.options=e;if(!f.options.append)f.el.innerHTML="";f.flashContainer=document.createElement('span');f.el.appendChild(f.flashContainer);f.queue_name=Downloadify.getUID(f.flashContainer);if(typeof(f.options.filename)==="function")f.filenameCallback=f.options.filename;else if(f.options.filename)f.filename=f.options.filename;if(typeof(f.options.data)==="function")f.dataCallback=f.options.data;else if(f.options.data)f.data=f.options.data;var a={queue_name:f.queue_name,width:f.options.width,height:f.options.height};var b={allowScriptAccess:'always'};var c={id:f.flashContainer.id,name:f.flashContainer.id};if(f.options.enabled===false)f.enabled=false;if(f.options.transparent===true)b.wmode="transparent";if(f.options.downloadImage)a.downloadImage=f.options.downloadImage;swfobject.embedSWF(f.options.swf,f.flashContainer.id,f.options.width,f.options.height,"10",null,a,b,c);Downloadify.addToQueue(f)};f.enable=function(){var a=document.getElementById(f.flashContainer.id);a.setEnabled(true);f.enabled=true};f.disable=function(){var a=document.getElementById(f.flashContainer.id);a.setEnabled(false);f.enabled=false};f.getData=function(){if(!f.enabled)return"";if(f.dataCallback)return f.dataCallback();else if(f.data)return f.data;else return""};f.getFilename=function(){if(f.filenameCallback)return f.filenameCallback();else if(f.filename)return f.filename;else return""};f.getDataType=function(){if(f.options.dataType)return f.options.dataType;return"string"};f.complete=function(){if(typeof(f.options.onComplete)==="function")f.options.onComplete()};f.cancel=function(){if(typeof(f.options.onCancel)==="function")f.options.onCancel()};f.error=function(){if(typeof(f.options.onError)==="function")f.options.onError()};g()};Downloadify.defaultOptions={swf:'media/downloadify.swf',downloadImage:'images/download.png',width:100,height:30,transparent:true,append:false,dataType:"string"}})();if(typeof(jQuery)!="undefined"){(function($){$.fn.downloadify=function(b){return this.each(function(){b=$.extend({},Downloadify.defaultOptions,b);var a=Downloadify.create(this,b);$(this).data('Downloadify',a)})}})(jQuery)};if(typeof(MooTools)!='undefined'){Element.implement({downloadify:function(a){a=$merge(Downloadify.defaultOptions,a);return this.store('Downloadify',Downloadify.create(this,a))}})};
|
||||
4
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/js/swfobject.js
generated
vendored
Normal file
4
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/js/swfobject.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/media/downloadify.swf
generated
vendored
Normal file
BIN
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/media/downloadify.swf
generated
vendored
Normal file
Binary file not shown.
173
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/Downloadify.as
generated
vendored
Normal file
173
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/Downloadify.as
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
/*
|
||||
Downloadify: Client Side File Creation
|
||||
JavaScript + Flash Library
|
||||
|
||||
Version: 0.2
|
||||
|
||||
Copyright (c) 2009 Douglas C. Neiner
|
||||
|
||||
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.
|
||||
*/
|
||||
package {
|
||||
import flash.system.Security;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.net.FileReference;
|
||||
import flash.net.FileFilter;
|
||||
import flash.net.URLRequest;
|
||||
import flash.display.*;
|
||||
import flash.utils.ByteArray;
|
||||
import flash.external.ExternalInterface;
|
||||
import com.dynamicflash.util.Base64;
|
||||
|
||||
[SWF(backgroundColor="#CCCCCC")]
|
||||
[SWF(backgroundAlpha=0)]
|
||||
public class Downloadify extends Sprite {
|
||||
|
||||
private var options:Object,
|
||||
file:FileReference = new FileReference(),
|
||||
queue_name:String = "",
|
||||
|
||||
_width:Number = 0,
|
||||
_height:Number = 0,
|
||||
|
||||
enabled:Boolean = true,
|
||||
over:Boolean = false,
|
||||
down:Boolean = false,
|
||||
|
||||
buttonImage:String = "images/download.png",
|
||||
|
||||
button:Loader;
|
||||
|
||||
public function Downloadify() {
|
||||
Security.allowDomain('*');
|
||||
|
||||
stage.align = StageAlign.TOP_LEFT;
|
||||
stage.scaleMode = StageScaleMode.NO_SCALE;
|
||||
|
||||
options = this.root.loaderInfo.parameters;
|
||||
|
||||
queue_name = options.queue_name.toString();
|
||||
|
||||
_width = options.width;
|
||||
_height = options.height;
|
||||
|
||||
if(options.downloadImage){
|
||||
buttonImage = options.downloadImage;
|
||||
}
|
||||
|
||||
setupDefaultButton();
|
||||
addChild(button);
|
||||
|
||||
this.buttonMode = true;
|
||||
|
||||
this.addEventListener(MouseEvent.CLICK, onMouseClickEvent);
|
||||
this.addEventListener(MouseEvent.ROLL_OVER , onMouseEnter);
|
||||
this.addEventListener(MouseEvent.ROLL_OUT , onMouseLeave);
|
||||
this.addEventListener(MouseEvent.MOUSE_DOWN , onMouseDown);
|
||||
this.addEventListener(MouseEvent.MOUSE_UP , onMouseUp);
|
||||
|
||||
ExternalInterface.addCallback('setEnabled', setEnabled);
|
||||
|
||||
file.addEventListener(Event.COMPLETE, onSaveComplete);
|
||||
file.addEventListener(Event.CANCEL, onSaveCancel);
|
||||
}
|
||||
|
||||
private function setEnabled(isEnabled:Boolean):Boolean {
|
||||
enabled = isEnabled;
|
||||
if(enabled === true){
|
||||
button.y = 0;
|
||||
this.buttonMode = true;
|
||||
} else {
|
||||
button.y = (-3 * _height);
|
||||
this.buttonMode = false;
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private function setupDefaultButton():void {
|
||||
button = new Loader();
|
||||
var urlReq:URLRequest = new URLRequest(buttonImage);
|
||||
button.load(urlReq);
|
||||
button.x = 0;
|
||||
button.y = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function onMouseEnter(event:Event):void {
|
||||
if(enabled === true){
|
||||
if(down === false) button.y = (-1 * _height);
|
||||
over = true;
|
||||
}
|
||||
}
|
||||
protected function onMouseLeave(event:Event):void {
|
||||
if(enabled === true){
|
||||
if(down === false) button.y = 0;
|
||||
over = false;
|
||||
}
|
||||
}
|
||||
protected function onMouseDown(event:Event):void {
|
||||
if(enabled === true){
|
||||
button.y = button.y = (-2 * _height);
|
||||
down = true;
|
||||
}
|
||||
}
|
||||
protected function onMouseUp(event:Event):void {
|
||||
if(enabled === true){
|
||||
if(over === false){
|
||||
button.y = 0;
|
||||
} else {
|
||||
button.y = (-1 * _height);
|
||||
}
|
||||
down = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function onMouseClickEvent(event:Event):void{
|
||||
var theData:String = ExternalInterface.call('Downloadify.getTextForSave',queue_name),
|
||||
filename:String = ExternalInterface.call('Downloadify.getFileNameForSave',queue_name),
|
||||
dataType:String = ExternalInterface.call('Downloadify.getDataTypeForSave',queue_name);
|
||||
|
||||
if (dataType == "string" && theData != "") {
|
||||
file.save(theData, filename);
|
||||
} else if (dataType == "base64" && theData){
|
||||
file.save(Base64.decodeToByteArray(theData), filename);
|
||||
} else {
|
||||
onSaveError();
|
||||
}
|
||||
}
|
||||
|
||||
protected function onSaveComplete(event:Event):void{
|
||||
trace('Save Complete');
|
||||
ExternalInterface.call('Downloadify.saveComplete',queue_name);
|
||||
}
|
||||
|
||||
protected function onSaveCancel(event:Event):void{
|
||||
trace('Save Cancel');
|
||||
ExternalInterface.call('Downloadify.saveCancel',queue_name);
|
||||
}
|
||||
|
||||
protected function onSaveError():void{
|
||||
trace('Save Error');
|
||||
ExternalInterface.call('Downloadify.saveError',queue_name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
135
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/com/dynamicflash/util/Base64.as
generated
vendored
Normal file
135
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/com/dynamicflash/util/Base64.as
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
Base64 - 1.1.0
|
||||
|
||||
Copyright (c) 2006 Steve Webster
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package com.dynamicflash.util {
|
||||
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public class Base64 {
|
||||
|
||||
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
public static const version:String = "1.1.0";
|
||||
|
||||
public static function encode(data:String):String {
|
||||
// Convert string to ByteArray
|
||||
var bytes:ByteArray = new ByteArray();
|
||||
bytes.writeUTFBytes(data);
|
||||
|
||||
// Return encoded ByteArray
|
||||
return encodeByteArray(bytes);
|
||||
}
|
||||
|
||||
public static function encodeByteArray(data:ByteArray):String {
|
||||
// Initialise output
|
||||
var output:String = "";
|
||||
|
||||
// Create data and output buffers
|
||||
var dataBuffer:Array;
|
||||
var outputBuffer:Array = new Array(4);
|
||||
|
||||
// Rewind ByteArray
|
||||
data.position = 0;
|
||||
|
||||
// while there are still bytes to be processed
|
||||
while (data.bytesAvailable > 0) {
|
||||
// Create new data buffer and populate next 3 bytes from data
|
||||
dataBuffer = new Array();
|
||||
for (var i:uint = 0; i < 3 && data.bytesAvailable > 0; i++) {
|
||||
dataBuffer[i] = data.readUnsignedByte();
|
||||
}
|
||||
|
||||
// Convert to data buffer Base64 character positions and
|
||||
// store in output buffer
|
||||
outputBuffer[0] = (dataBuffer[0] & 0xfc) >> 2;
|
||||
outputBuffer[1] = ((dataBuffer[0] & 0x03) << 4) | ((dataBuffer[1]) >> 4);
|
||||
outputBuffer[2] = ((dataBuffer[1] & 0x0f) << 2) | ((dataBuffer[2]) >> 6);
|
||||
outputBuffer[3] = dataBuffer[2] & 0x3f;
|
||||
|
||||
// If data buffer was short (i.e not 3 characters) then set
|
||||
// end character indexes in data buffer to index of '=' symbol.
|
||||
// This is necessary because Base64 data is always a multiple of
|
||||
// 4 bytes and is basses with '=' symbols.
|
||||
for (var j:uint = dataBuffer.length; j < 3; j++) {
|
||||
outputBuffer[j + 1] = 64;
|
||||
}
|
||||
|
||||
// Loop through output buffer and add Base64 characters to
|
||||
// encoded data string for each character.
|
||||
for (var k:uint = 0; k < outputBuffer.length; k++) {
|
||||
output += BASE64_CHARS.charAt(outputBuffer[k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Return encoded data
|
||||
return output;
|
||||
}
|
||||
|
||||
public static function decode(data:String):String {
|
||||
// Decode data to ByteArray
|
||||
var bytes:ByteArray = decodeToByteArray(data);
|
||||
|
||||
// Convert to string and return
|
||||
return bytes.readUTFBytes(bytes.length);
|
||||
}
|
||||
|
||||
public static function decodeToByteArray(data:String):ByteArray {
|
||||
// Initialise output ByteArray for decoded data
|
||||
var output:ByteArray = new ByteArray();
|
||||
|
||||
// Create data and output buffers
|
||||
var dataBuffer:Array = new Array(4);
|
||||
var outputBuffer:Array = new Array(3);
|
||||
|
||||
// While there are data bytes left to be processed
|
||||
for (var i:uint = 0; i < data.length; i += 4) {
|
||||
// Populate data buffer with position of Base64 characters for
|
||||
// next 4 bytes from encoded data
|
||||
for (var j:uint = 0; j < 4 && i + j < data.length; j++) {
|
||||
dataBuffer[j] = BASE64_CHARS.indexOf(data.charAt(i + j));
|
||||
}
|
||||
|
||||
// Decode data buffer back into bytes
|
||||
outputBuffer[0] = (dataBuffer[0] << 2) + ((dataBuffer[1] & 0x30) >> 4);
|
||||
outputBuffer[1] = ((dataBuffer[1] & 0x0f) << 4) + ((dataBuffer[2] & 0x3c) >> 2);
|
||||
outputBuffer[2] = ((dataBuffer[2] & 0x03) << 6) + dataBuffer[3];
|
||||
|
||||
// Add all non-padded bytes in output buffer to decoded data
|
||||
for (var k:uint = 0; k < outputBuffer.length; k++) {
|
||||
if (dataBuffer[k+1] == 64) break;
|
||||
output.writeByte(outputBuffer[k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Rewind decoded data ByteArray
|
||||
output.position = 0;
|
||||
|
||||
// Return decoded data
|
||||
return output;
|
||||
}
|
||||
|
||||
public function Base64() {
|
||||
throw new Error("Base64 class is static container only");
|
||||
}
|
||||
}
|
||||
}
|
||||
60
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/com/dynamicflash/util/tests/Base64Test.as
generated
vendored
Normal file
60
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/com/dynamicflash/util/tests/Base64Test.as
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright (c) 2006 Steve Webster
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package com.dynamicflash.util.tests {
|
||||
|
||||
import flexunit.framework.TestCase;
|
||||
import flexunit.framework.TestSuite;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
import com.dynamicflash.util.Base64;
|
||||
|
||||
public class Base64Test extends TestCase {
|
||||
|
||||
public function Base64Test(methodName:String = null) {
|
||||
super(methodName);
|
||||
}
|
||||
|
||||
public function testEncode():void {
|
||||
assertEquals("VGhpcyBpcyBhIHRlc3Q=",Base64.encode("This is a test"));
|
||||
}
|
||||
|
||||
public function testEncodeDecodeBytes():void {
|
||||
var obj:Object = {name:"Dynamic Flash", url:"http://dynamicflash.com"};
|
||||
var source:ByteArray = new ByteArray();
|
||||
source.writeObject(obj);
|
||||
var encoded:String = Base64.encodeByteArray(source);
|
||||
var decoded:ByteArray = Base64.decodeToByteArray(encoded);
|
||||
var obj2:Object = decoded.readObject();
|
||||
assertEquals(obj.name, obj2.name);
|
||||
assertEquals(obj.url, obj2.url);
|
||||
}
|
||||
|
||||
public function testDecode():void {
|
||||
assertEquals("This is a test",Base64.decode("VGhpcyBpcyBhIHRlc3Q="));
|
||||
}
|
||||
|
||||
public function testEncodeDecode():void {
|
||||
var string:String = "The quick brown fox jumped over the lazy dogs";
|
||||
assertEquals(string, Base64.decode(Base64.encode(string)));
|
||||
}
|
||||
}
|
||||
}
|
||||
213
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/downloadify.js
generated
vendored
Normal file
213
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/src/downloadify.js
generated
vendored
Normal file
@ -0,0 +1,213 @@
|
||||
/*
|
||||
Downloadify: Client Side File Creation
|
||||
JavaScript + Flash Library
|
||||
|
||||
Version: 0.2
|
||||
|
||||
Copyright (c) 2009 Douglas C. Neiner
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
(function(){
|
||||
Downloadify = window.Downloadify = {
|
||||
queue: {},
|
||||
uid: new Date().getTime(),
|
||||
getTextForSave: function(queue){
|
||||
var obj = Downloadify.queue[queue];
|
||||
if(obj) return obj.getData();
|
||||
return "";
|
||||
},
|
||||
getFileNameForSave: function(queue){
|
||||
var obj = Downloadify.queue[queue];
|
||||
if(obj) return obj.getFilename();
|
||||
return "";
|
||||
},
|
||||
getDataTypeForSave: function(queue){
|
||||
var obj = Downloadify.queue[queue];
|
||||
if(obj) return obj.getDataType();
|
||||
return "";
|
||||
},
|
||||
saveComplete: function(queue){
|
||||
var obj = Downloadify.queue[queue];
|
||||
if(obj) obj.complete();
|
||||
return true;
|
||||
},
|
||||
saveCancel: function(queue){
|
||||
var obj = Downloadify.queue[queue];
|
||||
if(obj) obj.cancel();
|
||||
return true;
|
||||
},
|
||||
saveError: function(queue){
|
||||
var obj = Downloadify.queue[queue];
|
||||
if(obj) obj.error();
|
||||
return true;
|
||||
},
|
||||
addToQueue: function(container){
|
||||
Downloadify.queue[container.queue_name] = container;
|
||||
},
|
||||
// Concept adapted from: http://tinyurl.com/yzsyfto
|
||||
// SWF object runs off of ID's, so this is the good way to get a unique ID
|
||||
getUID: function(el){
|
||||
if(el.id == "") el.id = 'downloadify_' + Downloadify.uid++;
|
||||
return el.id;
|
||||
}
|
||||
};
|
||||
|
||||
Downloadify.create = function( idOrDOM, options ){
|
||||
var el = (typeof(idOrDOM) == "string" ? document.getElementById(idOrDOM) : idOrDOM );
|
||||
return new Downloadify.Container(el, options);
|
||||
};
|
||||
|
||||
Downloadify.Container = function(el, options){
|
||||
var base = this;
|
||||
|
||||
base.el = el;
|
||||
base.enabled = true;
|
||||
base.dataCallback = null;
|
||||
base.filenameCallback = null;
|
||||
base.data = null;
|
||||
base.filename = null;
|
||||
|
||||
var init = function(){
|
||||
base.options = options;
|
||||
|
||||
if( !base.options.append ) base.el.innerHTML = "";
|
||||
|
||||
base.flashContainer = document.createElement('span');
|
||||
base.el.appendChild(base.flashContainer);
|
||||
|
||||
base.queue_name = Downloadify.getUID( base.flashContainer );
|
||||
|
||||
if( typeof(base.options.filename) === "function" )
|
||||
base.filenameCallback = base.options.filename;
|
||||
else if (base.options.filename)
|
||||
base.filename = base.options.filename;
|
||||
|
||||
if( typeof(base.options.data) === "function" )
|
||||
base.dataCallback = base.options.data;
|
||||
else if (base.options.data)
|
||||
base.data = base.options.data;
|
||||
|
||||
|
||||
var flashVars = {
|
||||
queue_name: base.queue_name,
|
||||
width: base.options.width,
|
||||
height: base.options.height
|
||||
};
|
||||
|
||||
var params = {
|
||||
allowScriptAccess: 'always'
|
||||
};
|
||||
|
||||
var attributes = {
|
||||
id: base.flashContainer.id,
|
||||
name: base.flashContainer.id
|
||||
};
|
||||
|
||||
if(base.options.enabled === false) base.enabled = false;
|
||||
|
||||
if(base.options.transparent === true) params.wmode = "transparent";
|
||||
|
||||
if(base.options.downloadImage) flashVars.downloadImage = base.options.downloadImage;
|
||||
|
||||
swfobject.embedSWF(base.options.swf, base.flashContainer.id, base.options.width, base.options.height, "10", null, flashVars, params, attributes );
|
||||
|
||||
Downloadify.addToQueue( base );
|
||||
};
|
||||
|
||||
base.enable = function(){
|
||||
var swf = document.getElementById(base.flashContainer.id);
|
||||
swf.setEnabled(true);
|
||||
base.enabled = true;
|
||||
};
|
||||
|
||||
base.disable = function(){
|
||||
var swf = document.getElementById(base.flashContainer.id);
|
||||
swf.setEnabled(false);
|
||||
base.enabled = false;
|
||||
};
|
||||
|
||||
base.getData = function(){
|
||||
if( !base.enabled ) return "";
|
||||
if( base.dataCallback ) return base.dataCallback();
|
||||
else if (base.data) return base.data;
|
||||
else return "";
|
||||
};
|
||||
|
||||
base.getFilename = function(){
|
||||
if( base.filenameCallback ) return base.filenameCallback();
|
||||
else if (base.filename) return base.filename;
|
||||
else return "";
|
||||
};
|
||||
|
||||
base.getDataType = function(){
|
||||
if (base.options.dataType) return base.options.dataType;
|
||||
return "string";
|
||||
};
|
||||
|
||||
base.complete = function(){
|
||||
if( typeof(base.options.onComplete) === "function" ) base.options.onComplete();
|
||||
};
|
||||
|
||||
base.cancel = function(){
|
||||
if( typeof(base.options.onCancel) === "function" ) base.options.onCancel();
|
||||
};
|
||||
|
||||
base.error = function(){
|
||||
if( typeof(base.options.onError) === "function" ) base.options.onError();
|
||||
};
|
||||
|
||||
init();
|
||||
};
|
||||
|
||||
Downloadify.defaultOptions = {
|
||||
swf: 'media/downloadify.swf',
|
||||
downloadImage: 'images/download.png',
|
||||
width: 100,
|
||||
height: 30,
|
||||
transparent: true,
|
||||
append: false,
|
||||
dataType: "string"
|
||||
};
|
||||
})();
|
||||
|
||||
// Support for jQuery
|
||||
if(typeof(jQuery) != "undefined"){
|
||||
(function($){
|
||||
$.fn.downloadify = function(options){
|
||||
return this.each(function(){
|
||||
options = $.extend({}, Downloadify.defaultOptions, options);
|
||||
var dl = Downloadify.create( this, options);
|
||||
$(this).data('Downloadify', dl);
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
};
|
||||
|
||||
/* mootools helper */
|
||||
if(typeof(MooTools) != 'undefined'){
|
||||
Element.implement({
|
||||
downloadify: function(options) {
|
||||
options = $merge(Downloadify.defaultOptions,options);
|
||||
return this.store('Downloadify',Downloadify.create(this,options));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
84
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/test.html
generated
vendored
Normal file
84
WebRoot/node_modules/pdf/jsPDF-1.3.2/libs/Downloadify/test.html
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Downloadify</title>
|
||||
<style type="text/css" media="screen">
|
||||
body {background: #fff; width: 500px; margin: 20px auto;}
|
||||
label, input, textarea, h1, h2, p { font-family: Arial, sans-serif; font-size: 12pt;}
|
||||
input, textarea { border: solid 1px #aaa; padding: 4px; width: 98%;}
|
||||
label { font-weight: bold;}
|
||||
h1 { font-size: 30pt; font-weight: bold; letter-spacing: -1px;}
|
||||
h2 { font-size: 14pt;}
|
||||
pre { overflow: auto; padding: 10px; background: #222; color: #ccc;}
|
||||
</style>
|
||||
<script type="text/javascript" src="js/swfobject.js"></script>
|
||||
<script type="text/javascript" src="js/downloadify.min.js"></script>
|
||||
</head>
|
||||
<body onload="load();">
|
||||
<h1>Downloadify Example</h1>
|
||||
<p>More info available at the <a href="http://github.com/dcneiner/Downloadify">Github Project Page</a></p>
|
||||
<form>
|
||||
<p>
|
||||
<label for="filename">Filename</label><br />
|
||||
<input type="text" name="filename" value="testfile.txt" id="filename" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="data">File Contents</label><br />
|
||||
<textarea cols="60" rows="10" name="data" id="data">
|
||||
Whatever you put in this text box will be downloaded and saved in the file. If you leave it blank, no file will be downloaded</textarea>
|
||||
</p>
|
||||
<p id="downloadify">
|
||||
You must have Flash 10 installed to download this file.
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
function load(){
|
||||
Downloadify.create('downloadify',{
|
||||
filename: function(){
|
||||
return document.getElementById('filename').value;
|
||||
},
|
||||
data: function(){
|
||||
return document.getElementById('data').value;
|
||||
},
|
||||
onComplete: function(){ alert('Your File Has Been Saved!'); },
|
||||
onCancel: function(){ alert('You have cancelled the saving of this file.'); },
|
||||
onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); },
|
||||
swf: 'media/downloadify.swf',
|
||||
downloadImage: 'images/download.png',
|
||||
width: 100,
|
||||
height: 30,
|
||||
transparent: true,
|
||||
append: false
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<h2>Downloadify Invoke Script For This Page</h2>
|
||||
<pre>
|
||||
Downloadify.create('downloadify',{
|
||||
filename: function(){
|
||||
return document.getElementById('filename').value;
|
||||
},
|
||||
data: function(){
|
||||
return document.getElementById('data').value;
|
||||
},
|
||||
onComplete: function(){
|
||||
alert('Your File Has Been Saved!');
|
||||
},
|
||||
onCancel: function(){
|
||||
alert('You have cancelled the saving of this file.');
|
||||
},
|
||||
onError: function(){
|
||||
alert('You must put something in the File Contents or there will be nothing to save!');
|
||||
},
|
||||
swf: 'media/downloadify.swf',
|
||||
downloadImage: 'images/download.png',
|
||||
width: 100,
|
||||
height: 30,
|
||||
transparent: true,
|
||||
append: false
|
||||
});
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user