From a590528daa51f8c658b47fe47bd1268da8df152d Mon Sep 17 00:00:00 2001 From: Biblioklept <61851290+Biblioklept@users.noreply.github.com> Date: Wed, 3 May 2023 22:17:51 -0400 Subject: [PATCH] Just what you need to write. --- Rakefile | 39 - ...ionship Research by Christian R. Genco.pdf | Bin 9734 -> 0 bytes {built/apa => apa}/index.html | 0 apa_paper.md | 44 - browser.app.coffee | 45 - browser.markdowntoapa.coffee | 46 - built/index.html => index.html | 31 +- js/.DS_Store | Bin 6148 -> 0 bytes js/Blob.js/Blob.js | 177 - js/Blob.js/BlobBuilder.js | 161 - js/Blob.js/BlobBuilder.min.js | 2 - js/Blob.js/LICENSE.md | 30 - js/Blob.js/README.md | 9 - js/Deflate/adler32cs.js | 182 - js/Deflate/deflate.js | 2053 -- js/Downloadify/LICENSE.txt | 22 - js/Downloadify/README.textile | 113 - js/Downloadify/images/download.png | Bin 2500 -> 0 bytes js/Downloadify/js/downloadify.min.js | 3 - js/Downloadify/js/swfobject.js | 4 - js/Downloadify/media/downloadify.swf | Bin 2625 -> 0 bytes js/Downloadify/src/Downloadify.as | 173 - .../src/com/dynamicflash/util/Base64.as | 135 - .../com/dynamicflash/util/tests/Base64Test.as | 60 - js/Downloadify/src/downloadify.js | 213 - js/Downloadify/test.html | 84 - js/FileSaver.js/FileSaver.js | 217 - js/FileSaver.js/FileSaver.min.js | 2 - js/FileSaver.js/LICENSE.md | 30 - js/FileSaver.js/README.md | 69 - js/FileSaver.js/demo/demo.css | 55 - js/FileSaver.js/demo/demo.js | 212 - js/FileSaver.js/demo/demo.min.js | 2 - js/FileSaver.js/demo/index.xhtml | 68 - js/ace.js | 10 - js/ace.mode-markdown.js | 1 - js/ace.theme-github.js | 1 - js/ace.theme-monokai.js | 1 - js/ace.theme-solarized-light.js | 1 - js/ace.theme-textmate.js | 1 - js/coffeescript.js | 12 - js/jquery.js | 4 - js/markdowntoapa.js | 28212 --------------- js/markdowntomla.js | 28221 ---------------- license.md | 1 - markdowntoapa.coffee | 276 - markdowntomla.coffee | 299 - package.json | 54 - paper.md | 34 - template.html | 104 - template_markdowntoapa.html | 121 - todo.md | 6 - 52 files changed, 14 insertions(+), 61626 deletions(-) delete mode 100644 Rakefile delete mode 100644 Varying Definitions of Online Communication and Their Effects on Relationship Research by Christian R. Genco.pdf rename {built/apa => apa}/index.html (100%) delete mode 100644 apa_paper.md delete mode 100644 browser.app.coffee delete mode 100644 browser.markdowntoapa.coffee rename built/index.html => index.html (99%) delete mode 100644 js/.DS_Store delete mode 100644 js/Blob.js/Blob.js delete mode 100644 js/Blob.js/BlobBuilder.js delete mode 100644 js/Blob.js/BlobBuilder.min.js delete mode 100644 js/Blob.js/LICENSE.md delete mode 100644 js/Blob.js/README.md delete mode 100644 js/Deflate/adler32cs.js delete mode 100644 js/Deflate/deflate.js delete mode 100644 js/Downloadify/LICENSE.txt delete mode 100644 js/Downloadify/README.textile delete mode 100644 js/Downloadify/images/download.png delete mode 100644 js/Downloadify/js/downloadify.min.js delete mode 100644 js/Downloadify/js/swfobject.js delete mode 100644 js/Downloadify/media/downloadify.swf delete mode 100644 js/Downloadify/src/Downloadify.as delete mode 100755 js/Downloadify/src/com/dynamicflash/util/Base64.as delete mode 100755 js/Downloadify/src/com/dynamicflash/util/tests/Base64Test.as delete mode 100644 js/Downloadify/src/downloadify.js delete mode 100644 js/Downloadify/test.html delete mode 100644 js/FileSaver.js/FileSaver.js delete mode 100644 js/FileSaver.js/FileSaver.min.js delete mode 100644 js/FileSaver.js/LICENSE.md delete mode 100644 js/FileSaver.js/README.md delete mode 100644 js/FileSaver.js/demo/demo.css delete mode 100644 js/FileSaver.js/demo/demo.js delete mode 100644 js/FileSaver.js/demo/demo.min.js delete mode 100644 js/FileSaver.js/demo/index.xhtml delete mode 100644 js/ace.js delete mode 100644 js/ace.mode-markdown.js delete mode 100644 js/ace.theme-github.js delete mode 100644 js/ace.theme-monokai.js delete mode 100644 js/ace.theme-solarized-light.js delete mode 100644 js/ace.theme-textmate.js delete mode 100644 js/coffeescript.js delete mode 100644 js/jquery.js delete mode 100644 js/markdowntoapa.js delete mode 100644 js/markdowntomla.js delete mode 100644 license.md delete mode 100644 markdowntoapa.coffee delete mode 100644 markdowntomla.coffee delete mode 100644 package.json delete mode 100644 paper.md delete mode 100644 template.html delete mode 100644 template_markdowntoapa.html delete mode 100644 todo.md diff --git a/Rakefile b/Rakefile deleted file mode 100644 index a328100..0000000 --- a/Rakefile +++ /dev/null @@ -1,39 +0,0 @@ -require 'uglifier' - -task default: %w[build] - -task :build_mla do - puts "browserifying" - puts system("browserify -t coffeeify browser.app.coffee > js/markdowntomla.js") - - puts "building minified self-contained index.html" - html = File.read('template.html') - bundled = html.split("\n").map{|line| - if line =~ /\#{js}" - else - line - end - } - File.open('built/index.html', 'w'){|f| f.puts bundled} -end - -task :build_apa do - puts "browserifying" - puts system("browserify -t coffeeify browser.markdowntoapa.coffee > js/markdowntoapa.js") - - puts "building minified self-contained index.html" - html = File.read('template_markdowntoapa.html') - bundled = html.split("\n").map{|line| - if line =~ /\#{js}" - else - line - end - } - File.open('built/apa/index.html', 'w'){|f| f.puts bundled} -end \ No newline at end of file diff --git a/Varying Definitions of Online Communication and Their Effects on Relationship Research by Christian R. Genco.pdf b/Varying Definitions of Online Communication and Their Effects on Relationship Research by Christian R. Genco.pdf deleted file mode 100644 index 1ce32cbb1613194917265a1471ee8836bb88ed96..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9734 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 diff --git a/built/apa/index.html b/apa/index.html similarity index 100% rename from built/apa/index.html rename to apa/index.html diff --git a/apa_paper.md b/apa_paper.md deleted file mode 100644 index fc86de2..0000000 --- a/apa_paper.md +++ /dev/null @@ -1,44 +0,0 @@ -author: Christian R. Genco -institution: Southern Methodist University -title: Varying Definitions of Online Communication and\nTheir Effects on Relationship Research -runninghead: VARYING DEFINITIONS OF ONLINE COMMUNICATION -abstract: This paper explores four published articles that report on results from research conducted on online (Internet) and offline (non-Internet) relationships and their relationship to computer-mediated communication (CMC). The articles, however, vary in their definitions and uses of CMC. Butler and Kraut (2002) suggest that face-to-face (FtF) interactions are more effective than CMC, defined and used as “email,” in creating feelings of closeness or intimacy. Other articles define CMC differently and, therefore, offer different results. This paper examines Cummings, Butler, and Kraut’s (2002) research in relation to three other research articles to suggest that all forms of CMC should be studied in order to fully understand how CMC influences online and offline relationships. -keywords: computer-mediated communication, face-to-face communication - -Numerous studies have been conducted on various facets of Internet relationships, focusing on the levels of intimacy, closeness, different communication modalities, and the frequency of use of computer-mediated communication (CMC). However, contradictory results are suggested within this research because only certain aspects of CMC are investigated, for example, email only. Cummings, Butler, and Kraut (2002) suggest that face-to-face (FtF) interactions are more effective than CMC (read: email) in creating feelings of closeness or intimacy, while other studies suggest the opposite. To understand how both online (Internet) and offline (non-Internet) relationships are affected by CMC, all forms of CMC should be studied. This paper examines Cummings et al.’s research against other CMC research to propose that additional research be conducted to better understand how online communication affects relationships. - -# Literature Review - -In Cummings et al.’s (2002) summary article reviewing three empirical studies on online social relationships, it was found that CMC, especially email, was less effective than FtF contact in creating and maintaining close social relationships. Two of the three reviewed studies focusing on communication in non-Internet and Internet relationships mediated by FtF, phone, or email modalities found that the frequency of each modality’s use was significantly linked to the strength of the particular relationship (Cummings et al., 2002). The strength of the relationship was predicted best by FtF and phone communication, as participants rated email as an inferior means of maintaining personal relationships as compared to FtF and phone contacts (Cummings et al., 2002). - -Cummings et al. (2002) reviewed an additional study conducted in 1999 by the HomeNet project (see Appendix A for more information on the HomeNet project). In this project, Kraut, Mukhopadhyay, Szczypula, Kiesler, and Scherlis (1999) compared the value of using CMC and non-CMC to maintain relationships with partners. They found that participants corresponded less frequently with their Internet partner (5.2 times per month) than with their non-Internet partner (7.2 times per month) (as cited in Cummings et al., 2002). This difference does not seem significant, as it is only two times less per month. However, in additional self-report surveys, participants responded feeling more distant, or less intimate, towards their Internet partner than their nonInternet partner. This finding may be attributed to participants’ beliefs that email is an inferior mode of personal relationship communication. - -# Discussion - -In 2002, Cummings et al. stated that the evidence from their research conflicted with other data examining the effectiveness of online social relationships. This statement is supported by the aforementioned discussion of other research. There may be a few possible theoretical explanations for these discrepancies. - -## Limitations of These Studies - -The discrepancies identified may result from a number of limitations found in the materials reviewed by Cummings et al. These limitations can result from technological constraints, demographic factors, or issues of modality. Each of these limitations will be examined in further detail below. - -### Technological limitations. - -First, one reviewed study by Cummings et al. (2002) examined only email correspondence for their CMC modality. Therefore, the study is limited to only one mode of communication among other alternatives, e.g., IM as studied by Hu et al. (2004). Because of its many personalized features, IM provides more personal CMC. For example, it is in real time without delay, voice-chat and video features are available for many IM programs, and text boxes can be personalized with the user’s picture, favorite colors and text, and a wide variety of emoticons, e.g., :). These options allow for both an increase in self-expression and the ability to overcompensate for the barriers of CMC through customizable features, as stated in Tidwell and Walther - ---- - -# Conclusions and Future Study - -In order to gain a complete understanding of CMC’s true effect on both online and offline relationships, it is necessary to conduct a study that examines all aspects of CMC. This includes, but is not limited to, email, IM, voice-chat, video-chat, online journals and diaries, online social groups with message boards, and chat rooms. The effects on relationships of each modality may be different, and this is demonstrated by the discrepancies in intimacy between email and IM correspondence. As each mode of communication becomes more prevalent in individuals’ lives, it is important to examine the impact of all modes of CMC on online and offline relationship formation, maintenance, and even termination - ---- - -# References - -Cummings, J. N., Butler, B., & Kraut, R. (2002). The quality of online social relationships. *Communications of the ACM, 45*(7), 103-108. - -Hu, Y., Wood, J. F., Smith, V., & Westbrook, N. (2004). Friendships through IM: Examining the relationship between instant messaging and intimacy. *Journal of Computer-Mediated Communication, 10*, 38-48. - -Tidwell, L. C., & Walther, J. B. (2002). Computer-mediated communication effects on disclosure, impressions, and interpersonal evaluations: Getting to know one another a bit at a time. *Human Communication Research, 28*, 317-348. - -Underwood, H., & Findlay, B. (2004). Internet relationships and their impact on primary relationships. *Behaviour Change, 21*(2), 127-140. \ No newline at end of file diff --git a/browser.app.coffee b/browser.app.coffee deleted file mode 100644 index bd01c90..0000000 --- a/browser.app.coffee +++ /dev/null @@ -1,45 +0,0 @@ -# browserify -t coffeeify browser.app.coffee > js/markdowntomla.js - -window.markdowntomla = require('./markdowntomla.coffee') -window.md = require('markdown').markdown -window._ = require('underscore') -window.extractMetadata = markdowntomla.extractMetadata -window.createMLADocument = markdowntomla.createMLADocument -window.blobStream = require('blob-stream') - -window.editor = ace.edit("editor") -editor.setTheme("ace/theme/textmate") -editor.getSession().setMode("ace/mode/markdown") -editor.getSession().setUseWrapMode(true) -editor.renderer.setShowPrintMargin(false) - -# do we have anything saved? -if essay = localStorage?.getItem('essay') - editor.getSession().setValue(essay) - -refreshTimer = null -editor.getSession().on 'change', -> - clearTimeout(refreshTimer) - refreshTimer = setTimeout(-> - refresh() - localStorage?.setItem('essay', editor.getSession().getValue()) - , 1000) - -window.refresh = -> - stream = blobStream() - content = editor.getSession().getValue() - content = extractMetadata(content) - body = content.body - metadata = content.metadata - createMLADocument(body, metadata, stream) - stream.on 'finish', -> - # get a blob you can do whatever you like with - # blob = stream.toBlob('application/pdf') - - # or get a blob URL for display in the browser - url = stream.toBlobURL('application/pdf') - document.getElementById('preview').src = url - - document.title = "#{metadata.title} - MarkdownToMLA.com" - -refresh() \ No newline at end of file diff --git a/browser.markdowntoapa.coffee b/browser.markdowntoapa.coffee deleted file mode 100644 index eb9d685..0000000 --- a/browser.markdowntoapa.coffee +++ /dev/null @@ -1,46 +0,0 @@ -# browserify -t coffeeify browser.app.coffee > js/markdowntomla.js - -window.markdowntoapa = require('./markdowntoapa.coffee') -window.md = require('markdown').markdown -window._ = require('underscore') -window.extractMetadata = markdowntoapa.extractMetadata -window.createMLADocument = markdowntoapa.createAPADocument -window.blobStream = require('blob-stream') - -window.editor = ace.edit("editor") -editor.setTheme("ace/theme/textmate") -editor.getSession().setMode("ace/mode/markdown") -editor.getSession().setUseWrapMode(true) -editor.renderer.setShowPrintMargin(false) - -# do we have anything saved? -if essay = localStorage?.getItem('APA_paper') - editor.getSession().setValue(essay) - -refreshTimer = null -editor.getSession().on 'change', -> - clearTimeout(refreshTimer) - refreshTimer = setTimeout(-> - refresh() - localStorage?.setItem('APA_paper', editor.getSession().getValue()) - , 1000) - -window.refresh = -> - content = editor.getSession().getValue() - content = extractMetadata(content) - body = content.body - metadata = content.metadata - doc = createMLADocument(body, metadata) - stream = blobStream() - doc.pipe(stream) - stream.on 'finish', -> - # get a blob you can do whatever you like with - # blob = stream.toBlob('application/pdf') - - # or get a blob URL for display in the browser - url = stream.toBlobURL('application/pdf') - document.getElementById('preview').src = url - - document.title = "#{metadata.title} - MarkdownToAPA.com" - -refresh() \ No newline at end of file diff --git a/built/index.html b/index.html similarity index 99% rename from built/index.html rename to index.html index cd24d38..ccb6609 100644 --- a/built/index.html +++ b/index.html @@ -38,21 +38,23 @@
-author: Christian Genco
-instructor: Professor Elisa Farrell
-course: ENGL 1341
-date: 6 April 2015
-title: On MarkdownToMLA.com and the Human Condition
+author: YOUR NAME
+instructor: INSTRUCTOR NAME
+course: COURSE NAME
+date: DAY MONTH YEAR
+title: TITLE
 
-Hi! Welcome to MarkdownToMLA.com - a simple website with an even simpler purpose: making it less annoying to generate MLA-formatted documents and essays for school (or work, if you... write essays for work? Maybe you're an english teacher? I'm actually not sure if anyone actually uses MLA in the real world).
+This is an example of body text.
 
-The stuff on the left is editable, and automatically generates the PDF on the right, which can be downloaded and emailed to your teacher, or printed out, or whatever else you want to do with a PDF. Everything you write is automatically saved as soon as you pause typing, but it's still a good idea to copy and paste it somewhere else every once in a while as a backup. You can even use this website without being connected to the internet!
+This will be the bulk of how you're going to be writing.
 
-The special format on the left is called Markdown. You can easily make things *italic* and **bold**, as well as quote important people:
+Perform *italics* and **bolds** like so.
+
+Here's how you quote.
 
 > Writing MLA-formatted essays is much easier with markdowntomla.com. I use it all the time when I write essays to foreign dictators, as well as to my wife when I need her to pick up something from the store on the way home (we're a very formal family). (Obama)
 
-Some teachers don't like you to use subheadings in a paper, but here's the standard way of doing that:
+Subheadings:
 
 # Heading 1
 
@@ -64,25 +66,20 @@ Some teachers don't like you to use subheadings in a paper, but here's the stand
 
 ##### Heading 5
 
-Need a page break? Just type three dashes on an empty line.
+Page Break
 
 ---
 
-Whoa, so much more room on this page. There's two things left to cover: the special **author**, **instructor**, **course**, **date**, and **title** section at the top; and the work's cited page. The former is used for the MLA heading, numbering the pages, and naming your downloaded PDF. The later is pretty self explanatory (look at the markdown source code at the bottom of this essay).
+The special **author**, **instructor**, **course**, **date**, and **title** section at the top; and the work's cited page. The former is used for the MLA heading, numbering the pages, and naming your downloaded PDF. The later is pretty self explanatory (look at the markdown source code at the bottom of this essay).
 
 For help generating those citations, check out easybib.com, bibme.org, and citationmachine.net. Be careful citing Wikipedia, but there's also a handy "cite this page" button on every page.
 
-If you have any suggestions or feedback for how this can be improved, send me a tweet @cgenco or contact me through my website at http://christian.gen.co (I also have a talk on there about how to go to college for free). Have fun writing essays :D
-
 ---
 
 # Works Cited
 
-Egan, Greg. *Permutation City*. New York: HarperPrism, 1994. Print.
+ [Christian Genco's Markdown to MLA](https://github.com/christiangenco/markdowntomla)
 
-Rowling, J. K., and Mary GrandPre. *Harry Potter and the Chamber of Secrets*. New York: Arthur A. Levine, 1999. Print.
-
-Wikipedia contributors. "Hacker News." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 18 Mar. 2015. Web. 7 Apr. 2015.
 
diff --git a/js/.DS_Store b/js/.DS_Store deleted file mode 100644 index a180303143ade98ca5fee638577719f2c74eca05..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5T4aS#flUW^q40Q3SNa+qIfAD`U3q){UbHSwu-mhd9}j)VW8=Wux6shazF~@EBdqW|3r7ifBL=D6>lw8hCY>)}CbXJn}l;p3aA^jyaF7I?6n}I!uRy z)KEuC4|FSpbt$H6RQ2f9L$AB#p0jneJ~(7q%wd|>x7^dOleco(qEl3sfU`Cjy9eGC zUv897aRFLan$wA0B*X2fxs zjXR+j$qsuU?qouXs+9p{z-M6H-qyMQpOl~f{YiSK3@8KtiUCuJ+EEira=o>%IPSFp rMhAn1{W6O(1 1 ? end : this.data.length) - , type - , this.encoding - ); - }; - FB_proto.toString = function() { - return "[object Blob]"; - }; - return FakeBlobBuilder; - }(view)); - - return function Blob(blobParts, options) { - var type = options ? (options.type || "") : ""; - var builder = new BlobBuilder(); - if (blobParts) { - for (var i = 0, len = blobParts.length; i < len; i++) { - builder.append(blobParts[i]); - } - } - return builder.getBlob(type); - }; -}(self)); diff --git a/js/Blob.js/BlobBuilder.js b/js/Blob.js/BlobBuilder.js deleted file mode 100644 index 8fc4e87..0000000 --- a/js/Blob.js/BlobBuilder.js +++ /dev/null @@ -1,161 +0,0 @@ -/* BlobBuilder.js - * A BlobBuilder implementation. - * 2012-04-21 - * - * By Eli Grey, http://eligrey.com - * License: X11/MIT - * See LICENSE.md - */ - -/*global self, unescape */ -/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, - plusplus: true */ - -/*! @source http://purl.eligrey.com/github/BlobBuilder.js/blob/master/BlobBuilder.js */ - -var BlobBuilder = BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder || (function(view) { -"use strict"; -var - get_class = function(object) { - return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1]; - } - , FakeBlobBuilder = function(){ - this.data = []; - } - , FakeBlob = function(data, type, encoding) { - this.data = data; - this.size = data.length; - this.type = type; - this.encoding = encoding; - } - , FBB_proto = FakeBlobBuilder.prototype - , FB_proto = FakeBlob.prototype - , FileReaderSync = view.FileReaderSync - , FileException = function(type) { - this.code = this[this.name = type]; - } - , file_ex_codes = ( - "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR " - + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR" - ).split(" ") - , file_ex_code = file_ex_codes.length - , real_URL = view.URL || view.webkitURL || view - , real_create_object_URL = real_URL.createObjectURL - , real_revoke_object_URL = real_URL.revokeObjectURL - , URL = real_URL - , btoa = view.btoa - , atob = view.atob - , can_apply_typed_arrays = false - , can_apply_typed_arrays_test = function(pass) { - can_apply_typed_arrays = !pass; - } - - , ArrayBuffer = view.ArrayBuffer - , Uint8Array = view.Uint8Array -; -FakeBlobBuilder.fake = FB_proto.fake = true; -while (file_ex_code--) { - FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1; -} -try { - if (Uint8Array) { - can_apply_typed_arrays_test.apply(0, new Uint8Array(1)); - } -} catch (ex) {} -if (!real_URL.createObjectURL) { - URL = view.URL = {}; -} -URL.createObjectURL = function(blob) { - var - type = blob.type - , data_URI_header - ; - if (type === null) { - type = "application/octet-stream"; - } - if (blob instanceof FakeBlob) { - data_URI_header = "data:" + type; - if (blob.encoding === "base64") { - return data_URI_header + ";base64," + blob.data; - } else if (blob.encoding === "URI") { - return data_URI_header + "," + decodeURIComponent(blob.data); - } if (btoa) { - return data_URI_header + ";base64," + btoa(blob.data); - } else { - return data_URI_header + "," + encodeURIComponent(blob.data); - } - } else if (real_create_object_URL) { - return real_create_object_URL.call(real_URL, blob); - } -}; -URL.revokeObjectURL = function(object_URL) { - if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) { - real_revoke_object_URL.call(real_URL, object_URL); - } -}; -FBB_proto.append = function(data/*, endings*/) { - var bb = this.data; - // decode data to a binary string - if (Uint8Array && data instanceof ArrayBuffer) { - if (can_apply_typed_arrays) { - bb.push(String.fromCharCode.apply(String, new Uint8Array(data))); - } else { - var - str = "" - , buf = new Uint8Array(data) - , i = 0 - , buf_len = buf.length - ; - for (; i < buf_len; i++) { - str += String.fromCharCode(buf[i]); - } - } - } else if (get_class(data) === "Blob" || get_class(data) === "File") { - if (FileReaderSync) { - var fr = new FileReaderSync; - bb.push(fr.readAsBinaryString(data)); - } else { - // async FileReader won't work as BlobBuilder is sync - throw new FileException("NOT_READABLE_ERR"); - } - } else if (data instanceof FakeBlob) { - if (data.encoding === "base64" && atob) { - bb.push(atob(data.data)); - } else if (data.encoding === "URI") { - bb.push(decodeURIComponent(data.data)); - } else if (data.encoding === "raw") { - bb.push(data.data); - } - } else { - if (typeof data !== "string") { - data += ""; // convert unsupported types to strings - } - // decode UTF-16 to binary string - bb.push(unescape(encodeURIComponent(data))); - } -}; -FBB_proto.getBlob = function(type) { - if (!arguments.length) { - type = null; - } - return new FakeBlob(this.data.join(""), type, "raw"); -}; -FBB_proto.toString = function() { - return "[object BlobBuilder]"; -}; -FB_proto.slice = function(start, end, type) { - var args = arguments.length; - if (args < 3) { - type = null; - } - return new FakeBlob( - this.data.slice(start, args > 1 ? end : this.data.length) - , type - , this.encoding - ); -}; -FB_proto.toString = function() { - return "[object Blob]"; -}; -return FakeBlobBuilder; -}(self)); diff --git a/js/Blob.js/BlobBuilder.min.js b/js/Blob.js/BlobBuilder.min.js deleted file mode 100644 index bcd2a9e..0000000 --- a/js/Blob.js/BlobBuilder.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @source http://purl.eligrey.com/github/BlobBuilder.js/blob/master/BlobBuilder.js */ -var BlobBuilder=BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||(function(j){"use strict";var c=function(v){return Object.prototype.toString.call(v).match(/^\[object\s(.*)\]$/)[1]},u=function(){this.data=[]},t=function(x,v,w){this.data=x;this.size=x.length;this.type=v;this.encoding=w},k=u.prototype,s=t.prototype,n=j.FileReaderSync,a=function(v){this.code=this[this.name=v]},l=("NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR").split(" "),r=l.length,o=j.URL||j.webkitURL||j,p=o.createObjectURL,b=o.revokeObjectURL,e=o,i=j.btoa,f=j.atob,m=false,h=function(v){m=!v},d=j.ArrayBuffer,g=j.Uint8Array;u.fake=s.fake=true;while(r--){a.prototype[l[r]]=r+1}try{if(g){h.apply(0,new g(1))}}catch(q){}if(!o.createObjectURL){e=j.URL={}}e.createObjectURL=function(w){var x=w.type,v;if(x===null){x="application/octet-stream"}if(w instanceof t){v="data:"+x;if(w.encoding==="base64"){return v+";base64,"+w.data}else{if(w.encoding==="URI"){return v+","+decodeURIComponent(w.data)}}if(i){return v+";base64,"+i(w.data)}else{return v+","+encodeURIComponent(w.data)}}else{if(real_create_object_url){return real_create_object_url.call(o,w)}}};e.revokeObjectURL=function(v){if(v.substring(0,5)!=="data:"&&real_revoke_object_url){real_revoke_object_url.call(o,v)}};k.append=function(z){var B=this.data;if(g&&z instanceof d){if(m){B.push(String.fromCharCode.apply(String,new g(z)))}else{var A="",w=new g(z),x=0,y=w.length;for(;x1?v:this.data.length),x,this.encoding)};s.toString=function(){return"[object Blob]"};return u}(self)); \ No newline at end of file diff --git a/js/Blob.js/LICENSE.md b/js/Blob.js/LICENSE.md deleted file mode 100644 index 7eb56b9..0000000 --- a/js/Blob.js/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/js/Blob.js/README.md b/js/Blob.js/README.md deleted file mode 100644 index 789e891..0000000 --- a/js/Blob.js/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Blob.js -============== - -Blob.js implements the W3C [`Blob`][1] interface in browsers that do -not natively support it. - -![Tracking image](https://in.getclicky.com/212712ns.gif) - - [1]: http://www.w3.org/TR/FileAPI/#blob diff --git a/js/Deflate/adler32cs.js b/js/Deflate/adler32cs.js deleted file mode 100644 index a1e7137..0000000 --- a/js/Deflate/adler32cs.js +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2012 chick307 - * - * Licensed under the MIT License. - * http://opensource.org/licenses/mit-license - */ - -void function(global, callback) { - if (typeof module === 'object') { - module.exports = callback(); - } else if (typeof define === 'function') { - define(callback); - } else { - global.adler32cs = callback(); - } -}(this, function() { - var _hasArrayBuffer = typeof ArrayBuffer === 'function' && - typeof Uint8Array === 'function'; - - var _Buffer = null, _isBuffer = (function() { - if (!_hasArrayBuffer) - return function _isBuffer() { return false }; - - try { - var buffer = require('buffer'); - if (typeof buffer.Buffer === 'function') - _Buffer = buffer.Buffer; - } catch (error) {} - - return function _isBuffer(value) { - return value instanceof ArrayBuffer || - _Buffer !== null && value instanceof _Buffer; - }; - }()); - - var _utf8ToBinary = (function() { - if (_Buffer !== null) { - return function _utf8ToBinary(utf8String) { - return new _Buffer(utf8String, 'utf8').toString('binary'); - }; - } else { - return function _utf8ToBinary(utf8String) { - return unescape(encodeURIComponent(utf8String)); - }; - } - }()); - - var MOD = 65521; - - var _update = function _update(checksum, binaryString) { - var a = checksum & 0xFFFF, b = checksum >>> 16; - for (var i = 0, length = binaryString.length; i < length; i++) { - a = (a + (binaryString.charCodeAt(i) & 0xFF)) % MOD; - b = (b + a) % MOD; - } - return (b << 16 | a) >>> 0; - }; - - var _updateUint8Array = function _updateUint8Array(checksum, uint8Array) { - var a = checksum & 0xFFFF, b = checksum >>> 16; - for (var i = 0, length = uint8Array.length, x; i < length; i++) { - a = (a + uint8Array[i]) % MOD; - b = (b + a) % MOD; - } - return (b << 16 | a) >>> 0 - }; - - var exports = {}; - - var Adler32 = exports.Adler32 = (function() { - var ctor = function Adler32(checksum) { - if (!(this instanceof ctor)) { - throw new TypeError( - 'Constructor cannot called be as a function.'); - } - if (!isFinite(checksum = checksum == null ? 1 : +checksum)) { - throw new Error( - 'First arguments needs to be a finite number.'); - } - this.checksum = checksum >>> 0; - }; - - var proto = ctor.prototype = {}; - proto.constructor = ctor; - - ctor.from = function(from) { - from.prototype = proto; - return from; - }(function from(binaryString) { - if (!(this instanceof ctor)) { - throw new TypeError( - 'Constructor cannot called be as a function.'); - } - if (binaryString == null) - throw new Error('First argument needs to be a string.'); - this.checksum = _update(1, binaryString.toString()); - }); - - ctor.fromUtf8 = function(fromUtf8) { - fromUtf8.prototype = proto; - return fromUtf8; - }(function fromUtf8(utf8String) { - if (!(this instanceof ctor)) { - throw new TypeError( - 'Constructor cannot called be as a function.'); - } - if (utf8String == null) - throw new Error('First argument needs to be a string.'); - var binaryString = _utf8ToBinary(utf8String.toString()); - this.checksum = _update(1, binaryString); - }); - - if (_hasArrayBuffer) { - ctor.fromBuffer = function(fromBuffer) { - fromBuffer.prototype = proto; - return fromBuffer; - }(function fromBuffer(buffer) { - if (!(this instanceof ctor)) { - throw new TypeError( - 'Constructor cannot called be as a function.'); - } - if (!_isBuffer(buffer)) - throw new Error('First argument needs to be ArrayBuffer.'); - var array = new Uint8Array(buffer); - return this.checksum = _updateUint8Array(1, array); - }); - } - - proto.update = function update(binaryString) { - if (binaryString == null) - throw new Error('First argument needs to be a string.'); - binaryString = binaryString.toString(); - return this.checksum = _update(this.checksum, binaryString); - }; - - proto.updateUtf8 = function updateUtf8(utf8String) { - if (utf8String == null) - throw new Error('First argument needs to be a string.'); - var binaryString = _utf8ToBinary(utf8String.toString()); - return this.checksum = _update(this.checksum, binaryString); - }; - - if (_hasArrayBuffer) { - proto.updateBuffer = function updateBuffer(buffer) { - if (!_isBuffer(buffer)) - throw new Error('First argument needs to be ArrayBuffer.'); - var array = new Uint8Array(buffer); - return this.checksum = _updateUint8Array(this.checksum, array); - }; - } - - proto.clone = function clone() { - return new Adler32(this.checksum); - }; - - return ctor; - }()); - - exports.from = function from(binaryString) { - if (binaryString == null) - throw new Error('First argument needs to be a string.'); - return _update(1, binaryString.toString()); - }; - - exports.fromUtf8 = function fromUtf8(utf8String) { - if (utf8String == null) - throw new Error('First argument needs to be a string.'); - var binaryString = _utf8ToBinary(utf8String.toString()); - return _update(1, binaryString); - }; - - if (_hasArrayBuffer) { - exports.fromBuffer = function fromBuffer(buffer) { - if (!_isBuffer(buffer)) - throw new Error('First argument need to be ArrayBuffer.'); - var array = new Uint8Array(buffer); - return _updateUint8Array(1, array); - }; - } - - return exports; -}); diff --git a/js/Deflate/deflate.js b/js/Deflate/deflate.js deleted file mode 100644 index b33d165..0000000 --- a/js/Deflate/deflate.js +++ /dev/null @@ -1,2053 +0,0 @@ -/* - Copyright (c) 2013 Gildas Lormeau. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the distribution. - - 3. The names of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, - INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This program is based on JZlib 1.0.2 ymnk, JCraft,Inc. - * JZlib is based on zlib-1.1.3, so all credit should go authors - * Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu) - * and contributors of zlib. - */ - -// Global - -var MAX_BITS = 15; -var D_CODES = 30; -var BL_CODES = 19; - -var LENGTH_CODES = 29; -var LITERALS = 256; -var L_CODES = (LITERALS + 1 + LENGTH_CODES); -var HEAP_SIZE = (2 * L_CODES + 1); - -var END_BLOCK = 256; - -// Bit length codes must not exceed MAX_BL_BITS bits -var MAX_BL_BITS = 7; - -// repeat previous bit length 3-6 times (2 bits of repeat count) -var REP_3_6 = 16; - -// repeat a zero length 3-10 times (3 bits of repeat count) -var REPZ_3_10 = 17; - -// repeat a zero length 11-138 times (7 bits of repeat count) -var REPZ_11_138 = 18; - -// The lengths of the bit length codes are sent in order of decreasing -// probability, to avoid transmitting the lengths for unused bit -// length codes. - -var Buf_size = 8 * 2; - -// JZlib version : "1.0.2" -var Z_DEFAULT_COMPRESSION = -1; - -// compression strategy -var Z_FILTERED = 1; -var Z_HUFFMAN_ONLY = 2; -var Z_DEFAULT_STRATEGY = 0; - -var Z_NO_FLUSH = 0; -var Z_PARTIAL_FLUSH = 1; -var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; - -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_NEED_DICT = 2; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -var Z_BUF_ERROR = -5; - -// Tree - -// see definition of array dist_code below -var _dist_code = [ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19, - 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 ]; - -function Tree() { - 'use strict'; - var that = this; - - // dyn_tree; // the dynamic tree - // max_code; // largest code with non zero frequency - // stat_desc; // the corresponding static tree - - // Compute the optimal bit lengths for a tree and update the total bit - // length - // for the current block. - // IN assertion: the fields freq and dad are set, heap[heap_max] and - // above are the tree nodes sorted by increasing frequency. - // OUT assertions: the field len is set to the optimal bit length, the - // array bl_count contains the frequencies for each bit length. - // The length opt_len is updated; static_len is also updated if stree is - // not null. - function gen_bitlen(s) { - var tree = that.dyn_tree; - var stree = that.stat_desc.static_tree; - var extra = that.stat_desc.extra_bits; - var base = that.stat_desc.extra_base; - var max_length = that.stat_desc.max_length; - var h; // heap index - var n, m; // iterate over the tree elements - var bits; // bit length - var xbits; // extra bits - var f; // frequency - var overflow = 0; // number of elements with bit length too large - - for (bits = 0; bits <= MAX_BITS; bits++) - s.bl_count[bits] = 0; - - // In a first pass, compute the optimal bit lengths (which may - // overflow in the case of the bit length tree). - tree[s.heap[s.heap_max] * 2 + 1] = 0; // root of the heap - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1] * 2 + 1] + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1] = bits; - // We overwrite tree[n*2+1] which is no longer needed - - if (n > that.max_code) - continue; // not a leaf node - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) - xbits = extra[n - base]; - f = tree[n * 2]; - s.opt_len += f * (bits + xbits); - if (stree) - s.static_len += f * (stree[n * 2 + 1] + xbits); - } - if (overflow === 0) - return; - - // This happens for example on obj2 and pic of the Calgary corpus - // Find the first bit length which could increase: - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) - bits--; - s.bl_count[bits]--; // move one leaf down the tree - s.bl_count[bits + 1] += 2; // move one overflow item as its brother - s.bl_count[max_length]--; - // The brother of the overflow item also moves one step up, - // but this does not affect bl_count[max_length] - overflow -= 2; - } while (overflow > 0); - - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > that.max_code) - continue; - if (tree[m * 2 + 1] != bits) { - s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2]; - tree[m * 2 + 1] = bits; - } - n--; - } - } - } - - // Reverse the first len bits of a code, using straightforward code (a - // faster - // method would use a table) - // IN assertion: 1 <= len <= 15 - function bi_reverse(code, // the value to invert - len // its bit length - ) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; - } - - // Generate the codes for a given tree and bit counts (which need not be - // optimal). - // IN assertion: the array bl_count contains the bit length statistics for - // the given tree and the field len is set for all tree elements. - // OUT assertion: the field code is set for all tree elements of non - // zero code length. - function gen_codes(tree, // the tree to decorate - max_code, // largest code with non zero frequency - bl_count // number of codes at each bit length - ) { - var next_code = []; // next code value for each - // bit length - var code = 0; // running code value - var bits; // bit index - var n; // code index - var len; - - // The distribution counts are first used to generate the code values - // without bit reversal. - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = ((code + bl_count[bits - 1]) << 1); - } - - // Check that the bit counts in bl_count are consistent. The last code - // must be all ones. - // Assert (code + bl_count[MAX_BITS]-1 == (1<= 1; n--) - s.pqdownheap(tree, n); - - // Construct the Huffman tree by repeatedly combining the least two - // frequent nodes. - - node = elems; // next internal node of the tree - do { - // n = node of least frequency - n = s.heap[1]; - s.heap[1] = s.heap[s.heap_len--]; - s.pqdownheap(tree, 1); - m = s.heap[1]; // m = node of next least frequency - - s.heap[--s.heap_max] = n; // keep the nodes sorted by frequency - s.heap[--s.heap_max] = m; - - // Create a new node father of n and m - tree[node * 2] = (tree[n * 2] + tree[m * 2]); - s.depth[node] = Math.max(s.depth[n], s.depth[m]) + 1; - tree[n * 2 + 1] = tree[m * 2 + 1] = node; - - // and insert the new node in the heap - s.heap[1] = node++; - s.pqdownheap(tree, 1); - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1]; - - // At this point, the fields freq and dad are set. We can now - // generate the bit lengths. - - gen_bitlen(s); - - // The field len is now set, we can generate the bit codes - gen_codes(tree, that.max_code, s.bl_count); - }; - -} - -Tree._length_code = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, - 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 ]; - -Tree.base_length = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 ]; - -Tree.base_dist = [ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, - 24576 ]; - -// Mapping from a distance to a distance code. dist is the distance - 1 and -// must not have side effects. _dist_code[256] and _dist_code[257] are never -// used. -Tree.d_code = function(dist) { - return ((dist) < 256 ? _dist_code[dist] : _dist_code[256 + ((dist) >>> 7)]); -}; - -// extra bits for each length code -Tree.extra_lbits = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 ]; - -// extra bits for each distance code -Tree.extra_dbits = [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 ]; - -// extra bits for each bit length code -Tree.extra_blbits = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 ]; - -Tree.bl_order = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; - -// StaticTree - -function StaticTree(static_tree, extra_bits, extra_base, elems, max_length) { - var that = this; - that.static_tree = static_tree; - that.extra_bits = extra_bits; - that.extra_base = extra_base; - that.elems = elems; - that.max_length = max_length; -} - -StaticTree.static_ltree = [ 12, 8, 140, 8, 76, 8, 204, 8, 44, 8, 172, 8, 108, 8, 236, 8, 28, 8, 156, 8, 92, 8, 220, 8, 60, 8, 188, 8, 124, 8, 252, 8, 2, 8, - 130, 8, 66, 8, 194, 8, 34, 8, 162, 8, 98, 8, 226, 8, 18, 8, 146, 8, 82, 8, 210, 8, 50, 8, 178, 8, 114, 8, 242, 8, 10, 8, 138, 8, 74, 8, 202, 8, 42, - 8, 170, 8, 106, 8, 234, 8, 26, 8, 154, 8, 90, 8, 218, 8, 58, 8, 186, 8, 122, 8, 250, 8, 6, 8, 134, 8, 70, 8, 198, 8, 38, 8, 166, 8, 102, 8, 230, 8, - 22, 8, 150, 8, 86, 8, 214, 8, 54, 8, 182, 8, 118, 8, 246, 8, 14, 8, 142, 8, 78, 8, 206, 8, 46, 8, 174, 8, 110, 8, 238, 8, 30, 8, 158, 8, 94, 8, - 222, 8, 62, 8, 190, 8, 126, 8, 254, 8, 1, 8, 129, 8, 65, 8, 193, 8, 33, 8, 161, 8, 97, 8, 225, 8, 17, 8, 145, 8, 81, 8, 209, 8, 49, 8, 177, 8, 113, - 8, 241, 8, 9, 8, 137, 8, 73, 8, 201, 8, 41, 8, 169, 8, 105, 8, 233, 8, 25, 8, 153, 8, 89, 8, 217, 8, 57, 8, 185, 8, 121, 8, 249, 8, 5, 8, 133, 8, - 69, 8, 197, 8, 37, 8, 165, 8, 101, 8, 229, 8, 21, 8, 149, 8, 85, 8, 213, 8, 53, 8, 181, 8, 117, 8, 245, 8, 13, 8, 141, 8, 77, 8, 205, 8, 45, 8, - 173, 8, 109, 8, 237, 8, 29, 8, 157, 8, 93, 8, 221, 8, 61, 8, 189, 8, 125, 8, 253, 8, 19, 9, 275, 9, 147, 9, 403, 9, 83, 9, 339, 9, 211, 9, 467, 9, - 51, 9, 307, 9, 179, 9, 435, 9, 115, 9, 371, 9, 243, 9, 499, 9, 11, 9, 267, 9, 139, 9, 395, 9, 75, 9, 331, 9, 203, 9, 459, 9, 43, 9, 299, 9, 171, 9, - 427, 9, 107, 9, 363, 9, 235, 9, 491, 9, 27, 9, 283, 9, 155, 9, 411, 9, 91, 9, 347, 9, 219, 9, 475, 9, 59, 9, 315, 9, 187, 9, 443, 9, 123, 9, 379, - 9, 251, 9, 507, 9, 7, 9, 263, 9, 135, 9, 391, 9, 71, 9, 327, 9, 199, 9, 455, 9, 39, 9, 295, 9, 167, 9, 423, 9, 103, 9, 359, 9, 231, 9, 487, 9, 23, - 9, 279, 9, 151, 9, 407, 9, 87, 9, 343, 9, 215, 9, 471, 9, 55, 9, 311, 9, 183, 9, 439, 9, 119, 9, 375, 9, 247, 9, 503, 9, 15, 9, 271, 9, 143, 9, - 399, 9, 79, 9, 335, 9, 207, 9, 463, 9, 47, 9, 303, 9, 175, 9, 431, 9, 111, 9, 367, 9, 239, 9, 495, 9, 31, 9, 287, 9, 159, 9, 415, 9, 95, 9, 351, 9, - 223, 9, 479, 9, 63, 9, 319, 9, 191, 9, 447, 9, 127, 9, 383, 9, 255, 9, 511, 9, 0, 7, 64, 7, 32, 7, 96, 7, 16, 7, 80, 7, 48, 7, 112, 7, 8, 7, 72, 7, - 40, 7, 104, 7, 24, 7, 88, 7, 56, 7, 120, 7, 4, 7, 68, 7, 36, 7, 100, 7, 20, 7, 84, 7, 52, 7, 116, 7, 3, 8, 131, 8, 67, 8, 195, 8, 35, 8, 163, 8, - 99, 8, 227, 8 ]; - -StaticTree.static_dtree = [ 0, 5, 16, 5, 8, 5, 24, 5, 4, 5, 20, 5, 12, 5, 28, 5, 2, 5, 18, 5, 10, 5, 26, 5, 6, 5, 22, 5, 14, 5, 30, 5, 1, 5, 17, 5, 9, 5, - 25, 5, 5, 5, 21, 5, 13, 5, 29, 5, 3, 5, 19, 5, 11, 5, 27, 5, 7, 5, 23, 5 ]; - -StaticTree.static_l_desc = new StaticTree(StaticTree.static_ltree, Tree.extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - -StaticTree.static_d_desc = new StaticTree(StaticTree.static_dtree, Tree.extra_dbits, 0, D_CODES, MAX_BITS); - -StaticTree.static_bl_desc = new StaticTree(null, Tree.extra_blbits, 0, BL_CODES, MAX_BL_BITS); - -// Deflate - -var MAX_MEM_LEVEL = 9; -var DEF_MEM_LEVEL = 8; - -function Config(good_length, max_lazy, nice_length, max_chain, func) { - var that = this; - that.good_length = good_length; - that.max_lazy = max_lazy; - that.nice_length = nice_length; - that.max_chain = max_chain; - that.func = func; -} - -var STORED = 0; -var FAST = 1; -var SLOW = 2; -var config_table = [ new Config(0, 0, 0, 0, STORED), new Config(4, 4, 8, 4, FAST), new Config(4, 5, 16, 8, FAST), new Config(4, 6, 32, 32, FAST), - new Config(4, 4, 16, 16, SLOW), new Config(8, 16, 32, 32, SLOW), new Config(8, 16, 128, 128, SLOW), new Config(8, 32, 128, 256, SLOW), - new Config(32, 128, 258, 1024, SLOW), new Config(32, 258, 258, 4096, SLOW) ]; - -var z_errmsg = [ "need dictionary", // Z_NEED_DICT -// 2 -"stream end", // Z_STREAM_END 1 -"", // Z_OK 0 -"", // Z_ERRNO (-1) -"stream error", // Z_STREAM_ERROR (-2) -"data error", // Z_DATA_ERROR (-3) -"", // Z_MEM_ERROR (-4) -"buffer error", // Z_BUF_ERROR (-5) -"",// Z_VERSION_ERROR (-6) -"" ]; - -// block not completed, need more input or more output -var NeedMore = 0; - -// block flush performed -var BlockDone = 1; - -// finish started, need only more output at next deflate -var FinishStarted = 2; - -// finish done, accept no more input or output -var FinishDone = 3; - -// preset dictionary flag in zlib header -var PRESET_DICT = 0x20; - -var INIT_STATE = 42; -var BUSY_STATE = 113; -var FINISH_STATE = 666; - -// The deflate compression method -var Z_DEFLATED = 8; - -var STORED_BLOCK = 0; -var STATIC_TREES = 1; -var DYN_TREES = 2; - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - -function smaller(tree, n, m, depth) { - var tn2 = tree[n * 2]; - var tm2 = tree[m * 2]; - return (tn2 < tm2 || (tn2 == tm2 && depth[n] <= depth[m])); -} - -function Deflate() { - - var that = this; - var strm; // pointer back to this zlib stream - var status; // as the name implies - // pending_buf; // output still pending - var pending_buf_size; // size of pending_buf - // pending_out; // next pending byte to output to the stream - // pending; // nb of bytes in the pending buffer - var method; // STORED (for zip only) or DEFLATED - var last_flush; // value of flush param for previous deflate call - - var w_size; // LZ77 window size (32K by default) - var w_bits; // log2(w_size) (8..16) - var w_mask; // w_size - 1 - - var window; - // Sliding window. Input bytes are read into the second half of the window, - // and move to the first half later to keep a dictionary of at least wSize - // bytes. With this organization, matches are limited to a distance of - // wSize-MAX_MATCH bytes, but this ensures that IO is always - // performed with a length multiple of the block size. Also, it limits - // the window size to 64K, which is quite useful on MSDOS. - // To do: use the user input buffer as sliding window. - - var window_size; - // Actual size of window: 2*wSize, except when the user input buffer - // is directly used as sliding window. - - var prev; - // Link to older string with same hash index. To limit the size of this - // array to 64K, this link is maintained only for the last 32K strings. - // An index in this array is thus a window index modulo 32K. - - var head; // Heads of the hash chains or NIL. - - var ins_h; // hash index of string to be inserted - var hash_size; // number of elements in hash table - var hash_bits; // log2(hash_size) - var hash_mask; // hash_size-1 - - // Number of bits by which ins_h must be shifted at each input - // step. It must be such that after MIN_MATCH steps, the oldest - // byte no longer takes part in the hash key, that is: - // hash_shift * MIN_MATCH >= hash_bits - var hash_shift; - - // Window position at the beginning of the current output block. Gets - // negative when the window is moved backwards. - - var block_start; - - var match_length; // length of best match - var prev_match; // previous match - var match_available; // set if previous match exists - var strstart; // start of string to insert - var match_start; // start of matching string - var lookahead; // number of valid bytes ahead in window - - // Length of the best match at previous step. Matches not greater than this - // are discarded. This is used in the lazy match evaluation. - var prev_length; - - // To speed up deflation, hash chains are never searched beyond this - // length. A higher limit improves compression ratio but degrades the speed. - var max_chain_length; - - // Attempt to find a better match only when the current match is strictly - // smaller than this value. This mechanism is used only for compression - // levels >= 4. - var max_lazy_match; - - // Insert new strings in the hash table only if the match length is not - // greater than this length. This saves time but degrades compression. - // max_insert_length is used only for compression levels <= 3. - - var level; // compression level (1..9) - var strategy; // favor or force Huffman coding - - // Use a faster search when the previous match is longer than this - var good_match; - - // Stop searching when current match exceeds this - var nice_match; - - var dyn_ltree; // literal and length tree - var dyn_dtree; // distance tree - var bl_tree; // Huffman tree for bit lengths - - var l_desc = new Tree(); // desc for literal tree - var d_desc = new Tree(); // desc for distance tree - var bl_desc = new Tree(); // desc for bit length tree - - // that.heap_len; // number of elements in the heap - // that.heap_max; // element of largest frequency - // The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - // The same heap array is used to build all trees. - - // Depth of each subtree used as tie breaker for trees of equal frequency - that.depth = []; - - var l_buf; // index for literals or lengths */ - - // Size of match buffer for literals/lengths. There are 4 reasons for - // limiting lit_bufsize to 64K: - // - frequencies can be kept in 16 bit counters - // - if compression is not successful for the first block, all input - // data is still in the window so we can still emit a stored block even - // when input comes from standard input. (This can also be done for - // all blocks if lit_bufsize is not greater than 32K.) - // - if compression is not successful for a file smaller than 64K, we can - // even emit a stored file instead of a stored block (saving 5 bytes). - // This is applicable only for zip (not gzip or zlib). - // - creating new Huffman trees less frequently may not provide fast - // adaptation to changes in the input data statistics. (Take for - // example a binary file with poorly compressible code followed by - // a highly compressible string table.) Smaller buffer sizes give - // fast adaptation but have of course the overhead of transmitting - // trees more frequently. - // - I can't count above 4 - var lit_bufsize; - - var last_lit; // running index in l_buf - - // Buffer for distances. To simplify the code, d_buf and l_buf have - // the same number of elements. To use different lengths, an extra flag - // array would be necessary. - - var d_buf; // index of pendig_buf - - // that.opt_len; // bit length of current block with optimal trees - // that.static_len; // bit length of current block with static trees - var matches; // number of string matches in current block - var last_eob_len; // bit length of EOB code for last block - - // Output buffer. bits are inserted starting at the bottom (least - // significant bits). - var bi_buf; - - // Number of valid bits in bi_buf. All bits above the last valid bit - // are always zero. - var bi_valid; - - // number of codes at each bit length for an optimal tree - that.bl_count = []; - - // heap used to build the Huffman trees - that.heap = []; - - dyn_ltree = []; - dyn_dtree = []; - bl_tree = []; - - function lm_init() { - var i; - window_size = 2 * w_size; - - head[hash_size - 1] = 0; - for (i = 0; i < hash_size - 1; i++) { - head[i] = 0; - } - - // Set the default configuration parameters: - max_lazy_match = config_table[level].max_lazy; - good_match = config_table[level].good_length; - nice_match = config_table[level].nice_length; - max_chain_length = config_table[level].max_chain; - - strstart = 0; - block_start = 0; - lookahead = 0; - match_length = prev_length = MIN_MATCH - 1; - match_available = 0; - ins_h = 0; - } - - function init_block() { - var i; - // Initialize the trees. - for (i = 0; i < L_CODES; i++) - dyn_ltree[i * 2] = 0; - for (i = 0; i < D_CODES; i++) - dyn_dtree[i * 2] = 0; - for (i = 0; i < BL_CODES; i++) - bl_tree[i * 2] = 0; - - dyn_ltree[END_BLOCK * 2] = 1; - that.opt_len = that.static_len = 0; - last_lit = matches = 0; - } - - // Initialize the tree data structures for a new zlib stream. - function tr_init() { - - l_desc.dyn_tree = dyn_ltree; - l_desc.stat_desc = StaticTree.static_l_desc; - - d_desc.dyn_tree = dyn_dtree; - d_desc.stat_desc = StaticTree.static_d_desc; - - bl_desc.dyn_tree = bl_tree; - bl_desc.stat_desc = StaticTree.static_bl_desc; - - bi_buf = 0; - bi_valid = 0; - last_eob_len = 8; // enough lookahead for inflate - - // Initialize the first block of the first file: - init_block(); - } - - // Restore the heap property by moving down the tree starting at node k, - // exchanging a node with the smallest of its two sons if necessary, - // stopping - // when the heap property is re-established (each father smaller than its - // two sons). - that.pqdownheap = function(tree, // the tree to restore - k // node to move down - ) { - var heap = that.heap; - var v = heap[k]; - var j = k << 1; // left son of k - while (j <= that.heap_len) { - // Set j to the smallest of the two sons: - if (j < that.heap_len && smaller(tree, heap[j + 1], heap[j], that.depth)) { - j++; - } - // Exit if v is smaller than both sons - if (smaller(tree, v, heap[j], that.depth)) - break; - - // Exchange v with the smallest son - heap[k] = heap[j]; - k = j; - // And continue down the tree, setting j to the left son of k - j <<= 1; - } - heap[k] = v; - }; - - // Scan a literal or distance tree to determine the frequencies of the codes - // in the bit length tree. - function scan_tree(tree,// the tree to be scanned - max_code // and its largest code of non zero frequency - ) { - var n; // iterates over all tree elements - var prevlen = -1; // last emitted length - var curlen; // length of current code - var nextlen = tree[0 * 2 + 1]; // length of next code - var count = 0; // repeat count of the current code - var max_count = 7; // max repeat count - var min_count = 4; // min repeat count - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1] = 0xffff; // guard - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - bl_tree[curlen * 2] += count; - } else if (curlen !== 0) { - if (curlen != prevlen) - bl_tree[curlen * 2]++; - bl_tree[REP_3_6 * 2]++; - } else if (count <= 10) { - bl_tree[REPZ_3_10 * 2]++; - } else { - bl_tree[REPZ_11_138 * 2]++; - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen == nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } - } - - // Construct the Huffman tree for the bit lengths and return the index in - // bl_order of the last bit length code to send. - function build_bl_tree() { - var max_blindex; // index of last bit length code of non zero freq - - // Determine the bit length frequencies for literal and distance trees - scan_tree(dyn_ltree, l_desc.max_code); - scan_tree(dyn_dtree, d_desc.max_code); - - // Build the bit length tree: - bl_desc.build_tree(that); - // opt_len now includes the length of the tree representations, except - // the lengths of the bit lengths codes and the 5+5+4 bits for the - // counts. - - // Determine the number of bit length codes to send. The pkzip format - // requires that at least 4 bit length codes be sent. (appnote.txt says - // 3 but the actual value used is 4.) - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (bl_tree[Tree.bl_order[max_blindex] * 2 + 1] !== 0) - break; - } - // Update opt_len to include the bit length tree and counts - that.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - - return max_blindex; - } - - // Output a byte on the stream. - // IN assertion: there is enough room in pending_buf. - function put_byte(p) { - that.pending_buf[that.pending++] = p; - } - - function put_short(w) { - put_byte(w & 0xff); - put_byte((w >>> 8) & 0xff); - } - - function putShortMSB(b) { - put_byte((b >> 8) & 0xff); - put_byte((b & 0xff) & 0xff); - } - - function send_bits(value, length) { - var val, len = length; - if (bi_valid > Buf_size - len) { - val = value; - // bi_buf |= (val << bi_valid); - bi_buf |= ((val << bi_valid) & 0xffff); - put_short(bi_buf); - bi_buf = val >>> (Buf_size - bi_valid); - bi_valid += len - Buf_size; - } else { - // bi_buf |= (value) << bi_valid; - bi_buf |= (((value) << bi_valid) & 0xffff); - bi_valid += len; - } - } - - function send_code(c, tree) { - var c2 = c * 2; - send_bits(tree[c2] & 0xffff, tree[c2 + 1] & 0xffff); - } - - // Send a literal or distance tree in compressed form, using the codes in - // bl_tree. - function send_tree(tree,// the tree to be sent - max_code // and its largest code of non zero frequency - ) { - var n; // iterates over all tree elements - var prevlen = -1; // last emitted length - var curlen; // length of current code - var nextlen = tree[0 * 2 + 1]; // length of next code - var count = 0; // repeat count of the current code - var max_count = 7; // max repeat count - var min_count = 4; // min repeat count - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { - send_code(curlen, bl_tree); - } while (--count !== 0); - } else if (curlen !== 0) { - if (curlen != prevlen) { - send_code(curlen, bl_tree); - count--; - } - send_code(REP_3_6, bl_tree); - send_bits(count - 3, 2); - } else if (count <= 10) { - send_code(REPZ_3_10, bl_tree); - send_bits(count - 3, 3); - } else { - send_code(REPZ_11_138, bl_tree); - send_bits(count - 11, 7); - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen == nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } - } - - // Send the header for a block using dynamic Huffman trees: the counts, the - // lengths of the bit length codes, the literal tree and the distance tree. - // IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - function send_all_trees(lcodes, dcodes, blcodes) { - var rank; // index in bl_order - - send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt - send_bits(dcodes - 1, 5); - send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt - for (rank = 0; rank < blcodes; rank++) { - send_bits(bl_tree[Tree.bl_order[rank] * 2 + 1], 3); - } - send_tree(dyn_ltree, lcodes - 1); // literal tree - send_tree(dyn_dtree, dcodes - 1); // distance tree - } - - // Flush the bit buffer, keeping at most 7 bits in it. - function bi_flush() { - if (bi_valid == 16) { - put_short(bi_buf); - bi_buf = 0; - bi_valid = 0; - } else if (bi_valid >= 8) { - put_byte(bi_buf & 0xff); - bi_buf >>>= 8; - bi_valid -= 8; - } - } - - // Send one empty static block to give enough lookahead for inflate. - // This takes 10 bits, of which 7 may remain in the bit buffer. - // The current inflate code requires 9 bits of lookahead. If the - // last two codes for the previous block (real code plus EOB) were coded - // on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - // the last real code. In this case we send two empty static blocks instead - // of one. (There are no problems if the previous block is stored or fixed.) - // To simplify the code, we assume the worst case of last real code encoded - // on one bit only. - function _tr_align() { - send_bits(STATIC_TREES << 1, 3); - send_code(END_BLOCK, StaticTree.static_ltree); - - bi_flush(); - - // Of the 10 bits for the empty block, we have already sent - // (10 - bi_valid) bits. The lookahead for the last real code (before - // the EOB of the previous block) was thus at least one plus the length - // of the EOB plus what we have just sent of the empty static block. - if (1 + last_eob_len + 10 - bi_valid < 9) { - send_bits(STATIC_TREES << 1, 3); - send_code(END_BLOCK, StaticTree.static_ltree); - bi_flush(); - } - last_eob_len = 7; - } - - // Save the match info and tally the frequency counts. Return true if - // the current block must be flushed. - function _tr_tally(dist, // distance of matched string - lc // match length-MIN_MATCH or unmatched char (if dist==0) - ) { - var out_length, in_length, dcode; - that.pending_buf[d_buf + last_lit * 2] = (dist >>> 8) & 0xff; - that.pending_buf[d_buf + last_lit * 2 + 1] = dist & 0xff; - - that.pending_buf[l_buf + last_lit] = lc & 0xff; - last_lit++; - - if (dist === 0) { - // lc is the unmatched char - dyn_ltree[lc * 2]++; - } else { - matches++; - // Here, lc is the match length - MIN_MATCH - dist--; // dist = match distance - 1 - dyn_ltree[(Tree._length_code[lc] + LITERALS + 1) * 2]++; - dyn_dtree[Tree.d_code(dist) * 2]++; - } - - if ((last_lit & 0x1fff) === 0 && level > 2) { - // Compute an upper bound for the compressed length - out_length = last_lit * 8; - in_length = strstart - block_start; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += dyn_dtree[dcode * 2] * (5 + Tree.extra_dbits[dcode]); - } - out_length >>>= 3; - if ((matches < Math.floor(last_lit / 2)) && out_length < Math.floor(in_length / 2)) - return true; - } - - return (last_lit == lit_bufsize - 1); - // We avoid equality with lit_bufsize because of wraparound at 64K - // on 16 bit machines and because stored blocks are restricted to - // 64K-1 bytes. - } - - // Send the block data compressed using the given Huffman trees - function compress_block(ltree, dtree) { - var dist; // distance of matched string - var lc; // match length or unmatched char (if dist === 0) - var lx = 0; // running index in l_buf - var code; // the code to send - var extra; // number of extra bits to send - - if (last_lit !== 0) { - do { - dist = ((that.pending_buf[d_buf + lx * 2] << 8) & 0xff00) | (that.pending_buf[d_buf + lx * 2 + 1] & 0xff); - lc = (that.pending_buf[l_buf + lx]) & 0xff; - lx++; - - if (dist === 0) { - send_code(lc, ltree); // send a literal byte - } else { - // Here, lc is the match length - MIN_MATCH - code = Tree._length_code[lc]; - - send_code(code + LITERALS + 1, ltree); // send the length - // code - extra = Tree.extra_lbits[code]; - if (extra !== 0) { - lc -= Tree.base_length[code]; - send_bits(lc, extra); // send the extra length bits - } - dist--; // dist is now the match distance - 1 - code = Tree.d_code(dist); - - send_code(code, dtree); // send the distance code - extra = Tree.extra_dbits[code]; - if (extra !== 0) { - dist -= Tree.base_dist[code]; - send_bits(dist, extra); // send the extra distance bits - } - } // literal or match pair ? - - // Check that the overlay between pending_buf and d_buf+l_buf is - // ok: - } while (lx < last_lit); - } - - send_code(END_BLOCK, ltree); - last_eob_len = ltree[END_BLOCK * 2 + 1]; - } - - // Flush the bit buffer and align the output on a byte boundary - function bi_windup() { - if (bi_valid > 8) { - put_short(bi_buf); - } else if (bi_valid > 0) { - put_byte(bi_buf & 0xff); - } - bi_buf = 0; - bi_valid = 0; - } - - // Copy a stored block, storing first the length and its - // one's complement if requested. - function copy_block(buf, // the input data - len, // its length - header // true if block header must be written - ) { - bi_windup(); // align on byte boundary - last_eob_len = 8; // enough lookahead for inflate - - if (header) { - put_short(len); - put_short(~len); - } - - that.pending_buf.set(window.subarray(buf, buf + len), that.pending); - that.pending += len; - } - - // Send a stored block - function _tr_stored_block(buf, // input block - stored_len, // length of input block - eof // true if this is the last block for a file - ) { - send_bits((STORED_BLOCK << 1) + (eof ? 1 : 0), 3); // send block type - copy_block(buf, stored_len, true); // with header - } - - // Determine the best encoding for the current block: dynamic trees, static - // trees or store, and output the encoded block to the zip file. - function _tr_flush_block(buf, // input block, or NULL if too old - stored_len, // length of input block - eof // true if this is the last block for a file - ) { - var opt_lenb, static_lenb;// opt_len and static_len in bytes - var max_blindex = 0; // index of last bit length code of non zero freq - - // Build the Huffman trees unless a stored block is forced - if (level > 0) { - // Construct the literal and distance trees - l_desc.build_tree(that); - - d_desc.build_tree(that); - - // At this point, opt_len and static_len are the total bit lengths - // of - // the compressed block data, excluding the tree representations. - - // Build the bit length tree for the above two trees, and get the - // index - // in bl_order of the last bit length code to send. - max_blindex = build_bl_tree(); - - // Determine the best encoding. Compute first the block length in - // bytes - opt_lenb = (that.opt_len + 3 + 7) >>> 3; - static_lenb = (that.static_len + 3 + 7) >>> 3; - - if (static_lenb <= opt_lenb) - opt_lenb = static_lenb; - } else { - opt_lenb = static_lenb = stored_len + 5; // force a stored block - } - - if ((stored_len + 4 <= opt_lenb) && buf != -1) { - // 4: two words for the lengths - // The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - // Otherwise we can't have processed more than WSIZE input bytes - // since - // the last block flush, because compression would have been - // successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - // transform a block into a stored block. - _tr_stored_block(buf, stored_len, eof); - } else if (static_lenb == opt_lenb) { - send_bits((STATIC_TREES << 1) + (eof ? 1 : 0), 3); - compress_block(StaticTree.static_ltree, StaticTree.static_dtree); - } else { - send_bits((DYN_TREES << 1) + (eof ? 1 : 0), 3); - send_all_trees(l_desc.max_code + 1, d_desc.max_code + 1, max_blindex + 1); - compress_block(dyn_ltree, dyn_dtree); - } - - // The above check is made mod 2^32, for files larger than 512 MB - // and uLong implemented on 32 bits. - - init_block(); - - if (eof) { - bi_windup(); - } - } - - function flush_block_only(eof) { - _tr_flush_block(block_start >= 0 ? block_start : -1, strstart - block_start, eof); - block_start = strstart; - strm.flush_pending(); - } - - // Fill the window when the lookahead becomes insufficient. - // Updates strstart and lookahead. - // - // IN assertion: lookahead < MIN_LOOKAHEAD - // OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - // At least one byte has been read, or avail_in === 0; reads are - // performed for at least two bytes (required for the zip translate_eol - // option -- not supported here). - function fill_window() { - var n, m; - var p; - var more; // Amount of free space at the end of the window. - - do { - more = (window_size - lookahead - strstart); - - // Deal with !@#$% 64K limit: - if (more === 0 && strstart === 0 && lookahead === 0) { - more = w_size; - } else if (more == -1) { - // Very unlikely, but possible on 16 bit machine if strstart == - // 0 - // and lookahead == 1 (input done one byte at time) - more--; - - // If the window is almost full and there is insufficient - // lookahead, - // move the upper half to the lower one to make room in the - // upper half. - } else if (strstart >= w_size + w_size - MIN_LOOKAHEAD) { - window.set(window.subarray(w_size, w_size + w_size), 0); - - match_start -= w_size; - strstart -= w_size; // we now have strstart >= MAX_DIST - block_start -= w_size; - - // Slide the hash table (could be avoided with 32 bit values - // at the expense of memory usage). We slide even when level == - // 0 - // to keep the hash table consistent if we switch back to level - // > 0 - // later. (Using level 0 permanently is not an optimal usage of - // zlib, so we don't care about this pathological case.) - - n = hash_size; - p = n; - do { - m = (head[--p] & 0xffff); - head[p] = (m >= w_size ? m - w_size : 0); - } while (--n !== 0); - - n = w_size; - p = n; - do { - m = (prev[--p] & 0xffff); - prev[p] = (m >= w_size ? m - w_size : 0); - // If n is not on any hash chain, prev[n] is garbage but - // its value will never be used. - } while (--n !== 0); - more += w_size; - } - - if (strm.avail_in === 0) - return; - - // If there was no sliding: - // strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - // more == window_size - lookahead - strstart - // => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - // => more >= window_size - 2*WSIZE + 2 - // In the BIG_MEM or MMAP case (not yet supported), - // window_size == input_size + MIN_LOOKAHEAD && - // strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - // Otherwise, window_size == 2*WSIZE so more >= 2. - // If there was sliding, more >= WSIZE. So in all cases, more >= 2. - - n = strm.read_buf(window, strstart + lookahead, more); - lookahead += n; - - // Initialize the hash value now that we have some input: - if (lookahead >= MIN_MATCH) { - ins_h = window[strstart] & 0xff; - ins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask; - } - // If the whole input has less than MIN_MATCH bytes, ins_h is - // garbage, - // but this is not important since only literal bytes will be - // emitted. - } while (lookahead < MIN_LOOKAHEAD && strm.avail_in !== 0); - } - - // Copy without compression as much as possible from the input stream, - // return - // the current block state. - // This function does not insert new strings in the dictionary since - // uncompressible data is probably not useful. This function is used - // only for the level=0 compression option. - // NOTE: this function should be optimized to avoid extra copying from - // window to pending_buf. - function deflate_stored(flush) { - // Stored blocks are limited to 0xffff bytes, pending_buf is limited - // to pending_buf_size, and each stored block has a 5 byte header: - - var max_block_size = 0xffff; - var max_start; - - if (max_block_size > pending_buf_size - 5) { - max_block_size = pending_buf_size - 5; - } - - // Copy as much as possible from input to output: - while (true) { - // Fill the window as much as possible: - if (lookahead <= 1) { - fill_window(); - if (lookahead === 0 && flush == Z_NO_FLUSH) - return NeedMore; - if (lookahead === 0) - break; // flush the current block - } - - strstart += lookahead; - lookahead = 0; - - // Emit a stored block if pending_buf will be full: - max_start = block_start + max_block_size; - if (strstart === 0 || strstart >= max_start) { - // strstart === 0 is possible when wraparound on 16-bit machine - lookahead = (strstart - max_start); - strstart = max_start; - - flush_block_only(false); - if (strm.avail_out === 0) - return NeedMore; - - } - - // Flush if we may have to slide, otherwise block_start may become - // negative and the data will be gone: - if (strstart - block_start >= w_size - MIN_LOOKAHEAD) { - flush_block_only(false); - if (strm.avail_out === 0) - return NeedMore; - } - } - - flush_block_only(flush == Z_FINISH); - if (strm.avail_out === 0) - return (flush == Z_FINISH) ? FinishStarted : NeedMore; - - return flush == Z_FINISH ? FinishDone : BlockDone; - } - - function longest_match(cur_match) { - var chain_length = max_chain_length; // max hash chain length - var scan = strstart; // current string - var match; // matched string - var len; // length of current match - var best_len = prev_length; // best match length so far - var limit = strstart > (w_size - MIN_LOOKAHEAD) ? strstart - (w_size - MIN_LOOKAHEAD) : 0; - var _nice_match = nice_match; - - // Stop when cur_match becomes <= limit. To simplify the code, - // we prevent matches with the string of window index 0. - - var wmask = w_mask; - - var strend = strstart + MAX_MATCH; - var scan_end1 = window[scan + best_len - 1]; - var scan_end = window[scan + best_len]; - - // The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of - // 16. - // It is easy to get rid of this optimization if necessary. - - // Do not waste too much time if we already have a good match: - if (prev_length >= good_match) { - chain_length >>= 2; - } - - // Do not look for matches beyond the end of the input. This is - // necessary - // to make deflate deterministic. - if (_nice_match > lookahead) - _nice_match = lookahead; - - do { - match = cur_match; - - // Skip to next match if the match length cannot increase - // or if the match length is less than 2: - if (window[match + best_len] != scan_end || window[match + best_len - 1] != scan_end1 || window[match] != window[scan] - || window[++match] != window[scan + 1]) - continue; - - // The check at best_len-1 can be removed because it will be made - // again later. (This heuristic is not always a win.) - // It is not necessary to compare scan[2] and match[2] since they - // are always equal when the other bytes match, given that - // the hash keys are equal and that HASH_BITS >= 8. - scan += 2; - match++; - - // We check for insufficient lookahead only every 8th comparison; - // the 256th check will be made at strstart+258. - do { - } while (window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match] - && window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match] - && window[++scan] == window[++match] && window[++scan] == window[++match] && scan < strend); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - match_start = cur_match; - best_len = len; - if (len >= _nice_match) - break; - scan_end1 = window[scan + best_len - 1]; - scan_end = window[scan + best_len]; - } - - } while ((cur_match = (prev[cur_match & wmask] & 0xffff)) > limit && --chain_length !== 0); - - if (best_len <= lookahead) - return best_len; - return lookahead; - } - - // Compress as much as possible from the input stream, return the current - // block state. - // This function does not perform lazy evaluation of matches and inserts - // new strings in the dictionary only for unmatched strings or for short - // matches. It is used only for the fast compression options. - function deflate_fast(flush) { - // short hash_head = 0; // head of the hash chain - var hash_head = 0; // head of the hash chain - var bflush; // set if current block must be flushed - - while (true) { - // Make sure that we always have enough lookahead, except - // at the end of the input file. We need MAX_MATCH bytes - // for the next match, plus MIN_MATCH bytes to insert the - // string following the next match. - if (lookahead < MIN_LOOKAHEAD) { - fill_window(); - if (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return NeedMore; - } - if (lookahead === 0) - break; // flush the current block - } - - // Insert the string window[strstart .. strstart+2] in the - // dictionary, and set hash_head to the head of the hash chain: - if (lookahead >= MIN_MATCH) { - ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask; - - // prev[strstart&w_mask]=hash_head=head[ins_h]; - hash_head = (head[ins_h] & 0xffff); - prev[strstart & w_mask] = head[ins_h]; - head[ins_h] = strstart; - } - - // Find the longest match, discarding those <= prev_length. - // At this point we have always match_length < MIN_MATCH - - if (hash_head !== 0 && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) { - // To simplify the code, we prevent matches with the string - // of window index 0 (in particular we have to avoid a match - // of the string with itself at the start of the input file). - if (strategy != Z_HUFFMAN_ONLY) { - match_length = longest_match(hash_head); - } - // longest_match() sets match_start - } - if (match_length >= MIN_MATCH) { - // check_match(strstart, match_start, match_length); - - bflush = _tr_tally(strstart - match_start, match_length - MIN_MATCH); - - lookahead -= match_length; - - // Insert new strings in the hash table only if the match length - // is not too large. This saves time but degrades compression. - if (match_length <= max_lazy_match && lookahead >= MIN_MATCH) { - match_length--; // string at strstart already in hash table - do { - strstart++; - - ins_h = ((ins_h << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask; - // prev[strstart&w_mask]=hash_head=head[ins_h]; - hash_head = (head[ins_h] & 0xffff); - prev[strstart & w_mask] = head[ins_h]; - head[ins_h] = strstart; - - // strstart never exceeds WSIZE-MAX_MATCH, so there are - // always MIN_MATCH bytes ahead. - } while (--match_length !== 0); - strstart++; - } else { - strstart += match_length; - match_length = 0; - ins_h = window[strstart] & 0xff; - - ins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask; - // If lookahead < MIN_MATCH, ins_h is garbage, but it does - // not - // matter since it will be recomputed at next deflate call. - } - } else { - // No match, output a literal byte - - bflush = _tr_tally(0, window[strstart] & 0xff); - lookahead--; - strstart++; - } - if (bflush) { - - flush_block_only(false); - if (strm.avail_out === 0) - return NeedMore; - } - } - - flush_block_only(flush == Z_FINISH); - if (strm.avail_out === 0) { - if (flush == Z_FINISH) - return FinishStarted; - else - return NeedMore; - } - return flush == Z_FINISH ? FinishDone : BlockDone; - } - - // Same as above, but achieves better compression. We use a lazy - // evaluation for matches: a match is finally adopted only if there is - // no better match at the next window position. - function deflate_slow(flush) { - // short hash_head = 0; // head of hash chain - var hash_head = 0; // head of hash chain - var bflush; // set if current block must be flushed - var max_insert; - - // Process the input block. - while (true) { - // Make sure that we always have enough lookahead, except - // at the end of the input file. We need MAX_MATCH bytes - // for the next match, plus MIN_MATCH bytes to insert the - // string following the next match. - - if (lookahead < MIN_LOOKAHEAD) { - fill_window(); - if (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return NeedMore; - } - if (lookahead === 0) - break; // flush the current block - } - - // Insert the string window[strstart .. strstart+2] in the - // dictionary, and set hash_head to the head of the hash chain: - - if (lookahead >= MIN_MATCH) { - ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask; - // prev[strstart&w_mask]=hash_head=head[ins_h]; - hash_head = (head[ins_h] & 0xffff); - prev[strstart & w_mask] = head[ins_h]; - head[ins_h] = strstart; - } - - // Find the longest match, discarding those <= prev_length. - prev_length = match_length; - prev_match = match_start; - match_length = MIN_MATCH - 1; - - if (hash_head !== 0 && prev_length < max_lazy_match && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) { - // To simplify the code, we prevent matches with the string - // of window index 0 (in particular we have to avoid a match - // of the string with itself at the start of the input file). - - if (strategy != Z_HUFFMAN_ONLY) { - match_length = longest_match(hash_head); - } - // longest_match() sets match_start - - if (match_length <= 5 && (strategy == Z_FILTERED || (match_length == MIN_MATCH && strstart - match_start > 4096))) { - - // If prev_match is also MIN_MATCH, match_start is garbage - // but we will ignore the current match anyway. - match_length = MIN_MATCH - 1; - } - } - - // If there was a match at the previous step and the current - // match is not better, output the previous match: - if (prev_length >= MIN_MATCH && match_length <= prev_length) { - max_insert = strstart + lookahead - MIN_MATCH; - // Do not insert strings in hash table beyond this. - - // check_match(strstart-1, prev_match, prev_length); - - bflush = _tr_tally(strstart - 1 - prev_match, prev_length - MIN_MATCH); - - // Insert in hash table all strings up to the end of the match. - // strstart-1 and strstart are already inserted. If there is not - // enough lookahead, the last two strings are not inserted in - // the hash table. - lookahead -= prev_length - 1; - prev_length -= 2; - do { - if (++strstart <= max_insert) { - ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask; - // prev[strstart&w_mask]=hash_head=head[ins_h]; - hash_head = (head[ins_h] & 0xffff); - prev[strstart & w_mask] = head[ins_h]; - head[ins_h] = strstart; - } - } while (--prev_length !== 0); - match_available = 0; - match_length = MIN_MATCH - 1; - strstart++; - - if (bflush) { - flush_block_only(false); - if (strm.avail_out === 0) - return NeedMore; - } - } else if (match_available !== 0) { - - // If there was no match at the previous position, output a - // single literal. If there was a match but the current match - // is longer, truncate the previous match to a single literal. - - bflush = _tr_tally(0, window[strstart - 1] & 0xff); - - if (bflush) { - flush_block_only(false); - } - strstart++; - lookahead--; - if (strm.avail_out === 0) - return NeedMore; - } else { - // There is no previous match to compare with, wait for - // the next step to decide. - - match_available = 1; - strstart++; - lookahead--; - } - } - - if (match_available !== 0) { - bflush = _tr_tally(0, window[strstart - 1] & 0xff); - match_available = 0; - } - flush_block_only(flush == Z_FINISH); - - if (strm.avail_out === 0) { - if (flush == Z_FINISH) - return FinishStarted; - else - return NeedMore; - } - - return flush == Z_FINISH ? FinishDone : BlockDone; - } - - function deflateReset(strm) { - strm.total_in = strm.total_out = 0; - strm.msg = null; // - - that.pending = 0; - that.pending_out = 0; - - status = BUSY_STATE; - - last_flush = Z_NO_FLUSH; - - tr_init(); - lm_init(); - return Z_OK; - } - - that.deflateInit = function(strm, _level, bits, _method, memLevel, _strategy) { - if (!_method) - _method = Z_DEFLATED; - if (!memLevel) - memLevel = DEF_MEM_LEVEL; - if (!_strategy) - _strategy = Z_DEFAULT_STRATEGY; - - // byte[] my_version=ZLIB_VERSION; - - // - // if (!version || version[0] != my_version[0] - // || stream_size != sizeof(z_stream)) { - // return Z_VERSION_ERROR; - // } - - strm.msg = null; - - if (_level == Z_DEFAULT_COMPRESSION) - _level = 6; - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || _method != Z_DEFLATED || bits < 9 || bits > 15 || _level < 0 || _level > 9 || _strategy < 0 - || _strategy > Z_HUFFMAN_ONLY) { - return Z_STREAM_ERROR; - } - - strm.dstate = that; - - w_bits = bits; - w_size = 1 << w_bits; - w_mask = w_size - 1; - - hash_bits = memLevel + 7; - hash_size = 1 << hash_bits; - hash_mask = hash_size - 1; - hash_shift = Math.floor((hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - window = new Uint8Array(w_size * 2); - prev = []; - head = []; - - lit_bufsize = 1 << (memLevel + 6); // 16K elements by default - - // We overlay pending_buf and d_buf+l_buf. This works since the average - // output size for (length,distance) codes is <= 24 bits. - that.pending_buf = new Uint8Array(lit_bufsize * 4); - pending_buf_size = lit_bufsize * 4; - - d_buf = Math.floor(lit_bufsize / 2); - l_buf = (1 + 2) * lit_bufsize; - - level = _level; - - strategy = _strategy; - method = _method & 0xff; - - return deflateReset(strm); - }; - - that.deflateEnd = function() { - if (status != INIT_STATE && status != BUSY_STATE && status != FINISH_STATE) { - return Z_STREAM_ERROR; - } - // Deallocate in reverse order of allocations: - that.pending_buf = null; - head = null; - prev = null; - window = null; - // free - that.dstate = null; - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; - }; - - that.deflateParams = function(strm, _level, _strategy) { - var err = Z_OK; - - if (_level == Z_DEFAULT_COMPRESSION) { - _level = 6; - } - if (_level < 0 || _level > 9 || _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) { - return Z_STREAM_ERROR; - } - - if (config_table[level].func != config_table[_level].func && strm.total_in !== 0) { - // Flush the last buffer: - err = strm.deflate(Z_PARTIAL_FLUSH); - } - - if (level != _level) { - level = _level; - max_lazy_match = config_table[level].max_lazy; - good_match = config_table[level].good_length; - nice_match = config_table[level].nice_length; - max_chain_length = config_table[level].max_chain; - } - strategy = _strategy; - return err; - }; - - that.deflateSetDictionary = function(strm, dictionary, dictLength) { - var length = dictLength; - var n, index = 0; - - if (!dictionary || status != INIT_STATE) - return Z_STREAM_ERROR; - - if (length < MIN_MATCH) - return Z_OK; - if (length > w_size - MIN_LOOKAHEAD) { - length = w_size - MIN_LOOKAHEAD; - index = dictLength - length; // use the tail of the dictionary - } - window.set(dictionary.subarray(index, index + length), 0); - - strstart = length; - block_start = length; - - // Insert all strings in the hash table (except for the last two bytes). - // s->lookahead stays null, so s->ins_h will be recomputed at the next - // call of fill_window. - - ins_h = window[0] & 0xff; - ins_h = (((ins_h) << hash_shift) ^ (window[1] & 0xff)) & hash_mask; - - for (n = 0; n <= length - MIN_MATCH; n++) { - ins_h = (((ins_h) << hash_shift) ^ (window[(n) + (MIN_MATCH - 1)] & 0xff)) & hash_mask; - prev[n & w_mask] = head[ins_h]; - head[ins_h] = n; - } - return Z_OK; - }; - - that.deflate = function(_strm, flush) { - var i, header, level_flags, old_flush, bstate; - - if (flush > Z_FINISH || flush < 0) { - return Z_STREAM_ERROR; - } - - if (!_strm.next_out || (!_strm.next_in && _strm.avail_in !== 0) || (status == FINISH_STATE && flush != Z_FINISH)) { - _strm.msg = z_errmsg[Z_NEED_DICT - (Z_STREAM_ERROR)]; - return Z_STREAM_ERROR; - } - if (_strm.avail_out === 0) { - _strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)]; - return Z_BUF_ERROR; - } - - strm = _strm; // just in case - old_flush = last_flush; - last_flush = flush; - - // Write the zlib header - if (status == INIT_STATE) { - header = (Z_DEFLATED + ((w_bits - 8) << 4)) << 8; - level_flags = ((level - 1) & 0xff) >> 1; - - if (level_flags > 3) - level_flags = 3; - header |= (level_flags << 6); - if (strstart !== 0) - header |= PRESET_DICT; - header += 31 - (header % 31); - - status = BUSY_STATE; - putShortMSB(header); - } - - // Flush as much pending output as possible - if (that.pending !== 0) { - strm.flush_pending(); - if (strm.avail_out === 0) { - // console.log(" avail_out==0"); - // Since avail_out is 0, deflate will be called again with - // more output space, but possibly with both pending and - // avail_in equal to zero. There won't be anything to do, - // but this is not an error situation so make sure we - // return OK instead of BUF_ERROR at next call of deflate: - last_flush = -1; - return Z_OK; - } - - // Make sure there is something to do and avoid duplicate - // consecutive - // flushes. For repeated and useless calls with Z_FINISH, we keep - // returning Z_STREAM_END instead of Z_BUFF_ERROR. - } else if (strm.avail_in === 0 && flush <= old_flush && flush != Z_FINISH) { - strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)]; - return Z_BUF_ERROR; - } - - // User must not provide more input after the first FINISH: - if (status == FINISH_STATE && strm.avail_in !== 0) { - _strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)]; - return Z_BUF_ERROR; - } - - // Start a new block or continue the current one. - if (strm.avail_in !== 0 || lookahead !== 0 || (flush != Z_NO_FLUSH && status != FINISH_STATE)) { - bstate = -1; - switch (config_table[level].func) { - case STORED: - bstate = deflate_stored(flush); - break; - case FAST: - bstate = deflate_fast(flush); - break; - case SLOW: - bstate = deflate_slow(flush); - break; - default: - } - - if (bstate == FinishStarted || bstate == FinishDone) { - status = FINISH_STATE; - } - if (bstate == NeedMore || bstate == FinishStarted) { - if (strm.avail_out === 0) { - last_flush = -1; // avoid BUF_ERROR next call, see above - } - return Z_OK; - // If flush != Z_NO_FLUSH && avail_out === 0, the next call - // of deflate should use the same flush parameter to make sure - // that the flush is complete. So we don't have to output an - // empty block here, this will be done at next call. This also - // ensures that for a very small output buffer, we emit at most - // one empty block. - } - - if (bstate == BlockDone) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(); - } else { // FULL_FLUSH or SYNC_FLUSH - _tr_stored_block(0, 0, false); - // For a full flush, this empty block will be recognized - // as a special marker by inflate_sync(). - if (flush == Z_FULL_FLUSH) { - // state.head[s.hash_size-1]=0; - for (i = 0; i < hash_size/*-1*/; i++) - // forget history - head[i] = 0; - } - } - strm.flush_pending(); - if (strm.avail_out === 0) { - last_flush = -1; // avoid BUF_ERROR at next call, see above - return Z_OK; - } - } - } - - if (flush != Z_FINISH) - return Z_OK; - return Z_STREAM_END; - }; -} - -// ZStream - -function ZStream() { - var that = this; - that.next_in_index = 0; - that.next_out_index = 0; - // that.next_in; // next input byte - that.avail_in = 0; // number of bytes available at next_in - that.total_in = 0; // total nb of input bytes read so far - // that.next_out; // next output byte should be put there - that.avail_out = 0; // remaining free space at next_out - that.total_out = 0; // total nb of bytes output so far - // that.msg; - // that.dstate; -} - -ZStream.prototype = { - deflateInit : function(level, bits) { - var that = this; - that.dstate = new Deflate(); - if (!bits) - bits = MAX_BITS; - return that.dstate.deflateInit(that, level, bits); - }, - - deflate : function(flush) { - var that = this; - if (!that.dstate) { - return Z_STREAM_ERROR; - } - return that.dstate.deflate(that, flush); - }, - - deflateEnd : function() { - var that = this; - if (!that.dstate) - return Z_STREAM_ERROR; - var ret = that.dstate.deflateEnd(); - that.dstate = null; - return ret; - }, - - deflateParams : function(level, strategy) { - var that = this; - if (!that.dstate) - return Z_STREAM_ERROR; - return that.dstate.deflateParams(that, level, strategy); - }, - - deflateSetDictionary : function(dictionary, dictLength) { - var that = this; - if (!that.dstate) - return Z_STREAM_ERROR; - return that.dstate.deflateSetDictionary(that, dictionary, dictLength); - }, - - // Read a new buffer from the current input stream, update the - // total number of bytes read. All deflate() input goes through - // this function so some applications may wish to modify it to avoid - // allocating a large strm->next_in buffer and copying from it. - // (See also flush_pending()). - read_buf : function(buf, start, size) { - var that = this; - var len = that.avail_in; - if (len > size) - len = size; - if (len === 0) - return 0; - that.avail_in -= len; - buf.set(that.next_in.subarray(that.next_in_index, that.next_in_index + len), start); - that.next_in_index += len; - that.total_in += len; - return len; - }, - - // Flush as much pending output as possible. All deflate() output goes - // through this function so some applications may wish to modify it - // to avoid allocating a large strm->next_out buffer and copying into it. - // (See also read_buf()). - flush_pending : function() { - var that = this; - var len = that.dstate.pending; - - if (len > that.avail_out) - len = that.avail_out; - if (len === 0) - return; - - // if (that.dstate.pending_buf.length <= that.dstate.pending_out || that.next_out.length <= that.next_out_index - // || that.dstate.pending_buf.length < (that.dstate.pending_out + len) || that.next_out.length < (that.next_out_index + - // len)) { - // console.log(that.dstate.pending_buf.length + ", " + that.dstate.pending_out + ", " + that.next_out.length + ", " + - // that.next_out_index + ", " + len); - // console.log("avail_out=" + that.avail_out); - // } - - that.next_out.set(that.dstate.pending_buf.subarray(that.dstate.pending_out, that.dstate.pending_out + len), that.next_out_index); - - that.next_out_index += len; - that.dstate.pending_out += len; - that.total_out += len; - that.avail_out -= len; - that.dstate.pending -= len; - if (that.dstate.pending === 0) { - that.dstate.pending_out = 0; - } - } -}; - -// Deflater - -function Deflater(level) { - var that = this; - var z = new ZStream(); - var bufsize = 512; - var flush = Z_NO_FLUSH; - var buf = new Uint8Array(bufsize); - - if (typeof level == "undefined") - level = Z_DEFAULT_COMPRESSION; - z.deflateInit(level); - z.next_out = buf; - - that.append = function(data, onprogress) { - var err, buffers = [], lastIndex = 0, bufferIndex = 0, bufferSize = 0, array; - if (!data.length) - return; - z.next_in_index = 0; - z.next_in = data; - z.avail_in = data.length; - do { - z.next_out_index = 0; - z.avail_out = bufsize; - err = z.deflate(flush); - if (err != Z_OK) - throw "deflating: " + z.msg; - if (z.next_out_index) - if (z.next_out_index == bufsize) - buffers.push(new Uint8Array(buf)); - else - buffers.push(new Uint8Array(buf.subarray(0, z.next_out_index))); - bufferSize += z.next_out_index; - if (onprogress && z.next_in_index > 0 && z.next_in_index != lastIndex) { - onprogress(z.next_in_index); - lastIndex = z.next_in_index; - } - } while (z.avail_in > 0 || z.avail_out === 0); - array = new Uint8Array(bufferSize); - buffers.forEach(function(chunk) { - array.set(chunk, bufferIndex); - bufferIndex += chunk.length; - }); - return array; - }; - that.flush = function() { - var err, buffers = [], bufferIndex = 0, bufferSize = 0, array; - do { - z.next_out_index = 0; - z.avail_out = bufsize; - err = z.deflate(Z_FINISH); - if (err != Z_STREAM_END && err != Z_OK) - throw "deflating: " + z.msg; - if (bufsize - z.avail_out > 0) - buffers.push(new Uint8Array(buf.subarray(0, z.next_out_index))); - bufferSize += z.next_out_index; - } while (z.avail_in > 0 || z.avail_out === 0); - z.deflateEnd(); - array = new Uint8Array(bufferSize); - buffers.forEach(function(chunk) { - array.set(chunk, bufferIndex); - bufferIndex += chunk.length; - }); - return array; - }; -} \ No newline at end of file diff --git a/js/Downloadify/LICENSE.txt b/js/Downloadify/LICENSE.txt deleted file mode 100644 index 2c4f1ab..0000000 --- a/js/Downloadify/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -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. \ No newline at end of file diff --git a/js/Downloadify/README.textile b/js/Downloadify/README.textile deleted file mode 100644 index 9ea21d9..0000000 --- a/js/Downloadify/README.textile +++ /dev/null @@ -1,113 +0,0 @@ -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*: - -
Downloadify.create( id_or_DOM_element, options );
- -*jQuery*: - -
$("#element").downloadify( options );
- -*MooTools:* - -
$("elementid").downloadify( options );
- -h3. Options - -Unless you are using the jQuery plugin included with Downloadify, you must supply all required options with your call to the Downloadify.create function. - -*Defaults and Required Options* - -* swf: 'media/downloadify.swf' *Required*
_Path to the SWF File. Can be relative from the page, or an absolute path._ -* downloadImage: 'images/download.png' *Required*
_Path to the Button Image. Can be relative from the page or an absolute path._ -* width: 175 *Required*
_Width of the button (and the flash movie)_ -* height: 55 *Required*
_Height of the button. This will be 1/4 the height of the image._ -* filename: *Required*
_Can be a String or a function callback. If a function, the return value of the function will be used as the filename._ -* data: *Required*
_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._ -* dataType: 'string'
_Must be a String with the value string or base64. Data paired with the dataType of base64 will be decoded into a ByteArray prior to saving._ -* transparent: false
_Set this to true to use wmode=transparent on the flash movie._ -* append: false
_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. - -* onError: _Called when the Download button is clicked but your data callback returns ""._ -* onCancel: _Called when the Download button is clicked but the user then cancels without saving._ -* onComplete: _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 base64 via the "as3base64 Library":http://github.com/spjwebster/as3base64 -** Added dataType 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. \ No newline at end of file diff --git a/js/Downloadify/images/download.png b/js/Downloadify/images/download.png deleted file mode 100644 index d2fabbf5a2bae5496b4d5db6fbd4c5338ff46cff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2500 zcmV;#2|MnEsHmv0u&|t*o~o*Io}QqtuCA)8tm5M0 z!otI+r>L~FwydnKsHm#3v9YhOu(!9khlhx{xw)I0od5s-$jHfecXwxJXI@@jkB^Uj zet&awbI#7sZ*Om+qNBdPzV*cn*8l(rnn^@KRCwClS!=Gwk|h{OAv>yII7nhNf?*KJNibeVBKp7+NjBU+7XVy(U<{iGuz?6)h?W}& zQNsWjkLL!Lcl(=_;ydW>Yi3W`mis@e9vk^~W8XMrovCH@b zKo5%yGP5?0Tc*NZO(C-$vuk)x_HZx`abmfwFqn%&w6VPk1s+`T7lsO|Q9x=KDO@L@ z2lfSqSg^L)KwFR(lmm^1+?Mrft&7c5e+m+0)CSCd+93D9*-B;z~U zXDsTvJx*wGS~6I4g(M%<9r*!sG07{~SJfV>%A12dt2~7gwcrsJSXHH9%0>ze_vDF9 z%6wI!6jo?1PD}2Kejv%>bAZ3j=ks5mpW4so=Z}VC@4O*1TF)L2*lbG~Hc&m|QJr;~LlJurv^hok+CK$hvWakOS z4oQ}_U@VbjA^MmsUPUq%y+ec zgY5A$8D^Is&74`}d!CE%ypExbr4~Elx9A+7O$W8GW3s*D?8)b)fF72bXf|2nI1Tey z=UHsIdCaciIq6`#+VUmmF3E2$4Q4D&c3Lh^0pk0&hyy#I>6qt7py7!}$hiShzH5BH zZF5xh$9xC{N%X;8wlQ>Fhi=RYT`$#!BTC^>2|i7m4Hrd{Z~%QWndo6S(ZW!h;8>Zg$&A*C!UNXaFq%w8e5g(M1nSl| zE6r6V{e8{2{=e=Oek>_1FND>JLl9<9lDJ&dF;t2(hcAtEyVzb6#PQ zQ00t%(&e%~1@y2KrSWkaHC5F_SO&}rwlg2j$;097*fLn!EAzxY=h5jV+D{UA_+3r@ z71yaNCI^AcW&MevhfP-*cqW?$L2hGrV%h5P#6NshE{<3`7>oQ`JKRKj%WH>Qgbj9{ z1Ic=Jm-Q`|^)sp+b~)7!zlMuGUy#A9>$zD;aWCSSMJy_NCEyAO%yKWZ^8@^p_kijJ| z-s`%7fT=MnhKnLeImGl@JCtCRr3IxvVlaA_T9JMD|87>{qFJ@!R!VGQ*Kzgr;Pk>$OnS zXC%=?*C!g1)TLn5NTM$VLq`(jLogI15&y3ZBzY4}^7bl{muy$R8lY<1wxWmQ5u3!v z#!pr&w6-1@=%GzkP1`m+o*OFO**7c2&)V62O(I!u?{F-oR4iw^Js`H*FBxsBb5ZA* z?g2jc<-DDjy_}V0rt%3LdK#lA^U*6y@3@t}wwFd3-xpm!ofAn8`>+g`P80Nnv;30L zrrIBEfCrcSLI2Tw^nq;my-mKQEu%;N3O>4EDS!3-TZx^cqH2FUC;IM=ey*yjS?*$A zRsDEp%V<-bd8?|{En?9wb~}Hw+il2qjgXz4*?sJkL{*c1Cl~Qb8LYV@lHsqZZy^>& zSsu!XZ6|){$Y@igymf5*7O`qpVc2ZKaMRJyrU>~G=G{14dstLCVHd}nM^*ZCLB8jj zrpZ#@V4pX=S(x;C?-cD%)O-8h_YG}VL&FQTjnpr?pf`0*^G)&V`edD%+}3`Tph{7{n)xxc_RUxwmOojGjqE;AJFd z(IotXUke5o5{h8ZInmw(gR2$c|39G%GTaG8NEhT%bapMxmk92E1sDM8vG0LscT3>_ O0000 - is released under the MIT License -*/ -var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab+JCW$?cC$cOh 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 diff --git a/js/Downloadify/src/Downloadify.as b/js/Downloadify/src/Downloadify.as deleted file mode 100644 index 718cdd9..0000000 --- a/js/Downloadify/src/Downloadify.as +++ /dev/null @@ -1,173 +0,0 @@ -/* - 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); - } - - } -} \ No newline at end of file diff --git a/js/Downloadify/src/com/dynamicflash/util/Base64.as b/js/Downloadify/src/com/dynamicflash/util/Base64.as deleted file mode 100755 index 4aef13c..0000000 --- a/js/Downloadify/src/com/dynamicflash/util/Base64.as +++ /dev/null @@ -1,135 +0,0 @@ -/* -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"); - } - } -} \ No newline at end of file diff --git a/js/Downloadify/src/com/dynamicflash/util/tests/Base64Test.as b/js/Downloadify/src/com/dynamicflash/util/tests/Base64Test.as deleted file mode 100755 index 9077039..0000000 --- a/js/Downloadify/src/com/dynamicflash/util/tests/Base64Test.as +++ /dev/null @@ -1,60 +0,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.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))); - } - } -} \ No newline at end of file diff --git a/js/Downloadify/src/downloadify.js b/js/Downloadify/src/downloadify.js deleted file mode 100644 index ce93a56..0000000 --- a/js/Downloadify/src/downloadify.js +++ /dev/null @@ -1,213 +0,0 @@ -/* - 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)); - } - }); -}; - diff --git a/js/Downloadify/test.html b/js/Downloadify/test.html deleted file mode 100644 index c63c8fc..0000000 --- a/js/Downloadify/test.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - Downloadify - - - - - -

Downloadify Example

-

More info available at the Github Project Page

-
-

-
- -

-

-
- -

-

- You must have Flash 10 installed to download this file. -

-
- - -

Downloadify Invoke Script For This Page

-
-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
-});
-
- - - diff --git a/js/FileSaver.js/FileSaver.js b/js/FileSaver.js/FileSaver.js deleted file mode 100644 index c514e6e..0000000 --- a/js/FileSaver.js/FileSaver.js +++ /dev/null @@ -1,217 +0,0 @@ -/* FileSaver.js - * A saveAs() FileSaver implementation. - * 2013-01-23 - * - * 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 - || (navigator.msSaveBlob && navigator.msSaveBlob.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 = "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 - ); - return node.dispatchEvent(event); // false if event was cancelled - } - , 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; - } - 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); - save_link.href = object_url; - save_link.download = name; - if (click(save_link)) { - 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; - } else { - target_view = view.open(); - } - 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; -}(self)); diff --git a/js/FileSaver.js/FileSaver.min.js b/js/FileSaver.js/FileSaver.min.js deleted file mode 100644 index 0fe269c..0000000 --- a/js/FileSaver.js/FileSaver.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ -var saveAs=saveAs||navigator.msSaveBlob&&navigator.msSaveBlob.bind(navigator)||function(a){"use strict";var b=a.document,c=function(){return a.URL||a.webkitURL||a},d=a.URL||a.webkitURL||a,e=b.createElementNS("http://www.w3.org/1999/xhtml","a"),f="download"in e,g=function(c){var d=b.createEvent("MouseEvents");return d.initMouseEvent("click",!0,!1,a,0,0,0,0,0,!1,!1,!1,!1,0,null),c.dispatchEvent(d)},h=a.webkitRequestFileSystem,i=a.requestFileSystem||h||a.mozRequestFileSystem,j=function(b){(a.setImmediate||a.setTimeout)(function(){throw b},0)},k="application/octet-stream",l=0,m=[],n=function(){for(var a=m.length;a--;){var b=m[a];"string"==typeof b?d.revokeObjectURL(b):b.remove()}m.length=0},o=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"==typeof e)try{e.call(a,c||a)}catch(f){j(f)}}},p=function(b,d){var q,r,x,j=this,n=b.type,p=!1,s=function(){var a=c().createObjectURL(b);return m.push(a),a},t=function(){o(j,"writestart progress write writeend".split(" "))},u=function(){(p||!q)&&(q=s(b)),r&&(r.location.href=q),j.readyState=j.DONE,t()},v=function(a){return function(){return j.readyState!==j.DONE?a.apply(this,arguments):void 0}},w={create:!0,exclusive:!1};return j.readyState=j.INIT,d||(d="download"),f&&(q=s(b),e.href=q,e.download=d,g(e))?(j.readyState=j.DONE,t(),void 0):(a.chrome&&n&&n!==k&&(x=b.slice||b.webkitSlice,b=x.call(b,0,b.size,k),p=!0),h&&"download"!==d&&(d+=".download"),r=n===k||h?a:a.open(),i?(l+=b.size,i(a.TEMPORARY,l,v(function(a){a.root.getDirectory("saved",w,v(function(a){var c=function(){a.getFile(d,w,v(function(a){a.createWriter(v(function(c){c.onwriteend=function(b){r.location.href=a.toURL(),m.push(a),j.readyState=j.DONE,o(j,"writeend",b)},c.onerror=function(){var a=c.error;a.code!==a.ABORT_ERR&&u()},"writestart progress write abort".split(" ").forEach(function(a){c["on"+a]=j["on"+a]}),c.write(b),j.abort=function(){c.abort(),j.readyState=j.DONE},j.readyState=j.WRITING}),u)}),u)};a.getFile(d,{create:!1},v(function(a){a.remove(),c()}),v(function(a){a.code===a.NOT_FOUND_ERR?c():u()}))}),u)}),u),void 0):(u(),void 0))},q=p.prototype,r=function(a,b){return new p(a,b)};return q.abort=function(){var a=this;a.readyState=a.DONE,o(a,"abort")},q.readyState=q.INIT=0,q.WRITING=1,q.DONE=2,q.error=q.onwritestart=q.onprogress=q.onwrite=q.onabort=q.onerror=q.onwriteend=null,a.addEventListener("unload",n,!1),r}(self); diff --git a/js/FileSaver.js/LICENSE.md b/js/FileSaver.js/LICENSE.md deleted file mode 100644 index 7eb56b9..0000000 --- a/js/FileSaver.js/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/js/FileSaver.js/README.md b/js/FileSaver.js/README.md deleted file mode 100644 index 6bcd132..0000000 --- a/js/FileSaver.js/README.md +++ /dev/null @@ -1,69 +0,0 @@ -FileSaver.js -============ - -FileSaver.js implements the 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. - -Supported Browsers ------------------- - -* Internet Explorer 10+ -* Firefox 4+ -* Google Chrome -* Opera 11+ -* Safari 5+ - -Unlisted versions of browsers (e.g. Firefox 3.6) will probably work too; I just haven't -tested them. - -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 `BlobBuilder` 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()` implementation that solves -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://oftn.org/projects/FileSaver.js/demo/ - [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/js/FileSaver.js/demo/demo.css b/js/FileSaver.js/demo/demo.css deleted file mode 100644 index 7b4d837..0000000 --- a/js/FileSaver.js/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; - 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; -} \ No newline at end of file diff --git a/js/FileSaver.js/demo/demo.js b/js/FileSaver.js/demo/demo.js deleted file mode 100644 index 352415f..0000000 --- a/js/FileSaver.js/demo/demo.js +++ /dev/null @@ -1,212 +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) { - 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/js/FileSaver.js/demo/demo.min.js b/js/FileSaver.js/demo/demo.min.js deleted file mode 100644 index 33d0e02..0000000 --- a/js/FileSaver.js/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,w=function(){return n.BlobBuilder||n.WebKitBlobBuilder||n.MozBlobBuilder},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

- ",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n(" - - - - - - - - \ No newline at end of file diff --git a/template_markdowntoapa.html b/template_markdowntoapa.html deleted file mode 100644 index f74e6ee..0000000 --- a/template_markdowntoapa.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - MarkdowntoAPA.com - - - - - - - - - - - - -
-author: Christian R. Genco
-institution: Southern Methodist University
-title: How to use MarkdownToAPA.com to\nWrite APA Papers Easier
-runninghead: WRITE APA PAPERS ON MARKDOWNTOAPA.COM
-abstract: This paper shows you how to use the website you're viewing it on, MarkdownToAPA.com, to write APA papers in markdown and automatically format them really prettily as a downloadable/printable PDF document. It's pretty meta, yo.
-keywords: game changing, next facebook, #thedress, document formats are tedious
-
-Hi! Welcome to MarkdownToAPA.com - a simple website with an even simpler purpose: making it less annoying to generate APA-formatted papers.
-
-The stuff on the left is editable, and automatically generates the PDF on the right, which can be downloaded and emailed to your professor, or printed out and made into a paper airplane, or whatever else you can do with a PDF. Everything you write is automatically saved as soon as you pause your furious typing, but it's still a good idea to copy and paste it somewhere else every once in a while as a backup. You can even use this website without being connected to the internet!
-
-The special format on the left is called Markdown. You can easily make things *italic* and **bold**, as well as quote important people:
-
-> Writing MLA-formatted essays is much easier with markdowntomla.com. I use it all the time when I write essays to foreign dictators, as well as to my wife when I need her to pick up something from the store on the way home (we're a very formal family). (Obama)
-
-You can also play around with headings:
-
-# Important Stuff
-
-I'm going to talk about really important stuff here.
-
-## Important Stuff I am Wearing
-
-There's a lot of important stuff out there, but the stuff I'm wearing is a pretty large subset of it. Let's further explore the topic of my clothing.
-
-### Pants
-
-My belt holds my pants up, but my belt loops hold my belt up. Who's the real hero?
-
-### Socks
-
-Feet can get pretty cold without an external layer of cloth to hold in their heat. I'm not keeping score or anything, but I'd say socks rank pretty high up there.
-
-# Non-important Stuff
-
-Actually, most stuff is pretty important. I'll leave this section blank. Except for, of course, the previous sentence.
-
-Need a page break? Just type three dashes on an empty line.
-
----
-
-Whoa, so much more room on this page. There are two things left to cover: the special **author**, **institution**, **runninghead**, **title**, **abstract**, and **keywords** section at the top; and the work's cited page. The former is used for the MLA heading, numbering the pages, and naming your downloaded PDF. The later is pretty self explanatory (look at the markdown source code at the bottom of this essay).
-
-For help generating those citations, check out bibme.org, and citationmachine.net. Be careful citing Wikipedia, but there's also a handy "cite this page" button on every page.
-
----
-
-# Conclusions and Future Study
-
-Get out there and research some cool things to write about! Or just start editing the markdown on the left. Either way, let me know if you have any suggestions for improvement on twitter @cgenco, or through my website at http://christian.gen.co (where I also have a lecture on how to go to college for free, and other websites I've made).
-
-Want this for MLA? Head over to http://MarkdownToMLA.com
-
----
-
-# References
-
-Egan, G. (1994). Permutation city. New York: HarperPrism.
-
-Hacker News. (2015, March 18). In *Wikipedia, The Free Encyclopedia*. Retrieved 08:46, April 7, 2015, from http://en.wikipedia.org/w/index.php?title=Hacker_News&oldid=651986110
-
-Rowling, J. (1999). *Harry Potter and the Chamber of Secrets*. New York: Arthur A. Levine Books.
-
- - - - - - - - - \ No newline at end of file diff --git a/todo.md b/todo.md deleted file mode 100644 index 912ddd5..0000000 --- a/todo.md +++ /dev/null @@ -1,6 +0,0 @@ -# Todo - -* merge apa and mla into markdowntomlapa -* pretty quotes? -* citations? -* block quote with immediately following paragraph? \ No newline at end of file