├── .gitignore ├── .npmignore ├── ISSUE_TEMPLATE.md ├── LICENSE.txt ├── README.md ├── README_CREATEJS_NAMESPACE.txt ├── VERSIONS.txt ├── _assets ├── README.md ├── art │ ├── Autumn.png │ ├── BlueBird.png │ ├── Nepal.jpg │ ├── Texas.jpg │ ├── gbot.svg │ ├── genericButton.png │ ├── genericButtonOver.png │ ├── ground.png │ ├── hill1.png │ ├── hill2.png │ ├── image0.jpg │ ├── image1.jpg │ ├── image2.jpg │ ├── image3.jpg │ ├── loader.gif │ ├── loading.gif │ ├── logo_createjs.svg │ ├── runningGrant.png │ ├── sky.png │ └── spritesheet_font.png ├── audio │ ├── Thunder.mp3 │ └── Thunder.ogg ├── css │ ├── examples.css │ ├── preloadjs.css │ └── shared.css ├── fonts │ ├── regul-bold.woff │ └── regul-book.woff ├── js │ └── examples.js ├── libs │ ├── easeljs-NEXT.min.js │ ├── soundjs-NEXT.min.js │ └── tweenjs-NEXT.min.js └── static │ ├── CabinBoy.mp3 │ ├── ManifestTest.json │ ├── MediaGridManifest.json │ ├── alert1.js │ ├── bg.css │ ├── demoStyles.css │ ├── font.css │ ├── grant.json │ ├── grant.xml │ ├── grantp.json │ ├── jsonpSample.json │ ├── manifest.json │ ├── manifestp.json │ ├── scriptExample.js │ └── video.mp4 ├── bower.json ├── build ├── BANNER ├── Gruntfile.js ├── LICENSE ├── README.md ├── config.json ├── createjsTheme │ ├── assets │ │ ├── css │ │ │ └── yui-cssgrids-min.css │ │ ├── docs-icon-PreloadJS.png │ │ ├── favicon.ico │ │ ├── js │ │ │ └── yui-source.js │ │ ├── preloadjs-banner.png │ │ └── scss │ │ │ ├── elements │ │ │ ├── anchors.scss │ │ │ ├── backToTop.scss │ │ │ ├── buttons.scss │ │ │ ├── codebox.scss │ │ │ ├── codemirror_controls.scss │ │ │ ├── forms │ │ │ │ ├── fieldset.scss │ │ │ │ ├── forms.scss │ │ │ │ ├── input.scss │ │ │ │ └── labels.scss │ │ │ ├── tags.scss │ │ │ └── transitions.scss │ │ │ ├── library-specific.scss │ │ │ ├── main.scss │ │ │ ├── settings │ │ │ ├── breakpoint.scss │ │ │ ├── color.scss │ │ │ ├── fonts.scss │ │ │ ├── layout.scss │ │ │ ├── path.scss │ │ │ └── transition.scss │ │ │ └── utilities │ │ │ ├── breakpoint.scss │ │ │ └── clearfix.scss │ ├── layouts │ │ ├── main.handlebars │ │ └── xhr.handlebars │ ├── partials │ │ ├── attrs.handlebars │ │ ├── classes.handlebars │ │ ├── events.handlebars │ │ ├── files.handlebars │ │ ├── index.handlebars │ │ ├── method.handlebars │ │ ├── module.handlebars │ │ ├── options.handlebars │ │ ├── props.handlebars │ │ └── sidebar.handlebars │ └── theme.json ├── package.json ├── path.js ├── tasks │ ├── updatebower.js │ └── updateversion.js └── updates │ ├── README.md │ └── builder.js ├── docs ├── PreloadJS_docs.zip └── preloadjs_docs-NEXT.zip ├── examples ├── CustomLoader.html ├── FontLoader.html ├── MediaGrid.html ├── PluginSample.html ├── PreloadImages.html ├── PreloadQueue.html └── SpriteSheet.html ├── extras ├── README.txt └── sample.htaccess ├── icon.png ├── lib ├── README.md ├── preloadjs-NEXT.js ├── preloadjs-NEXT.min.js ├── preloadjs.js └── preloadjs.min.js ├── package.json ├── spikes └── FontLoading │ ├── fonts │ ├── regul-bold.woff │ └── regul-book.woff │ ├── testArr.html │ ├── testArrSrc.html │ ├── testCSS.html │ ├── testGoogleFonts.html │ ├── testSrc.html │ └── typekit.html ├── src ├── createjs │ ├── events │ │ ├── ErrorEvent.js │ │ ├── Event.js │ │ └── EventDispatcher.js │ └── utils │ │ ├── deprecate.js │ │ ├── extend.js │ │ ├── indexOf.js │ │ ├── promote.js │ │ └── proxy.js └── preloadjs │ ├── LoadQueue.js │ ├── data │ ├── LoadItem.js │ ├── Methods.js │ └── Types.js │ ├── events │ └── ProgressEvent.js │ ├── loaders │ ├── AbstractLoader.js │ ├── AbstractMediaLoader.js │ ├── BinaryLoader.js │ ├── CSSLoader.js │ ├── FontLoader.js │ ├── ImageLoader.js │ ├── JSONLoader.js │ ├── JSONPLoader.js │ ├── JavaScriptLoader.js │ ├── ManifestLoader.js │ ├── SVGLoader.js │ ├── SoundLoader.js │ ├── SpriteSheetLoader.js │ ├── TextLoader.js │ ├── VideoLoader.js │ └── XMLLoader.js │ ├── net │ ├── AbstractRequest.js │ ├── MediaTagRequest.js │ ├── TagRequest.js │ └── XHRRequest.js │ ├── plugins │ └── SamplePlugin.js │ ├── utils │ ├── DataUtils.js │ ├── DomUtils.js │ ├── Elements.js │ ├── RequestUtils.js │ ├── URLUtils.js │ └── json3.js │ └── version.js └── tests ├── Gruntfile.js ├── README.md ├── lib └── jasmine-2.0.2 │ ├── MIT.LICENSE │ ├── boot.js │ ├── console.js │ ├── jasmine-html.js │ ├── jasmine.css │ ├── jasmine.js │ └── jasmine_favicon.png ├── package.json ├── spec ├── Helpers.js └── LoadQueueSpec.js └── tasks ├── findopenport.js └── listips.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build/output/ 3 | build/tmp/ 4 | *TMP* 5 | node_modules/ 6 | .idea/ 7 | *.sublime-project 8 | *.sublime-workspace 9 | config.local.json 10 | docs/**/ 11 | 12 | #----------------------------- 13 | # INVALID FILES 14 | # (for cross OS compatibility) 15 | #----------------------------- 16 | *[\<\>\:\"\/\\\|\?\*]* 17 | main.css 18 | *.codekit 19 | *.sass-cache 20 | tests/.grunt 21 | _SpecRunner.html 22 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | _assets 2 | build 3 | bower.json 4 | docs 5 | examples 6 | extras 7 | icon.png 8 | lib/**-NEXT**.js 9 | spikes 10 | src 11 | tests 12 | VERSIONS.txt -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### TODO 2 | - [ ] Is this a question or bug? [Stack Overflow](https://stackoverflow.com/questions/tagged/createjs) is a much better place to ask any questions you may have. 3 | 4 | - [ ] Did you search the [issues](https://github.com/CreateJS/PreloadJS/issues) to see if someone else has already reported your issue? If yes, please add more details if you have any! 5 | 6 | - [ ] If you're using an older [version](https://github.com/CreateJS/PreloadJS/blob/master/VERSIONS.txt), have you tried the latest? 7 | 8 | - [ ] If you're requesting a new feature; provide as many details as you can. Why do you want this feature? Do you have ideas for how this feature should be implemented? Pseudocode is always welcome! 9 | 10 | 11 | ### Issue Details 12 | * Version used (Ex; 1.0): 13 | 14 | 15 | * Describe whats happening (Include any relevant console errors, a [Gist](https://gist.github.com/) is preferred for longer errors): 16 | 17 | 18 | 19 | * OS & Browser version *(Please be specific)* (Ex; Windows 10 Home, Chrome 62.0.3202.94): 20 | 21 | 22 | 23 | * Do you know of any workarounds? 24 | 25 | 26 | 27 | * Provide any extra details that will help us fix your issue. Including a link to a [CodePen.io](https://codepen.io) or [JSFiddle.net](https://jsfiddle.net) example that shows the issue in isolation will greatly increase the chance of getting a quick response. 28 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 gskinner.com, inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PreloadJS 2 | 3 | PreloadJS is a library to make working with asset preloading easier. It provides a consistent API for loading different 4 | file types, automatic detection of XHR (XMLHttpRequest) availability with a fallback to tag-base loading, composite 5 | progress events, and a plugin model to assist with preloading in other libraries such as [SoundJS](http://www.createjs.com/soundjs/). 6 | 7 | ## Example 8 | 9 | ```javascript 10 | var queue = new createjs.LoadQueue(false); 11 | queue.on("fileload", handleFileComplete); 12 | queue.loadFile('http://createjs.com/assets/images/png/createjs-badge-dark.png'); 13 | function handleFileComplete(event) { 14 | document.body.appendChild(event.result); 15 | } 16 | ``` 17 | 18 | ## Support and Resources 19 | * Find examples and more information at the [PreloadJS web site](http://www.preloadjs.com/) 20 | * Read the [documentation](http://createjs.com/docs/preloadjs/) 21 | * Discuss, share projects, and interact with other users on [reddit](http://www.reddit.com/r/createjs/). 22 | * Ask technical questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/preloadjs). 23 | * File verified bugs or formal feature requests using Issues on [GitHub](https://github.com/createjs/PreloadJS/issues). 24 | * Have a look at the included [examples](https://github.com/CreateJS/PreloadJS/tree/master/examples) and 25 | [API documentation](http://createjs.com/docs/preloadjs/) for more in-depth information. 26 | 27 | Built by [gskinner.com](http://www.gskinner.com), and is released for free under the MIT license, which means you can 28 | use it for almost any purpose (including commercial projects). We appreciate credit where possible, but it is not a requirement. 29 | 30 | 31 | ## Classes 32 | 33 | **LoadQueue** 34 | The main class that manages all preloading. Instantiate a LoadQueue instance, load a file or manifest, and track 35 | progress and complete events. Check out the [docs](http://createjs.com/docs/preloadjs/) for more information. -------------------------------------------------------------------------------- /README_CREATEJS_NAMESPACE.txt: -------------------------------------------------------------------------------- 1 | In this version of PreloadJS, class definitions reside in a "createjs" namespace by default. 2 | 3 | For example, instead of instantiating a preloader like this: 4 | var foo = new PreloadJS(); 5 | 6 | You will need to reach into the createjs namespace: 7 | var bar = new createjs.LoadQueue(); 8 | 9 | This functionality is configurable though. You can easily shortcut the namespace or get rid of it completely. 10 | 11 | To shortcut the namespace, just point a different variable at createjs it is loaded: 12 | 13 | 17 | 18 | To remove the namespace, just point the createjs variable at the window before loading the libraries: 19 | 22 | 23 | 24 | This will also make CreateJS libraries compatible with old content that did not use a namespace, such as the output from the Flash Pro Toolkit for CreateJS v1.0. 25 | -------------------------------------------------------------------------------- /_assets/README.md: -------------------------------------------------------------------------------- 1 | # _shared folder 2 | 3 | Contains assets that are shared by examples, tutorials, and tests to prevent duplication, and simplify referencing. -------------------------------------------------------------------------------- /_assets/art/Autumn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/Autumn.png -------------------------------------------------------------------------------- /_assets/art/BlueBird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/BlueBird.png -------------------------------------------------------------------------------- /_assets/art/Nepal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/Nepal.jpg -------------------------------------------------------------------------------- /_assets/art/Texas.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/Texas.jpg -------------------------------------------------------------------------------- /_assets/art/genericButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/genericButton.png -------------------------------------------------------------------------------- /_assets/art/genericButtonOver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/genericButtonOver.png -------------------------------------------------------------------------------- /_assets/art/ground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/ground.png -------------------------------------------------------------------------------- /_assets/art/hill1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/hill1.png -------------------------------------------------------------------------------- /_assets/art/hill2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/hill2.png -------------------------------------------------------------------------------- /_assets/art/image0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/image0.jpg -------------------------------------------------------------------------------- /_assets/art/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/image1.jpg -------------------------------------------------------------------------------- /_assets/art/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/image2.jpg -------------------------------------------------------------------------------- /_assets/art/image3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/image3.jpg -------------------------------------------------------------------------------- /_assets/art/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/loader.gif -------------------------------------------------------------------------------- /_assets/art/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/loading.gif -------------------------------------------------------------------------------- /_assets/art/runningGrant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/runningGrant.png -------------------------------------------------------------------------------- /_assets/art/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/sky.png -------------------------------------------------------------------------------- /_assets/art/spritesheet_font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/art/spritesheet_font.png -------------------------------------------------------------------------------- /_assets/audio/Thunder.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/audio/Thunder.mp3 -------------------------------------------------------------------------------- /_assets/audio/Thunder.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/audio/Thunder.ogg -------------------------------------------------------------------------------- /_assets/css/examples.css: -------------------------------------------------------------------------------- 1 | body { 2 | width: 960px; 3 | } 4 | 5 | header { 6 | margin-bottom: 1rem; 7 | width: 960px; 8 | } 9 | 10 | h1 { 11 | font-weight: 200; 12 | margin-bottom: 1rem; 13 | } 14 | 15 | h1:before { 16 | content:"PRELOADJS "; 17 | font-weight: bold; 18 | } 19 | 20 | header p { 21 | margin: 0; 22 | padding: 1em; 23 | background: rgba(250, 252, 255, 0.7); 24 | } 25 | 26 | .content, canvas { 27 | background: white; 28 | } 29 | 30 | .content { 31 | width: 960px; 32 | height: 400px; 33 | overflow: hidden; 34 | padding: 1em; 35 | box-sizing: border-box; 36 | } 37 | 38 | .loading { 39 | position: relative; 40 | } 41 | 42 | .loading:after { 43 | content: url("../art/loading.gif"); 44 | position: absolute; 45 | left: 50%; 46 | top: 50%; 47 | margin: -13px 0 0 -51px; 48 | opacity: 0.8; 49 | } 50 | 51 | #error, #mobile { 52 | width: 960px; 53 | height: 400px; 54 | display:none; 55 | text-align: left; 56 | padding: 1em; 57 | } 58 | 59 | body.embedded header { 60 | display: none; 61 | } 62 | 63 | body.embedded { 64 | margin: 0; 65 | } 66 | -------------------------------------------------------------------------------- /_assets/css/preloadjs.css: -------------------------------------------------------------------------------- 1 | h1:before { 2 | content:"PRELOADJS "; 3 | } 4 | -------------------------------------------------------------------------------- /_assets/css/shared.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 3em auto; 3 | padding: 0; 4 | background-color: #eaebee; 5 | font-family: Arial, Verdana, sans-serif; 6 | font-size: 14px; 7 | font-weight: normal; 8 | color: #333; 9 | line-height: 1.4em; 10 | } 11 | 12 | a:link, a:visited { 13 | color: #39f; 14 | text-decoration: none; 15 | } 16 | 17 | a:hover { 18 | text-decoration: underline; 19 | } 20 | 21 | h1, h2 { 22 | color: #FFF; 23 | font-size: 1.6em; 24 | margin-bottom: 0; 25 | padding: 1.5em; 26 | padding-bottom: 1.2em; 27 | background: #374252; 28 | text-transform: uppercase; 29 | } 30 | 31 | h1::after { 32 | display: block; 33 | content: ""; 34 | background: url('../art/logo_createjs.svg') no-repeat; 35 | height:1.5em; 36 | width: 6em; 37 | margin-top: -0.3em; 38 | float: right; 39 | } 40 | 41 | h1 em { 42 | font-weight: 200; 43 | font-style: normal; 44 | } 45 | 46 | h2 { 47 | font-size: 1.3em; 48 | padding: 1em; 49 | padding-bottom: 0.8em; 50 | } 51 | 52 | h3 { 53 | background: #e0e1e5; 54 | color: #374252; 55 | font-size: 1.25em; 56 | padding: 0.5em; 57 | margin-top: 1.25em; 58 | margin-bottom: -0.5em; 59 | position: relative; 60 | } 61 | 62 | code { 63 | color: black; 64 | background-color: rgba(255, 230, 0, 0.33); 65 | padding: 1px 3px; 66 | font-family: Courier New, Courier, serif; 67 | font-weight: bold; 68 | } -------------------------------------------------------------------------------- /_assets/fonts/regul-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/fonts/regul-bold.woff -------------------------------------------------------------------------------- /_assets/fonts/regul-book.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/fonts/regul-book.woff -------------------------------------------------------------------------------- /_assets/js/examples.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Very minimal shared code for examples. 3 | */ 4 | 5 | (function() { 6 | if (document.body) { setupEmbed(); } 7 | else { document.addEventListener("DOMContentLoaded", setupEmbed); } 8 | 9 | function setupEmbed() { 10 | if (window.top != window) { 11 | document.body.className += " embedded"; 12 | } 13 | } 14 | 15 | var o = window.examples = {}; 16 | o.showDistractor = function(id) { 17 | var div = id ? document.getElementById(id) : document.querySelector("div canvas").parentNode; 18 | div.className += " loading"; 19 | }; 20 | 21 | o.hideDistractor = function() { 22 | var div = document.querySelector(".loading"); 23 | div.className = div.className.replace(/\bloading\b/); 24 | }; 25 | })(); -------------------------------------------------------------------------------- /_assets/static/CabinBoy.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/static/CabinBoy.mp3 -------------------------------------------------------------------------------- /_assets/static/ManifestTest.json: -------------------------------------------------------------------------------- 1 | maps({ 2 | "path": "examples/assets/", 3 | "manifest": [ 4 | {"id":"Texas.jpg", "src":"Texas.jpg"}, 5 | {"id":"scriptExample", "src":"scriptExample.js"}, 6 | {"id":"grant.xml", "src":"grant.xml"}, 7 | {"id":"gbot.svg", "src":"gbot.svg"}, 8 | {"id":"grant.json", "src":"grant.json"}, 9 | {"id":"font.css", "src":"font.css"}, 10 | {"id":"Thunder.mp3", "src":"Thunder.mp3"}, 11 | {"id":"jsonpSample.json", "callback":"x", "type":"jsonp", "src":"jsonpSample.json"}, 12 | {"id":"Autumn.png", "src":"Autumn.png"}, 13 | ] 14 | }); 15 | -------------------------------------------------------------------------------- /_assets/static/MediaGridManifest.json: -------------------------------------------------------------------------------- 1 | loadMediaGrid({ 2 | "path": "../_assets/", 3 | "manifest": [ 4 | {"id":"art/Texas.jpg", "src":"art/Texas.jpg"}, 5 | {"id":"NoFileHere.png", "src":"NoFileHere.png"}, 6 | {"id":"static/bg.css", "src":"static/bg.css"}, 7 | {"id":"static/alert1.js", "src":"static/alert1.js"}, 8 | {"id":"static/grant.xml", "src":"static/grant.xml"}, 9 | {"id":"art/gbot.svg", "src":"art/gbot.svg"}, 10 | {"id":"static/grant.json", "src":"static/grant.json"}, 11 | {"id":"static/font.css", "src":"static/font.css"}, 12 | {"id":"audio/Thunder.mp3", "src":"audio/Thunder.mp3"}, 13 | {"id":"//gskinner.com/assets/createjs/mapsJSONP.json", "callback":"maps", "type":"jsonp", "src":"//gskinner.com/assets/createjs/mapsJSONP.json"}, 14 | {"id":"art/Autumn.png", "src":"art/Autumn.png"} 15 | ] 16 | }); 17 | -------------------------------------------------------------------------------- /_assets/static/alert1.js: -------------------------------------------------------------------------------- 1 | alert("The alert1.js script includes this alert!"); -------------------------------------------------------------------------------- /_assets/static/bg.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | background-color: #006000!important; 3 | } -------------------------------------------------------------------------------- /_assets/static/demoStyles.css: -------------------------------------------------------------------------------- 1 | /*Stylesheet*/ 2 | 3 | BODY, HTML { 4 | margin: 0; 5 | padding: 0; 6 | font-family: Arial, Verdana, sans-serif; 7 | font-size: 12px; 8 | font-weight: normal; 9 | color: #ccc; 10 | background-color: #333; 11 | } 12 | 13 | BODY {} 14 | 15 | 16 | p { 17 | margin: 10px 0; 18 | } 19 | 20 | a:link, a:visited { 21 | color: #e7841d; 22 | font-weight: bold; 23 | } 24 | a:hover { 25 | } 26 | 27 | #header { 28 | padding: 20px; 29 | background-color: #222; 30 | } 31 | #header h1 { 32 | font-weight: normal; 33 | font-size: 24px; 34 | margin: 0; 35 | padding: 0; 36 | } 37 | 38 | #header p { 39 | margin: 0; 40 | padding: 0; 41 | 42 | font-size: 14px; 43 | color: #777; 44 | } 45 | 46 | #header:after{ 47 | content: ""; 48 | position: absolute; 49 | } 50 | 51 | 52 | .content { 53 | width: 980px; 54 | height: 420px; 55 | padding: 10px; 56 | 57 | position: absolute; 58 | top: 50%; 59 | left: 50%; 60 | margin-top: -210px; 61 | margin-left: -490px; 62 | 63 | color: #777; 64 | 65 | border: 1px solid #555; 66 | background-color: #ccc; 67 | } 68 | 69 | #loader { 70 | display: none; 71 | } 72 | .loader { 73 | width: 100%; 74 | height: 50px; 75 | position: absolute; 76 | text-align:center; 77 | margin-top: 250px; 78 | background: url('loader.gif') no-repeat; 79 | background-position: 50% 50%; 80 | display: block !important; 81 | } 82 | 83 | #error { 84 | display:none; 85 | width: 960px; 86 | text-align: left; 87 | padding: 10px; 88 | } -------------------------------------------------------------------------------- /_assets/static/font.css: -------------------------------------------------------------------------------- 1 | div LABEL { 2 | color: #00A000 !important; 3 | } -------------------------------------------------------------------------------- /_assets/static/grant.json: -------------------------------------------------------------------------------- 1 | { 2 | "frames": { 3 | "width": 200, 4 | "numFrames": 64, 5 | "regX": 2, 6 | "regY": 2, 7 | "height": 361 8 | }, 9 | "animations": {"jump": [26, 63], "run": [0, 25]}, 10 | "images": ["../_assets/art/runningGrant.png"] 11 | } -------------------------------------------------------------------------------- /_assets/static/grant.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0,25 5 | 26,63 6 | 7 | 8 | src/runningGrant.png 9 | 10 | -------------------------------------------------------------------------------- /_assets/static/grantp.json: -------------------------------------------------------------------------------- 1 | grantp( 2 | { 3 | "frames": { 4 | "width": 200, 5 | "numFrames": 64, 6 | "regX": 2, 7 | "regY": 2, 8 | "height": 361 9 | }, 10 | "animations": {"jump": [26, 63], "run": [0, 25]}, 11 | "images": ["../_assets/art/runningGrant.png"] 12 | } 13 | ) -------------------------------------------------------------------------------- /_assets/static/jsonpSample.json: -------------------------------------------------------------------------------- 1 | x({ 2 | "test":"foo", 3 | "bar":[] 4 | }) 5 | -------------------------------------------------------------------------------- /_assets/static/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "../_assets/art/", 3 | "manifest": [ 4 | "image0.jpg", 5 | "image1.jpg", 6 | "image2.jpg", 7 | {"id":"image3", "src":"image3.jpg"} 8 | ] 9 | } -------------------------------------------------------------------------------- /_assets/static/manifestp.json: -------------------------------------------------------------------------------- 1 | loadManifest({ 2 | "path": "../_assets/art/", 3 | "manifest": [ 4 | "image0.jpg", 5 | "image1.jpg", 6 | "image2.jpg", 7 | {"id":"image3", "src":"image3.jpg"} 8 | ] 9 | }) -------------------------------------------------------------------------------- /_assets/static/scriptExample.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | window.foo = true; 3 | }()) 4 | -------------------------------------------------------------------------------- /_assets/static/video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/_assets/static/video.mp4 -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PreloadJS", 3 | "version": "1.0.0", 4 | "homepage": "https://github.com/CreateJS/PreloadJS", 5 | "authors": [ 6 | "gskinner", 7 | "lannymcnie", 8 | "wdamien" 9 | ], 10 | "description": "PreloadJS makes preloading assets & getting aggregate progress events easier in JavaScript. It uses XHR2 when available, and falls back to tag-based loading when not. Part of the CreateJS suite of libraries.", 11 | "main": "lib/preloadjs.js", 12 | "keywords": [ 13 | "preload", 14 | "xhr", 15 | "createjs" 16 | ], 17 | "license": "MIT", 18 | "ignore": [ 19 | "**/.*", 20 | "_assets", 21 | "node_modules", 22 | "bower_components", 23 | ".bower.json", 24 | "build", 25 | "docs", 26 | "examples", 27 | "extras", 28 | "icon.png", 29 | "LICENSE.txt", 30 | "README.md", 31 | "src", 32 | "tests", 33 | "VERSIONS.txt" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /build/BANNER: -------------------------------------------------------------------------------- 1 | /*! 2 | * <%= pkg.name %> 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | -------------------------------------------------------------------------------- /build/LICENSE: -------------------------------------------------------------------------------- 1 | /*! 2 | * @license <%= pkg.name %> 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2011-2015 gskinner.com, inc. 6 | * 7 | * Distributed under the terms of the MIT license. 8 | * http://www.opensource.org/licenses/mit-license.html 9 | * 10 | * This notice shall be included in all copies or substantial portions of the Software. 11 | */ 12 | -------------------------------------------------------------------------------- /build/README.md: -------------------------------------------------------------------------------- 1 | ## PreloadJS uses [Grunt](http://gruntjs.com/) to manage the build process. 2 | 3 | ## To use 4 | 5 | Note that this requires a familiarity with using the command line. The example commands shown are for use with the OSX Terminal. 6 | 7 | ### Install dependencies 8 | 9 | sass (3.3 or greater is required): 10 | 11 | # ruby is required for sass. Check http://sass-lang.com/install for dependencies. 12 | # Install (or update) sass 13 | gem install sass; 14 | 15 | Node (0.10.x or greater is required): 16 | 17 | # check the version via the command line 18 | node -v 19 | 20 | If your Node install is out of date, get the latest from [NodeJS.org](http://nodejs.org/) 21 | 22 | After node is setup, install the other dependencies. You may want to familiarize yourself with the Node Packager Manager (NPM) before proceeding. 23 | 24 | # Install the grunt command line utility globally 25 | sudo npm install grunt-cli -g 26 | 27 | # Change to the build directory, which contains package.json 28 | cd /path/to/libraryName/build/ 29 | 30 | # Install all the dependencies from package.json 31 | npm install 32 | 33 | ### Setup 34 | 35 | You can change the default settings to suit your local work environment by overriding them in a "config.local.json" file in the build directory. All paths can either be relative to the build folder, or absolute paths. 36 | 37 | * docs_out_path - Location of the uncompressed generated docs. 38 | 39 | ### Building 40 | To export a release build for this library run: 41 | 42 | grunt build 43 | 44 | This command will: 45 | 46 | * Update the version.js file(s) with the current date and version number from config 47 | * Create the {PROJECT_NAME}-{VERSION}.min.js file, and move it to ../lib 48 | * Generate the documentation in the docs_out_path from config 49 | * Create a zip file of the documentation and move it to ../docs 50 | 51 | **NEXT version** 52 | 53 | The same process as above, but uses "NEXT" as the version. This is used to generate minified builds with the latest source between release versions. 54 | 55 | grunt next 56 | 57 | **Combined File** 58 | 59 | The same as the NEXT process, but will not minify the source code. All code formatting and comments are left intact. 60 | 61 | grunt combine 62 | 63 | 64 | ### All commands 65 | 66 | * grunt build - Build everything based on the version in package.json 67 | * grunt next - Build everything using the NEXT version. 68 | * grunt combine - Build a NEXT version, but leave comments and formatting intact. 69 | * grunt docs - Build only the docs 70 | * grunt exportScriptTags - Export valid 34 | 35 | */ 36 | 37 | // Default Font 38 | $fontFamily-default: 'effra', sans-serif; 39 | // Weights: 400, 400 italic, 700 40 | 41 | 42 | // Secondary Font 43 | $fontFamily-secondary: 'Proxima Nova', sans-serif; 44 | // Weights: 400, 500 45 | 46 | // Monospace Font 47 | @import url("https://fonts.googleapis.com/css?family=Source+Code+Pro&subset=latin,latin-ext"); 48 | $fontFamily-monospace: 'Source Code Pro', monospace; 49 | // Weights: 400 50 | 51 | 52 | 53 | //******************************************* 54 | // 55 | // SIZE RAMP 56 | // Define your font sizes below 57 | // 58 | //******************************************* 59 | $fontSize-smallest: 1.5rem; 60 | $fontSize-smaller: 1.6rem; 61 | $fontSize-small: 2.2rem; 62 | $fontSize-default: 2.8rem; 63 | $fontSize-large: 3.8rem; 64 | $fontSize-larger: 5rem; 65 | $fontSize-largest: 9rem; 66 | $fontSize-display: 12rem; 67 | 68 | 69 | 70 | //******************************************* 71 | // 72 | // MODULAR SCALE 73 | // 74 | // 16px @ 1:1.333 75 | // 76 | // Pixels Ems 77 | // 1,192.803 74.55 78 | // 894.826 55.927 79 | // 671.287 41.955 80 | // 503.591 31.474 81 | // 377.788 23.612 82 | // 283.412 17.713 83 | // 212.612 13.288 84 | // 159.499 9.969 85 | // 119.654 7.478 86 | // 89.763 5.61 87 | // 67.339 4.209 88 | // 50.517 3.157 89 | // 37.897 2.369 90 | // 28.430 1.777 91 | // 21.328 1.333 92 | // 16.000 1 93 | // 12.003 0.75 94 | // 9.005 0.563 95 | // 6.755 0.422 96 | // 5.068 0.317 97 | // 3.802 0.238 98 | // 2.852 0.178 99 | // 2.140 0.134 100 | // 1.605 0.1 101 | // 1.204 0.075 102 | // 103 | // (source: http://modularscale.com/) 104 | // 105 | //******************************************* 106 | -------------------------------------------------------------------------------- /build/createjsTheme/assets/scss/settings/layout.scss: -------------------------------------------------------------------------------- 1 | //******************************************* 2 | // 3 | // LAYOUT SETTINGS 4 | // Default grid units settings used for layout by gBootstrap 5 | // 6 | // Sections 7 | // 1) GRID UNITS 8 | // 9 | //******************************************* 10 | 11 | 12 | 13 | //******************************************* 14 | // 15 | // GRID UNITS 16 | // 17 | //******************************************* 18 | $gridUnit-smallest: 0.9rem; 19 | $gridUnit-smaller: 1.6rem; 20 | $gridUnit-small: 2.1rem; 21 | $gridUnit-default: 2.8rem; 22 | $gridUnit-large: 3.8rem; 23 | $gridUnit-larger: 5rem; 24 | $gridUnit-largest: 9rem; -------------------------------------------------------------------------------- /build/createjsTheme/assets/scss/settings/path.scss: -------------------------------------------------------------------------------- 1 | //******************************************* 2 | // 3 | // PATH SETTINGS 4 | // Variables for defining file paths in your project 5 | // 6 | // Contents 7 | // 1) MY PROJECT 8 | // 2) PROJECT ASSETS 9 | // 10 | //******************************************* 11 | 12 | 13 | 14 | //******************************************* 15 | // 16 | // MY PROJECT 17 | // 18 | //******************************************* 19 | $path-myProject: "../../"; 20 | 21 | 22 | 23 | //******************************************* 24 | // 25 | // PROJECT ASSETS 26 | // 27 | //******************************************* 28 | $path-fonts: $path-myProject + "assets/fonts/"; 29 | $path-images: $path-myProject + "assets/images/"; 30 | -------------------------------------------------------------------------------- /build/createjsTheme/assets/scss/settings/transition.scss: -------------------------------------------------------------------------------- 1 | //******************************************* 2 | // 3 | // TRANSITION SETTINGS 4 | // Default transition settings used by gBootstrap 5 | // 6 | // Contents 7 | // 1) DURATIONS 8 | // 2) EASING 9 | // 3) COMBINATIONS 10 | // 11 | //******************************************* 12 | 13 | 14 | 15 | //******************************************* 16 | // 17 | // DURATIONS 18 | // 19 | //******************************************* 20 | $duration-short: 0.1s; 21 | $duration-default: 0.2s; 22 | $duration-long: 0.4s; 23 | $duration-longer: 0.6s; 24 | // $duration-longest: 0.8s; 25 | 26 | 27 | //******************************************* 28 | // 29 | // EASING 30 | // 31 | //******************************************* 32 | $ease-default: cubic-bezier( 0.6, 0.18, 0.32, 0.95 ); 33 | $ease-inOut: cubic-bezier( 0.55, 0, 0.45, 1 ); 34 | $ease-out: cubic-bezier( 0.4, 0.18, 0.32, 1 ); 35 | 36 | 37 | 38 | //******************************************* 39 | // 40 | // COMBINATIONS 41 | // 42 | //******************************************* 43 | $transition-short-default: $duration-short $ease-default; 44 | $transition-short-out: $duration-short $ease-out; 45 | $transition-short-inOut: $duration-short $ease-inOut; 46 | 47 | $transition-default-default: $duration-default $ease-default; 48 | $transition-default-inOut: $duration-default $ease-inOut; 49 | $transition-default-out: $duration-default $ease-out; 50 | 51 | $transition-long-default: $duration-long $ease-default; 52 | $transition-long-inOut: $duration-long $ease-inOut; 53 | $transition-long-out: $duration-long $ease-out; 54 | 55 | $transition-longer-default: $duration-longer $ease_default; 56 | $transition-longer-out: $duration-longer $ease_out; 57 | 58 | -------------------------------------------------------------------------------- /build/createjsTheme/assets/scss/utilities/breakpoint.scss: -------------------------------------------------------------------------------- 1 | //******************************************* 2 | // 3 | // BREAKPOINT UTILITY 4 | // 5 | // Description 6 | // - Utilities for creating breakpoints 7 | // 8 | // Contents 9 | // 1) WIDTH 10 | // 2) HEIGHT 11 | // 3) ASPEECT RATIO 12 | // 4) ORIENTATION 13 | // 5) PIXEL DENSITY 14 | // 15 | // Notes 16 | // - Default prefix favors mobile and portrait first design principles. 17 | // 18 | // Acknowledgements: 19 | // Chris Coyier: http://css-tricks.com/media-queries-sass-3-2-and-codekit/ 20 | // 21 | //******************************************* 22 | 23 | 24 | 25 | //******************************************* 26 | // 27 | // WIDTH OR HEIGHT 28 | // 29 | // Notes 30 | // - also accepts orientation, and prefix params (min-, max-, min-device-, max-device-) 31 | // - supports end range 32 | // 33 | //******************************************* 34 | 35 | @mixin bp ($bp, $prefix: min-, $bpEndRange: null, $orientation: null, $direction: width, $endRangePrefix: max-) { 36 | 37 | // Define focus direction of breakpoint statement (width or height) 38 | @if $direction == "height" { 39 | $prefix: $prefix + "height: "; 40 | } @else { 41 | $prefix: $prefix + "width: "; 42 | } 43 | 44 | // Re-define orientation variable if value exists 45 | @if $orientation != null { 46 | $orientation: "orientation:" + $orientation; 47 | } 48 | 49 | // Output statement for single condition value (includes orientation if applied) 50 | @if $bpEndRange == null { 51 | 52 | @if $orientation == null { // Checks to see if there is an orientation value 53 | @media ($prefix $bp) { @content }; 54 | } @else { 55 | @media ($prefix $bp) and ($orientation) { @content; } 56 | } 57 | 58 | // Output statement for end range condition value (includes orientation if applied) 59 | } @else { 60 | 61 | // Define focus direction of breakpoint end range statement (width or height) 62 | @if $direction == "height" { 63 | $endRangePrefix: $endRangePrefix + "height: "; 64 | } @else { 65 | $endRangePrefix: $endRangePrefix + "width: "; 66 | } 67 | 68 | @if $orientation == null { // Checks to see if there is an orientation value 69 | @media ($prefix $bp) and ($endRangePrefix $bpEndRange) { @content }; 70 | } @else { 71 | @media ($prefix $bp) and ($endRangePrefix $bpEndRange) and ($orientation) { @content; } 72 | } 73 | 74 | } 75 | } 76 | 77 | 78 | //******************************************* 79 | // 80 | // ASPECT RATIO 81 | // 82 | // Notes 83 | // - $aspectRatio syntax '16/9' 84 | // 85 | //******************************************* 86 | // Aspect Ratio with width limitation 87 | @mixin bpAspectRatio ($aspectRatio: null, $width: null) { 88 | @if $aspectRatio != null { 89 | @if $width == null { 90 | @media (max-aspect-ratio: $aspectRatio) { @content; } 91 | } @else { 92 | @media (max-aspect-ratio: $aspectRatio) and (min-width: $width) { @content; } 93 | } 94 | } 95 | } 96 | 97 | 98 | 99 | //******************************************* 100 | // 101 | // ORIENTATION 102 | // 103 | //******************************************* 104 | @mixin bpOrientation ($orientation: portrait, $width: null, $prefix: min-) { 105 | $width-prefix: $prefix + "width: "; 106 | @if $width == null { 107 | @media (orientation: $orientation) { @content; } 108 | } @else { 109 | @media (orientation: $orientation) and ($width-prefix $width) { @content; } 110 | } 111 | } 112 | 113 | 114 | 115 | //******************************************* 116 | // 117 | // PIXEL DENSITIES 118 | // 119 | // Common Device Pixel Ratios 120 | // 1.25, 1.3, 1.5, 2 121 | // 122 | //******************************************* 123 | @mixin bpPixelDensity ($pd: 2) { 124 | // 1.25 125 | @if $pd == 1.25 { 126 | @media (-webkit-min-device-pixel-ratio: $pd), 127 | (min-resolution: 120dpi) { @content; } 128 | } 129 | // 1.3 130 | @if $pd == 1.3 { 131 | @media (-webkit-min-device-pixel-ratio: $pd), 132 | (min-resolution: 124.8dpi) { @content; } 133 | } 134 | // 1.5 135 | @if $pd == 1.5 { 136 | @media (-webkit-min-device-pixel-ratio: $pd), 137 | (min-resolution: 144dpi) { @content; } 138 | } 139 | // 2 140 | @if $pd == 2 { 141 | @media (-webkit-min-device-pixel-ratio: $pd), 142 | (min-resolution: 192dpi) { @content; } 143 | } 144 | } -------------------------------------------------------------------------------- /build/createjsTheme/assets/scss/utilities/clearfix.scss: -------------------------------------------------------------------------------- 1 | //******************************************* 2 | // 3 | // CLEAR FIX UTILITIES 4 | // 5 | // Details 6 | // - Utility for clearing floats 7 | // 8 | // Contents 9 | // 1) CLEARFIX 10 | // 11 | //******************************************* 12 | 13 | 14 | 15 | //******************************************* 16 | // 17 | // CLEARFIX 18 | // 19 | //******************************************* 20 | %clearfix { 21 | zoom: 1; // For IE 6/7 (trigger hasLayout) 22 | &::before, 23 | &::after { 24 | content: ""; 25 | display: table; 26 | } 27 | &::after { clear: both; } 28 | } 29 | -------------------------------------------------------------------------------- /build/createjsTheme/layouts/main.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{projectName}} v{{projectVersion}} API Documentation : {{name}} 11 | 12 | 13 | 14 |
15 |
16 |
17 | {{#if projectLogo}} 18 |

19 | {{else}} 20 |

21 | {{/if}} 22 |
23 |
24 | API Documentation for: {{projectVersion}} 25 |
26 |
27 |
28 | 29 |
30 | 33 |
34 |
35 | {{>options}} 36 |
37 |
38 |
39 | {{>layout_content}} 40 |
41 |
42 |
43 |
44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /build/createjsTheme/layouts/xhr.handlebars: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /build/createjsTheme/partials/events.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

{{name}}

3 | {{#crossLink type}}{{/crossLink}} 4 | 5 | {{#if deprecated}} 6 | deprecated 7 | {{/if}} 8 | 9 | {{#if access}} 10 | {{access}} 11 | {{/if}} 12 | 13 | {{#if final}} 14 | final 15 | {{/if}} 16 | 17 | {{#if static}} 18 | static 19 | {{/if}} 20 | 21 |
22 | {{#if overwritten_from}} 23 |

Inherited from 24 | 25 | {{overwritten_from/class}} 26 | 27 | {{#if foundAt}} 28 | but overwritten in 29 | {{/if}} 30 | {{else}} 31 | {{#if extended_from}} 32 |

Inherited from 33 | {{extended_from}}: 34 | {{else}} 35 | {{#providedBy}} 36 |

Provided by the {{.}} module.

37 | {{/providedBy}} 38 |

39 | {{#if foundAt}} 40 | Defined in 41 | {{/if}} 42 | {{/if}} 43 | {{/if}} 44 | {{#if foundAt}} 45 | `{{{name}}}:{{{line}}}` 46 | {{/if}} 47 |

48 | 49 | {{#if deprecationMessage}} 50 |

Deprecated: {{deprecationMessage}}

51 | {{/if}} 52 | 53 | {{#if since}} 54 |

Available since {{since}}

55 | {{/if}} 56 |
57 | 58 |
59 | {{{eventDescription}}} 60 |
61 | 62 | {{#if params}} 63 |
64 |

Event Payload:

65 | 66 | 124 |
125 | {{/if}} 126 | 127 | 128 | {{#example}} 129 |
130 |

Example:

131 | 132 |
133 | {{{.}}} 134 |
135 |
136 | {{/example}} 137 |
138 | -------------------------------------------------------------------------------- /build/createjsTheme/partials/files.handlebars: -------------------------------------------------------------------------------- 1 | 4 |

File:{{#path name}} {{/path}}

5 | 6 |
7 |
 8 | {{fileData}}
 9 |     
10 |
11 | -------------------------------------------------------------------------------- /build/createjsTheme/partials/index.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /build/createjsTheme/partials/module.handlebars: -------------------------------------------------------------------------------- 1 |

{{name}} Module

2 |
3 | {{#extra}} 4 | {{#selleck}} 5 | User Guide & Examples 6 | {{/selleck}} 7 | {{/extra}} 8 | 9 | {{#if requires}} 10 |
11 | Requires 12 | 17 |
18 | {{/if}} 19 | 20 | {{#if foundAt}} 21 |
22 | Defined in: `{{{name}}}:{{{line}}}` 23 |
24 | {{/if}} 25 | 26 | {{#if since}} 27 |

Available since {{since}}

28 | {{/if}} 29 |
30 | 31 | {{#if deprecated}} 32 |
33 |

34 | {{#if deprecationMessage}} 35 | Deprecated: {{deprecationMessage}} 36 | {{else}} 37 | This module is deprecated. 38 | {{/if}} 39 |

40 |
41 | {{/if}} 42 | 43 |
44 | {{{moduleDescription}}} 45 |
46 | 47 | {{#example}} 48 |
49 |

Example:

50 |
51 | {{{.}}} 52 |
53 |
54 | {{/example}} 55 | 56 |
57 |
58 | {{#if moduleClasses}} 59 |

This module provides the following classes:

60 | 61 | 70 | {{/if}} 71 |
72 | 73 |
74 | {{#if subModules}} 75 |

This module is a rollup of the following modules:

76 | 77 | 90 | {{/if}} 91 |
92 |
93 | -------------------------------------------------------------------------------- /build/createjsTheme/partials/options.handlebars: -------------------------------------------------------------------------------- 1 |
2 | Show: 3 | 7 | 8 | 12 | 13 | 17 | 21 | 22 |
-------------------------------------------------------------------------------- /build/createjsTheme/partials/props.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

{{name}}

3 | {{#crossLink type}}{{/crossLink}} 4 | 5 | {{#if deprecated}} 6 | deprecated 7 | {{/if}} 8 | 9 | {{#if access}} 10 | {{access}} 11 | {{/if}} 12 | 13 | {{#if final}} 14 | final 15 | {{/if}} 16 | 17 | {{#if static}} 18 | static 19 | {{/if}} 20 | 21 | {{#if readonly}} 22 | readonly 23 | {{/if}} 24 | 25 |
26 | {{#if overwritten_from}} 27 |

Inherited from 28 | 29 | {{overwritten_from/class}} 30 | 31 | {{#if foundAt}} 32 | but overwritten in 33 | {{/if}} 34 | {{else}} 35 | {{#if extended_from}} 36 |

Inherited from 37 | {{extended_from}}: 38 | {{else}} 39 | {{#providedBy}} 40 |

Provided by the {{.}} module.

41 | {{/providedBy}} 42 |

43 | {{#if foundAt}} 44 | Defined in 45 | {{/if}} 46 | {{/if}} 47 | {{/if}} 48 | {{#if foundAt}} 49 | `{{{name}}}:{{{line}}}` 50 | {{/if}} 51 |

52 | 53 | {{#if deprecationMessage}} 54 |

Deprecated: {{deprecationMessage}}

55 | {{/if}} 56 | 57 | {{#if since}} 58 |

Available since {{since}}

59 | {{/if}} 60 |
61 | 62 |
63 | {{{propertyDescription}}} 64 |
65 | 66 | {{#if default}} 67 |

Default: {{default}}

68 | {{/if}} 69 | 70 | {{#example}} 71 |
72 |

Example:

73 | 74 |
75 | {{{.}}} 76 |
77 |
78 | {{/example}} 79 | 80 | {{#if subprops}} 81 |

Sub-properties:

82 | 83 | 122 | {{/if}} 123 |
124 | -------------------------------------------------------------------------------- /build/createjsTheme/partials/sidebar.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

APIs

3 |
4 | 7 | 8 |
9 | 10 |
11 | 12 |
13 | 18 | 19 | 24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /build/createjsTheme/theme.json: -------------------------------------------------------------------------------- 1 | { 2 | "yuiGridsUrl": "../assets/css/yui-cssgrids-min.css", 3 | "yuiSeedUrl": "../assets/js/yui-source.js" 4 | } 5 | -------------------------------------------------------------------------------- /build/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PreloadJS", 3 | "version": "1.0.0", 4 | "description": "PreloadJS Docs", 5 | "url": "http://www.createjs.com/preloadjs", 6 | "logo": "assets/docs-icon-PreloadJS.png", 7 | "repository": "git@github.com:CreateJS/PreloadJS.git", 8 | "devDependencies": { 9 | "grunt": "~0.4.5", 10 | "grunt-contrib-concat": "~0.5.0", 11 | "grunt-contrib-uglify": "~0.6.0", 12 | "grunt-contrib-yuidoc": "~0.5.2", 13 | "grunt-contrib-compress": "~0.12.0", 14 | "grunt-contrib-copy": "~0.7.0", 15 | "grunt-contrib-sass": "^0.8.1", 16 | "grunt-contrib-clean":"^0.4.0", 17 | "lodash": "~0.9.2" 18 | }, 19 | "engine": "node >= 0.10.22" 20 | } 21 | -------------------------------------------------------------------------------- /build/path.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | path: function(str) { 3 | return str.substr(str.lastIndexOf("/")+1); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /build/tasks/updatebower.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | 3 | grunt.registerTask('updatebower', function() { 4 | var file = '../bower.json'; 5 | var version = grunt.config.get('version'); 6 | 7 | if (!grunt.file.exists(file)) { 8 | grunt.log.error(file+' not found.'); 9 | return; 10 | } 11 | if (version == "NEXT") { 12 | grunt.log.error("NEXT versions are not submitted to Bower."); 13 | return; 14 | } 15 | 16 | var json = grunt.file.readJSON(file); 17 | json.version = version; 18 | json.main = json.main.replace(/\d\.\d\.\d|NEXT/, version); 19 | grunt.file.write(file, JSON.stringify(json, null, '\t')); 20 | }); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /build/tasks/updateversion.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | 3 | grunt.registerMultiTask('updateversion', function() { 4 | var newValues = {date:new Date().toUTCString(), version:this.data.version}; 5 | replaceMetaData(this.data.file, newValues); 6 | }); 7 | 8 | grunt.registerMultiTask('clearversion', function() { 9 | // Don't clear the version when building everything (the combined build will run this after its done) 10 | var buildArgs = grunt.config("buildArgs"); 11 | if (buildArgs && buildArgs[0] == "all") { 12 | return; 13 | } 14 | replaceMetaData(this.data.file, {date:"", version:""}); 15 | }); 16 | 17 | function replaceMetaData(file, values) { 18 | if (!grunt.file.exists(file)) { 19 | grunt.log.error(file+' not found.'); 20 | return; 21 | } 22 | 23 | var str = grunt.file.read(file); 24 | 25 | for(var n in values) { 26 | var pattern = new RegExp("(\/\\*="+n+"\\*\/\")(.*)(\";)", "g"); 27 | var result = pattern.test(str); 28 | if (result) { 29 | str = str.replace(pattern, "$1"+values[n]+"$3"); 30 | } else { 31 | grunt.log.error("Error -- Unable to resolve value:"+ pattern); 32 | } 33 | } 34 | grunt.file.write(file, str); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /build/updates/README.md: -------------------------------------------------------------------------------- 1 | ## Important ## 2 | 3 | The current YUIDocs does not support @readonly on properties (only attributes). This folder contains an updated 4 | `builder.js`, which injects this support. 5 | 6 | Copy `builder.js` into 7 | > node_modules/grunt-contrib-yuidoc/node-modules/yuidocjs/lib 8 | 9 | Without this file, properties will not show the "readonly" flag. 10 | 11 | Last tested with YUIDocs 0.5.2 -------------------------------------------------------------------------------- /docs/PreloadJS_docs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/docs/PreloadJS_docs.zip -------------------------------------------------------------------------------- /docs/preloadjs_docs-NEXT.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/docs/preloadjs_docs-NEXT.zip -------------------------------------------------------------------------------- /examples/CustomLoader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PreloadJS: Custom Loader 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | 26 | 27 | 28 | 29 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /examples/FontLoader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PreloadJS: Font Loading 5 | 6 | 7 | 8 | 9 | 19 | 20 | 21 | 22 | 30 | 31 | 32 | 33 | 34 | 48 | 49 | 118 | 119 | Load CSS Source | 120 | Load CSS Source List | 121 | Load Manual List | 122 | Load CSS Tag | 123 | Load Google Fonts 124 | 125 | 126 |
127 | Hello World! 128 |
129 |
130 | Hello World (bold)! 131 |
132 |
133 | Hello World (google)! 134 |
135 |
136 | 137 |
138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /examples/PluginSample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PreloadJS: Plugin Sample 5 | 6 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 22 |
23 |

Example: Plugin

24 | 25 |

In this example, a PreloadJS plugin is defined, which parses a load item 26 | into an HTML image ID that is 27 | already present in the HTML DOM. PreloadJS will then use the image to do 28 | the loading, and the image 29 | will be displayed in its defined position when it is loaded.

30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /examples/PreloadImages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Preload Images example 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |

Image Gallery

15 | 16 |

This sample loads a number of images, and adds them to a canvas stage when they are complete. Click an image 17 | to put it at the back of the stack.

18 | 19 |

Note that when loading images locally, you need to ensure that PreloadJS uses tag loading or CORS to avoid 20 | cross-origin errors. Mouse interaction on images may not work locally when these errors occur.

21 |
22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /examples/SpriteSheet.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EaselJS: Sprite Sheet Example 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |

Sprite Sheets

13 | 14 |

An example of the SpriteSheetLoader, which automatically parses loaded JSON, and will internally preload 15 | associated images and instantiate a SpriteSheet instance before the complete event is fired.

16 |

Some browsers can not load images or access pixel data when running local files, and may throw a security 17 | error or not work unless the content is running on a server.

18 |
19 | 20 |
21 | 22 |
23 | 24 | 25 | 26 | 28 | 29 | 31 | 32 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /extras/README.txt: -------------------------------------------------------------------------------- 1 | This directory includes additional code and snippets that might be useful. 2 | 3 | ** sample.htaccess ** 4 | A linux/unix .htaccess file, which provides a cross-origin header to files served from this directory. This is useful 5 | for setting up images served on a domain other than where the application is served from. Images must include a 6 | crossOrigin="Anonymous" attribute. Rename this file to ".htaccess", or add its contents to an existing .htacess file. -------------------------------------------------------------------------------- /extras/sample.htaccess: -------------------------------------------------------------------------------- 1 | Header set Access-Control-Allow-Origin "*" -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/icon.png -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | # lib directory 2 | This directory contains compressed versions of the PreloadJS library, including the most recent tagged release and the 3 | in-progress NEXT release. 4 | 5 | Both combined and minified versions of the library are included. The former being useful for debugging, and the latter 6 | for deployment. 7 | 8 | You can also link to the libraries on the [CreateJS CDN](http://code.createjs.com/), to benefit from faster load times 9 | and shared caching across sites. 10 | 11 | 12 | # libraries 13 | * **preloadjs.js** the most recent _tagged_ version of all the PreloadJS classes. 14 | * **preloadjs.min.js** the most recent tagged version, minified and stripped of comments and whitespace. 15 | * **preloadjs-NEXT.js** contains the _latest_ PreloadJS classes. 16 | * **preloadjs-NEXT.min.js** is a minified version of the _latest updates_ to the library. 17 | 18 | 19 | # license 20 | The libraries are ©2017 gskinner.com, inc., and made available under the highly permissive MIT open source software 21 | license. See the source file header for the full license text. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "preloadjs", 3 | "npmName": "preloadjs", 4 | "version": "1.0.1", 5 | "description": "PreloadJS makes it easy to preload your assets: images, sounds, JavaScript, fonts, JSON, and text data", 6 | "main": "lib/preloadjs.js", 7 | "jsdelivr": "lib/preloadjs.min.js", 8 | "directories": { 9 | "doc": "docs", 10 | "example": "examples", 11 | "lib": "lib", 12 | "test": "tests" 13 | }, 14 | "npmFileMap": [ 15 | { 16 | "basePath": "lib", 17 | "files": [ 18 | "**/*" 19 | ] 20 | } 21 | ], 22 | "repository": { 23 | "type": "git", 24 | "url": "git+https://github.com/CreateJS/PreloadJS.git" 25 | }, 26 | "keywords": [ 27 | "createjs", 28 | "preloadjs", 29 | "gskinner", 30 | "preload", 31 | "preloading", 32 | "progress", 33 | "XHR", 34 | "javascript", 35 | "html5" 36 | ], 37 | "author": "gskinner.com, inc.", 38 | "license": "MIT", 39 | "bugs": { 40 | "url": "https://github.com/CreateJS/PreloadJS/issues" 41 | }, 42 | "homepage": "https://createjs.com/preloadjs/" 43 | } 44 | -------------------------------------------------------------------------------- /spikes/FontLoading/fonts/regul-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/spikes/FontLoading/fonts/regul-bold.woff -------------------------------------------------------------------------------- /spikes/FontLoading/fonts/regul-book.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/spikes/FontLoading/fonts/regul-book.woff -------------------------------------------------------------------------------- /spikes/FontLoading/testArr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 33 |
34 | Hello World! 35 |
36 |
37 | Hello World! 38 |
39 |
40 | 41 | 42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /spikes/FontLoading/testArrSrc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 23 |
24 | Hello World! 25 |
26 |
27 | Hello World! 28 |
29 |
30 | 31 | 32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /spikes/FontLoading/testCSS.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 20 | 21 | 22 | 23 | 24 | 33 |
34 | Hello World! 35 |
36 |
37 | Hello World! 38 |
39 |
40 | 41 | 42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /spikes/FontLoading/testGoogleFonts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 20 |
21 | Hello World! 22 |
23 |
24 | 25 | 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /spikes/FontLoading/testSrc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 22 |
23 | Hello World! 24 |
25 |
26 | 27 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /spikes/FontLoading/typekit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/createjs/events/ErrorEvent.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Event 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | (function() { 37 | "use strict"; 38 | 39 | /** 40 | * A general error {{#crossLink "Event"}}{{/crossLink}}, that describes an error that occurred, as well as any details. 41 | * @class ErrorEvent 42 | * @param {String} [title] The error title 43 | * @param {String} [message] The error description 44 | * @param {Object} [data] Additional error data 45 | * @constructor 46 | */ 47 | function ErrorEvent(title, message, data) { 48 | this.Event_constructor("error"); 49 | 50 | /** 51 | * The short error title, which indicates the type of error that occurred. 52 | * @property title 53 | * @type String 54 | */ 55 | this.title = title; 56 | 57 | /** 58 | * The verbose error message, containing details about the error. 59 | * @property message 60 | * @type String 61 | */ 62 | this.message = message; 63 | 64 | /** 65 | * Additional data attached to an error. 66 | * @property data 67 | * @type {Object} 68 | */ 69 | this.data = data; 70 | } 71 | 72 | var p = createjs.extend(ErrorEvent, createjs.Event); 73 | 74 | p.clone = function() { 75 | return new createjs.ErrorEvent(this.title, this.message, this.data); 76 | }; 77 | 78 | createjs.ErrorEvent = createjs.promote(ErrorEvent, "Event"); 79 | 80 | }()); -------------------------------------------------------------------------------- /src/createjs/utils/deprecate.js: -------------------------------------------------------------------------------- 1 | /* 2 | * extend 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Wraps deprecated methods so they still be used, but throw warnings to developers. 42 | * 43 | * obj.deprecatedMethod = createjs.deprecate("Old Method Name", obj._fallbackMethod); 44 | * 45 | * The recommended approach for deprecated properties is: 46 | * 47 | * try { 48 | * Obj ect.defineProperties(object, { 49 | * readyOnlyProp: { get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }) }, 50 | * readWriteProp: { 51 | * get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }), 52 | * set: createjs.deprecate("readOnlyProp", function(val) { this.alternateProp = val; }) 53 | * }); 54 | * } catch (e) {} 55 | * 56 | * @method deprecate 57 | * @param {Function} [fallbackMethod=null] A method to call when the deprecated method is used. See the example for how 58 | * @param {String} [name=null] The name of the method or property to display in the console warning. 59 | * to deprecate properties. 60 | * @return {Function} If a fallbackMethod is supplied, returns a closure that will call the fallback method after 61 | * logging the warning in the console. 62 | */ 63 | createjs.deprecate = function(fallbackMethod, name) { 64 | "use strict"; 65 | return function() { 66 | var msg = "Deprecated property or method '"+name+"'. See docs for info."; 67 | console && (console.warn ? console.warn(msg) : console.log(msg)); 68 | return fallbackMethod && fallbackMethod.apply(this, arguments); 69 | } 70 | }; -------------------------------------------------------------------------------- /src/createjs/utils/extend.js: -------------------------------------------------------------------------------- 1 | /* 2 | * extend 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Sets up the prototype chain and constructor property for a new class. 42 | * 43 | * This should be called right after creating the class constructor. 44 | * 45 | * function MySubClass() {} 46 | * createjs.extend(MySubClass, MySuperClass); 47 | * MySubClass.prototype.doSomething = function() { } 48 | * 49 | * var foo = new MySubClass(); 50 | * console.log(foo instanceof MySuperClass); // true 51 | * console.log(foo.prototype.constructor === MySubClass); // true 52 | * 53 | * @method extend 54 | * @param {Function} subclass The subclass. 55 | * @param {Function} superclass The superclass to extend. 56 | * @return {Function} Returns the subclass's new prototype. 57 | */ 58 | createjs.extend = function(subclass, superclass) { 59 | "use strict"; 60 | 61 | function o() { this.constructor = subclass; } 62 | o.prototype = superclass.prototype; 63 | return (subclass.prototype = new o()); 64 | }; 65 | -------------------------------------------------------------------------------- /src/createjs/utils/indexOf.js: -------------------------------------------------------------------------------- 1 | /* 2 | * indexOf 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Finds the first occurrence of a specified value searchElement in the passed in array, and returns the index of 42 | * that value. Returns -1 if value is not found. 43 | * 44 | * var i = createjs.indexOf(myArray, myElementToFind); 45 | * 46 | * @method indexOf 47 | * @param {Array} array Array to search for searchElement 48 | * @param searchElement Element to find in array. 49 | * @return {Number} The first index of searchElement in array. 50 | */ 51 | createjs.indexOf = function (array, searchElement){ 52 | "use strict"; 53 | 54 | for (var i = 0,l=array.length; i < l; i++) { 55 | if (searchElement === array[i]) { 56 | return i; 57 | } 58 | } 59 | return -1; 60 | }; 61 | -------------------------------------------------------------------------------- /src/createjs/utils/promote.js: -------------------------------------------------------------------------------- 1 | /* 2 | * promote 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Promotes any methods on the super class that were overridden, by creating an alias in the format `prefix_methodName`. 42 | * It is recommended to use the super class's name as the prefix. 43 | * An alias to the super class's constructor is always added in the format `prefix_constructor`. 44 | * This allows the subclass to call super class methods without using `function.call`, providing better performance. 45 | * 46 | * For example, if `MySubClass` extends `MySuperClass`, and both define a `draw` method, then calling `promote(MySubClass, "MySuperClass")` 47 | * would add a `MySuperClass_constructor` method to MySubClass and promote the `draw` method on `MySuperClass` to the 48 | * prototype of `MySubClass` as `MySuperClass_draw`. 49 | * 50 | * This should be called after the class's prototype is fully defined. 51 | * 52 | * function ClassA(name) { 53 | * this.name = name; 54 | * } 55 | * ClassA.prototype.greet = function() { 56 | * return "Hello "+this.name; 57 | * } 58 | * 59 | * function ClassB(name, punctuation) { 60 | * this.ClassA_constructor(name); 61 | * this.punctuation = punctuation; 62 | * } 63 | * createjs.extend(ClassB, ClassA); 64 | * ClassB.prototype.greet = function() { 65 | * return this.ClassA_greet()+this.punctuation; 66 | * } 67 | * createjs.promote(ClassB, "ClassA"); 68 | * 69 | * var foo = new ClassB("World", "!?!"); 70 | * console.log(foo.greet()); // Hello World!?! 71 | * 72 | * @method promote 73 | * @param {Function} subclass The class to promote super class methods on. 74 | * @param {String} prefix The prefix to add to the promoted method names. Usually the name of the superclass. 75 | * @return {Function} Returns the subclass. 76 | */ 77 | createjs.promote = function(subclass, prefix) { 78 | "use strict"; 79 | 80 | var subP = subclass.prototype, supP = (Object.getPrototypeOf&&Object.getPrototypeOf(subP))||subP.__proto__; 81 | if (supP) { 82 | subP[(prefix+="_") + "constructor"] = supP.constructor; // constructor is not always innumerable 83 | for (var n in supP) { 84 | if (subP.hasOwnProperty(n) && (typeof supP[n] == "function")) { subP[prefix + n] = supP[n]; } 85 | } 86 | } 87 | return subclass; 88 | }; 89 | -------------------------------------------------------------------------------- /src/createjs/utils/proxy.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Proxy 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * Various utilities that the CreateJS Suite uses. Utilities are created as separate files, and will be available on the 38 | * createjs namespace directly. 39 | * 40 | *

Example

41 | * 42 | * myObject.addEventListener("change", createjs.proxy(myMethod, scope)); 43 | * 44 | * @class Utility Methods 45 | * @main Utility Methods 46 | */ 47 | 48 | (function() { 49 | "use strict"; 50 | 51 | /** 52 | * A function proxy for methods. By default, JavaScript methods do not maintain scope, so passing a method as a 53 | * callback will result in the method getting called in the scope of the caller. Using a proxy ensures that the 54 | * method gets called in the correct scope. 55 | * 56 | * Additional arguments can be passed that will be applied to the function when it is called. 57 | * 58 | *

Example

59 | * 60 | * myObject.addEventListener("event", createjs.proxy(myHandler, this, arg1, arg2)); 61 | * 62 | * function myHandler(arg1, arg2) { 63 | * // This gets called when myObject.myCallback is executed. 64 | * } 65 | * 66 | * @method proxy 67 | * @param {Function} method The function to call 68 | * @param {Object} scope The scope to call the method name on 69 | * @param {mixed} [arg] * Arguments that are appended to the callback for additional params. 70 | * @public 71 | * @static 72 | */ 73 | createjs.proxy = function (method, scope) { 74 | var aArgs = Array.prototype.slice.call(arguments, 2); 75 | return function () { 76 | return method.apply(scope, Array.prototype.slice.call(arguments, 0).concat(aArgs)); 77 | }; 78 | } 79 | 80 | }()); 81 | -------------------------------------------------------------------------------- /src/preloadjs/data/Methods.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Methods 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function() { 38 | 39 | "use strict"; 40 | 41 | /** 42 | * Defines the method types for XHR requests. Currently, PreloadJS only supports "POST" and "GET", however 43 | * any HTML method can be used with PreloadJS utilities. 44 | * 45 | * @class Methods 46 | * @static 47 | */ 48 | var s = {}; 49 | 50 | /** 51 | * Defines a POST request, use for a method value when loading data. 52 | * @property POST 53 | * @type {string} 54 | * @default post 55 | * @static 56 | */ 57 | s.POST = "POST"; 58 | 59 | /** 60 | * Defines a GET request, use for a method value when loading data. 61 | * @property GET 62 | * @type {string} 63 | * @default get 64 | * @static 65 | */ 66 | s.GET = "GET"; 67 | 68 | createjs.Methods = s; 69 | }()); 70 | -------------------------------------------------------------------------------- /src/preloadjs/events/ProgressEvent.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ProgressEvent 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function (scope) { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A CreateJS {{#crossLink "Event"}}{{/crossLink}} that is dispatched when progress changes. 43 | * @class ProgressEvent 44 | * @param {Number} loaded The amount that has been loaded. This can be any number relative to the total. 45 | * @param {Number} [total=1] The total amount that will load. This will default to 1, so if the `loaded` value is 46 | * a percentage (between 0 and 1), it can be omitted. 47 | * @todo Consider having this event be a "fileprogress" event as well 48 | * @constructor 49 | */ 50 | function ProgressEvent(loaded, total) { 51 | this.Event_constructor("progress"); 52 | 53 | /** 54 | * The amount that has been loaded (out of a total amount) 55 | * @property loaded 56 | * @type {Number} 57 | */ 58 | this.loaded = loaded; 59 | 60 | /** 61 | * The total "size" of the load. 62 | * @property total 63 | * @type {Number} 64 | * @default 1 65 | */ 66 | this.total = (total == null) ? 1 : total; 67 | 68 | /** 69 | * The percentage (out of 1) that the load has been completed. This is calculated using `loaded/total`. 70 | * @property progress 71 | * @type {Number} 72 | * @default 0 73 | */ 74 | this.progress = (total == 0) ? 0 : this.loaded / this.total; 75 | }; 76 | 77 | var p = createjs.extend(ProgressEvent, createjs.Event); 78 | 79 | /** 80 | * Returns a clone of the ProgressEvent instance. 81 | * @method clone 82 | * @return {ProgressEvent} a clone of the Event instance. 83 | **/ 84 | p.clone = function() { 85 | return new createjs.ProgressEvent(this.loaded, this.total); 86 | }; 87 | 88 | createjs.ProgressEvent = createjs.promote(ProgressEvent, "Event"); 89 | 90 | }(window)); -------------------------------------------------------------------------------- /src/preloadjs/loaders/AbstractMediaLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * AbstractMediaLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * The AbstractMediaLoader is a base class that handles some of the shared methods and properties of loaders that 43 | * handle HTML media elements, such as Video and Audio. 44 | * @class AbstractMediaLoader 45 | * @param {LoadItem|Object} loadItem 46 | * @param {Boolean} preferXHR 47 | * @param {String} type The type of media to load. Usually "video" or "audio". 48 | * @extends AbstractLoader 49 | * @constructor 50 | */ 51 | function AbstractMediaLoader(loadItem, preferXHR, type) { 52 | this.AbstractLoader_constructor(loadItem, preferXHR, type); 53 | 54 | // public properties 55 | this.resultFormatter = this._formatResult; 56 | 57 | // protected properties 58 | this._tagSrcAttribute = "src"; 59 | 60 | this.on("initialize", this._updateXHR, this); 61 | }; 62 | 63 | var p = createjs.extend(AbstractMediaLoader, createjs.AbstractLoader); 64 | 65 | // static properties 66 | // public methods 67 | p.load = function () { 68 | // TagRequest will handle most of this, but Sound / Video need a few custom properties, so just handle them here. 69 | if (!this._tag) { 70 | this._tag = this._createTag(this._item.src); 71 | } 72 | 73 | var crossOrigin = this._item.crossOrigin; 74 | if (crossOrigin === true) { crossOrigin = "Anonymous"; } 75 | if (crossOrigin != null && !createjs.URLUtils.isLocal(this._item)) { 76 | this._tag.crossOrigin = crossOrigin; 77 | } 78 | 79 | this._tag.preload = "auto"; 80 | this._tag.load(); 81 | 82 | this.AbstractLoader_load(); 83 | }; 84 | 85 | // protected methods 86 | /** 87 | * Creates a new tag for loading if it doesn't exist yet. 88 | * @method _createTag 89 | * @private 90 | */ 91 | p._createTag = function () {}; 92 | 93 | 94 | p._createRequest = function() { 95 | if (!this._preferXHR) { 96 | this._request = new createjs.MediaTagRequest(this._item, this._tag || this._createTag(), this._tagSrcAttribute); 97 | } else { 98 | this._request = new createjs.XHRRequest(this._item); 99 | } 100 | }; 101 | 102 | // protected methods 103 | /** 104 | * Before the item loads, set its mimeType and responseType. 105 | * @property _updateXHR 106 | * @param {Event} event 107 | * @private 108 | */ 109 | p._updateXHR = function (event) { 110 | // Only exists for XHR 111 | if (event.loader.setResponseType) { 112 | event.loader.setResponseType("blob"); 113 | } 114 | }; 115 | 116 | /** 117 | * The result formatter for media files. 118 | * @method _formatResult 119 | * @param {AbstractLoader} loader 120 | * @returns {HTMLVideoElement|HTMLAudioElement} 121 | * @private 122 | */ 123 | p._formatResult = function (loader) { 124 | this._tag.removeEventListener && this._tag.removeEventListener("canplaythrough", this._loadedHandler); 125 | this._tag.onstalled = null; 126 | if (this._preferXHR) { 127 | var URL = window.URL || window.webkitURL; 128 | var result = loader.getResult(true); 129 | 130 | loader.getTag().src = URL.createObjectURL(result); 131 | } 132 | return loader.getTag(); 133 | }; 134 | 135 | createjs.AbstractMediaLoader = createjs.promote(AbstractMediaLoader, "AbstractLoader"); 136 | 137 | }()); 138 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/BinaryLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * BinaryLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for binary files. This is useful for loading web audio, or content that requires an ArrayBuffer. 43 | * @class BinaryLoader 44 | * @param {LoadItem|Object} loadItem 45 | * @extends AbstractLoader 46 | * @constructor 47 | */ 48 | function BinaryLoader(loadItem) { 49 | this.AbstractLoader_constructor(loadItem, true, createjs.Types.BINARY); 50 | this.on("initialize", this._updateXHR, this); 51 | }; 52 | 53 | var p = createjs.extend(BinaryLoader, createjs.AbstractLoader); 54 | var s = BinaryLoader; 55 | 56 | // static methods 57 | /** 58 | * Determines if the loader can load a specific item. This loader can only load items that are of type 59 | * {{#crossLink "Types/BINARY:property"}}{{/crossLink}} 60 | * @method canLoadItem 61 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 62 | * @returns {Boolean} Whether the loader can load the item. 63 | * @static 64 | */ 65 | s.canLoadItem = function (item) { 66 | return item.type == createjs.Types.BINARY; 67 | }; 68 | 69 | // private methods 70 | /** 71 | * Before the item loads, set the response type to "arraybuffer" 72 | * @property _updateXHR 73 | * @param {Event} event 74 | * @private 75 | */ 76 | p._updateXHR = function (event) { 77 | event.loader.setResponseType("arraybuffer"); 78 | }; 79 | 80 | createjs.BinaryLoader = createjs.promote(BinaryLoader, "AbstractLoader"); 81 | 82 | }()); 83 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/CSSLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * CSSLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for CSS files. 43 | * @class CSSLoader 44 | * @param {LoadItem|Object} loadItem 45 | * @param {Boolean} preferXHR 46 | * @extends AbstractLoader 47 | * @constructor 48 | */ 49 | function CSSLoader(loadItem, preferXHR) { 50 | this.AbstractLoader_constructor(loadItem, preferXHR, createjs.Types.CSS); 51 | 52 | // public properties 53 | this.resultFormatter = this._formatResult; 54 | 55 | // protected properties 56 | this._tagSrcAttribute = "href"; 57 | 58 | if (preferXHR) { 59 | this._tag = createjs.Elements.style(); 60 | } else { 61 | this._tag = createjs.Elements.link(); 62 | } 63 | 64 | this._tag.rel = "stylesheet"; 65 | this._tag.type = "text/css"; 66 | }; 67 | 68 | var p = createjs.extend(CSSLoader, createjs.AbstractLoader); 69 | var s = CSSLoader; 70 | 71 | // static methods 72 | /** 73 | * Determines if the loader can load a specific item. This loader can only load items that are of type 74 | * {{#crossLink "Types/CSS:property"}}{{/crossLink}}. 75 | * @method canLoadItem 76 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 77 | * @returns {Boolean} Whether the loader can load the item. 78 | * @static 79 | */ 80 | s.canLoadItem = function (item) { 81 | return item.type == createjs.Types.CSS; 82 | }; 83 | 84 | // protected methods 85 | /** 86 | * The result formatter for CSS files. 87 | * @method _formatResult 88 | * @param {AbstractLoader} loader 89 | * @returns {HTMLLinkElement|HTMLStyleElement} 90 | * @private 91 | */ 92 | p._formatResult = function (loader) { 93 | if (this._preferXHR) { 94 | var tag = loader.getTag(); 95 | 96 | if (tag.styleSheet) { // IE 97 | tag.styleSheet.cssText = loader.getResult(true); 98 | } else { 99 | var textNode = createjs.Elements.text(loader.getResult(true)); 100 | tag.appendChild(textNode); 101 | } 102 | } else { 103 | tag = this._tag; 104 | } 105 | 106 | createjs.DomUtils.appendToHead(tag); 107 | 108 | return tag; 109 | }; 110 | 111 | createjs.CSSLoader = createjs.promote(CSSLoader, "AbstractLoader"); 112 | 113 | }()); 114 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/JSONLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * JSONLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for JSON files. To load JSON cross-domain, use JSONP and the {{#crossLink "JSONPLoader"}}{{/crossLink}} 43 | * instead. To load JSON-formatted manifests, use {{#crossLink "ManifestLoader"}}{{/crossLink}}, and to 44 | * load EaselJS SpriteSheets, use {{#crossLink "SpriteSheetLoader"}}{{/crossLink}}. 45 | * @class JSONLoader 46 | * @param {LoadItem|Object} loadItem 47 | * @extends AbstractLoader 48 | * @constructor 49 | */ 50 | function JSONLoader(loadItem) { 51 | this.AbstractLoader_constructor(loadItem, true, createjs.Types.JSON); 52 | 53 | // public properties 54 | this.resultFormatter = this._formatResult; 55 | }; 56 | 57 | var p = createjs.extend(JSONLoader, createjs.AbstractLoader); 58 | var s = JSONLoader; 59 | 60 | // static methods 61 | /** 62 | * Determines if the loader can load a specific item. This loader can only load items that are of type 63 | * {{#crossLink "Types/JSON:property"}}{{/crossLink}}. 64 | * @method canLoadItem 65 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 66 | * @returns {Boolean} Whether the loader can load the item. 67 | * @static 68 | */ 69 | s.canLoadItem = function (item) { 70 | return item.type == createjs.Types.JSON; 71 | }; 72 | 73 | // protected methods 74 | /** 75 | * The result formatter for JSON files. 76 | * @method _formatResult 77 | * @param {AbstractLoader} loader 78 | * @returns {HTMLLinkElement|HTMLStyleElement} 79 | * @private 80 | */ 81 | p._formatResult = function (loader) { 82 | var json = null; 83 | try { 84 | json = createjs.DataUtils.parseJSON(loader.getResult(true)); 85 | } catch (e) { 86 | var event = new createjs.ErrorEvent("JSON_FORMAT", null, e); 87 | this._sendError(event); 88 | return e; 89 | } 90 | 91 | return json; 92 | }; 93 | 94 | createjs.JSONLoader = createjs.promote(JSONLoader, "AbstractLoader"); 95 | 96 | }()); 97 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/JavaScriptLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * JavaScriptLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for JavaScript files. 43 | * @class JavaScriptLoader 44 | * @param {LoadItem|Object} loadItem 45 | * @param {Boolean} preferXHR 46 | * @extends AbstractLoader 47 | * @constructor 48 | */ 49 | function JavaScriptLoader(loadItem, preferXHR) { 50 | this.AbstractLoader_constructor(loadItem, preferXHR, createjs.Types.JAVASCRIPT); 51 | 52 | // public properties 53 | this.resultFormatter = this._formatResult; 54 | 55 | // protected properties 56 | this._tagSrcAttribute = "src"; 57 | this.setTag(createjs.Elements.script()); 58 | }; 59 | 60 | var p = createjs.extend(JavaScriptLoader, createjs.AbstractLoader); 61 | var s = JavaScriptLoader; 62 | 63 | // static methods 64 | /** 65 | * Determines if the loader can load a specific item. This loader can only load items that are of type 66 | * {{#crossLink "Types/JAVASCRIPT:property"}}{{/crossLink}} 67 | * @method canLoadItem 68 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 69 | * @returns {Boolean} Whether the loader can load the item. 70 | * @static 71 | */ 72 | s.canLoadItem = function (item) { 73 | return item.type == createjs.Types.JAVASCRIPT; 74 | }; 75 | 76 | // protected methods 77 | /** 78 | * The result formatter for JavaScript files. 79 | * @method _formatResult 80 | * @param {AbstractLoader} loader 81 | * @returns {HTMLLinkElement|HTMLStyleElement} 82 | * @private 83 | */ 84 | p._formatResult = function (loader) { 85 | var tag = loader.getTag(); 86 | if (this._preferXHR) { 87 | tag.text = loader.getResult(true); 88 | } 89 | return tag; 90 | }; 91 | 92 | createjs.JavaScriptLoader = createjs.promote(JavaScriptLoader, "AbstractLoader"); 93 | 94 | }()); 95 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/SVGLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * SVGLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for SVG files. 43 | * @class SVGLoader 44 | * @param {LoadItem|Object} loadItem 45 | * @param {Boolean} preferXHR 46 | * @extends AbstractLoader 47 | * @constructor 48 | */ 49 | function SVGLoader(loadItem, preferXHR) { 50 | this.AbstractLoader_constructor(loadItem, preferXHR, createjs.Types.SVG); 51 | 52 | // public properties 53 | this.resultFormatter = this._formatResult; 54 | 55 | // protected properties 56 | this._tagSrcAttribute = "data"; 57 | 58 | if (preferXHR) { 59 | this.setTag(createjs.Elements.svg()); 60 | } else { 61 | this.setTag(createjs.Elements.object()); 62 | this.getTag().type = "image/svg+xml"; 63 | } 64 | }; 65 | 66 | var p = createjs.extend(SVGLoader, createjs.AbstractLoader); 67 | var s = SVGLoader; 68 | 69 | // static methods 70 | /** 71 | * Determines if the loader can load a specific item. This loader can only load items that are of type 72 | * {{#crossLink "Types/SVG:property"}}{{/crossLink}} 73 | * @method canLoadItem 74 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 75 | * @returns {Boolean} Whether the loader can load the item. 76 | * @static 77 | */ 78 | s.canLoadItem = function (item) { 79 | return item.type == createjs.Types.SVG; 80 | }; 81 | 82 | // protected methods 83 | /** 84 | * The result formatter for SVG files. 85 | * @method _formatResult 86 | * @param {AbstractLoader} loader 87 | * @returns {Object} 88 | * @private 89 | */ 90 | p._formatResult = function (loader) { 91 | // mime should be image/svg+xml, but Opera requires text/xml 92 | var xml = createjs.DataUtils.parseXML(loader.getResult(true)); 93 | var tag = loader.getTag(); 94 | 95 | if (!this._preferXHR && document.body.contains(tag)) { 96 | document.body.removeChild(tag); 97 | } 98 | 99 | if (xml.documentElement != null) { 100 | var element = xml.documentElement; 101 | // Support loading an SVG from a different domain in ID 102 | if (document.importNode) { 103 | element = document.importNode(element, true); 104 | } 105 | tag.appendChild(element); 106 | return tag; 107 | } else { // For browsers that don't support SVG, just give them the XML. (IE 9-8) 108 | return xml; 109 | } 110 | }; 111 | 112 | createjs.SVGLoader = createjs.promote(SVGLoader, "AbstractLoader"); 113 | 114 | }()); 115 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/SoundLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * SoundLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for HTML audio files. PreloadJS can not load WebAudio files, as a WebAudio context is required, which 43 | * should be created by either a library playing the sound (such as SoundJS, or an 44 | * external framework that handles audio playback. To load content that can be played by WebAudio, use the 45 | * {{#crossLink "BinaryLoader"}}{{/crossLink}}, and handle the audio context decoding manually. 46 | * @class SoundLoader 47 | * @param {LoadItem|Object} loadItem 48 | * @param {Boolean} preferXHR 49 | * @extends AbstractMediaLoader 50 | * @constructor 51 | */ 52 | function SoundLoader(loadItem, preferXHR) { 53 | this.AbstractMediaLoader_constructor(loadItem, preferXHR, createjs.Types.SOUND); 54 | 55 | // protected properties 56 | if (createjs.DomUtils.isAudioTag(loadItem)) { 57 | this._tag = loadItem; 58 | } else if (createjs.DomUtils.isAudioTag(loadItem.src)) { 59 | this._tag = loadItem; 60 | } else if (createjs.DomUtils.isAudioTag(loadItem.tag)) { 61 | this._tag = createjs.DomUtils.isAudioTag(loadItem) ? loadItem : loadItem.src; 62 | } 63 | 64 | if (this._tag != null) { 65 | this._preferXHR = false; 66 | } 67 | }; 68 | 69 | var p = createjs.extend(SoundLoader, createjs.AbstractMediaLoader); 70 | var s = SoundLoader; 71 | 72 | // static methods 73 | /** 74 | * Determines if the loader can load a specific item. This loader can only load items that are of type 75 | * {{#crossLink "Types/SOUND:property"}}{{/crossLink}}. 76 | * @method canLoadItem 77 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 78 | * @returns {Boolean} Whether the loader can load the item. 79 | * @static 80 | */ 81 | s.canLoadItem = function (item) { 82 | return item.type == createjs.Types.SOUND; 83 | }; 84 | 85 | // protected methods 86 | p._createTag = function (src) { 87 | var tag = createjs.Elements.audio(); 88 | tag.autoplay = false; 89 | tag.preload = "none"; 90 | 91 | //LM: Firefox fails when this the preload="none" for other tags, but it needs to be "none" to ensure PreloadJS works. 92 | tag.src = src; 93 | return tag; 94 | }; 95 | 96 | createjs.SoundLoader = createjs.promote(SoundLoader, "AbstractMediaLoader"); 97 | 98 | }()); 99 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/TextLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * TextLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for Text files. 43 | * @class TextLoader 44 | * @param {LoadItem|Object} loadItem 45 | * @extends AbstractLoader 46 | * @constructor 47 | */ 48 | function TextLoader(loadItem) { 49 | this.AbstractLoader_constructor(loadItem, true, createjs.Types.TEXT); 50 | }; 51 | 52 | var p = createjs.extend(TextLoader, createjs.AbstractLoader); 53 | var s = TextLoader; 54 | 55 | // static methods 56 | /** 57 | * Determines if the loader can load a specific item. This loader loads items that are of type {{#crossLink "Types/TEXT:property"}}{{/crossLink}}, 58 | * but is also the default loader if a file type can not be determined. 59 | * @method canLoadItem 60 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 61 | * @returns {Boolean} Whether the loader can load the item. 62 | * @static 63 | */ 64 | s.canLoadItem = function (item) { 65 | return item.type == createjs.Types.TEXT; 66 | }; 67 | 68 | createjs.TextLoader = createjs.promote(TextLoader, "AbstractLoader"); 69 | 70 | }()); 71 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/VideoLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * VideoLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for video files. 43 | * @class VideoLoader 44 | * @param {LoadItem|Object} loadItem 45 | * @param {Boolean} preferXHR 46 | * @extends AbstractMediaLoader 47 | * @constructor 48 | */ 49 | function VideoLoader(loadItem, preferXHR) { 50 | this.AbstractMediaLoader_constructor(loadItem, preferXHR, createjs.Types.VIDEO); 51 | 52 | if (createjs.DomUtils.isVideoTag(loadItem) || createjs.DomUtils.isVideoTag(loadItem.src)) { 53 | this.setTag(createjs.DomUtils.isVideoTag(loadItem)?loadItem:loadItem.src); 54 | 55 | // We can't use XHR for a tag that's passed in. 56 | this._preferXHR = false; 57 | } else { 58 | this.setTag(this._createTag()); 59 | } 60 | }; 61 | 62 | var p = createjs.extend(VideoLoader, createjs.AbstractMediaLoader); 63 | var s = VideoLoader; 64 | 65 | /** 66 | * Create a new video tag 67 | * 68 | * @returns {HTMLElement} 69 | * @private 70 | */ 71 | p._createTag = function () { 72 | return createjs.Elements.video(); 73 | }; 74 | 75 | // static methods 76 | /** 77 | * Determines if the loader can load a specific item. This loader can only load items that are of type 78 | * {{#crossLink "Types/VIDEO:property"}}{{/crossLink}}. 79 | * @method canLoadItem 80 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 81 | * @returns {Boolean} Whether the loader can load the item. 82 | * @static 83 | */ 84 | s.canLoadItem = function (item) { 85 | return item.type == createjs.Types.VIDEO; 86 | }; 87 | 88 | createjs.VideoLoader = createjs.promote(VideoLoader, "AbstractMediaLoader"); 89 | 90 | }()); 91 | -------------------------------------------------------------------------------- /src/preloadjs/loaders/XMLLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * XMLLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A loader for CSS files. 43 | * @class XMLLoader 44 | * @param {LoadItem|Object} loadItem 45 | * @extends AbstractLoader 46 | * @constructor 47 | */ 48 | function XMLLoader(loadItem) { 49 | this.AbstractLoader_constructor(loadItem, true, createjs.Types.XML); 50 | 51 | // public properties 52 | this.resultFormatter = this._formatResult; 53 | }; 54 | 55 | var p = createjs.extend(XMLLoader, createjs.AbstractLoader); 56 | var s = XMLLoader; 57 | 58 | // static methods 59 | /** 60 | * Determines if the loader can load a specific item. This loader can only load items that are of type 61 | * {{#crossLink "Types/XML:property"}}{{/crossLink}}. 62 | * @method canLoadItem 63 | * @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load. 64 | * @returns {Boolean} Whether the loader can load the item. 65 | * @static 66 | */ 67 | s.canLoadItem = function (item) { 68 | return item.type == createjs.Types.XML; 69 | }; 70 | 71 | // protected methods 72 | /** 73 | * The result formatter for XML files. 74 | * @method _formatResult 75 | * @param {AbstractLoader} loader 76 | * @returns {XMLDocument} 77 | * @private 78 | */ 79 | p._formatResult = function (loader) { 80 | return createjs.DataUtils.parseXML(loader.getResult(true)); 81 | }; 82 | 83 | createjs.XMLLoader = createjs.promote(XMLLoader, "AbstractLoader"); 84 | 85 | }()); 86 | -------------------------------------------------------------------------------- /src/preloadjs/net/AbstractRequest.js: -------------------------------------------------------------------------------- 1 | /* 2 | * AbstractRequest 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | /** 41 | * A base class for actual data requests, such as {{#crossLink "XHRRequest"}}{{/crossLink}}, {{#crossLink "TagRequest"}}{{/crossLink}}, 42 | * and {{#crossLink "MediaRequest"}}{{/crossLink}}. PreloadJS loaders will typically use a data loader under the 43 | * hood to get data. 44 | * @class AbstractRequest 45 | * @param {LoadItem} item 46 | * @constructor 47 | */ 48 | var AbstractRequest = function (item) { 49 | this._item = item; 50 | }; 51 | 52 | var p = createjs.extend(AbstractRequest, createjs.EventDispatcher); 53 | 54 | // public methods 55 | /** 56 | * Begin a load. 57 | * @method load 58 | */ 59 | p.load = function() {}; 60 | 61 | /** 62 | * Clean up a request. 63 | * @method destroy 64 | */ 65 | p.destroy = function() {}; 66 | 67 | /** 68 | * Cancel an in-progress request. 69 | * @method cancel 70 | */ 71 | p.cancel = function() {}; 72 | 73 | createjs.AbstractRequest = createjs.promote(AbstractRequest, "EventDispatcher"); 74 | 75 | }()); -------------------------------------------------------------------------------- /src/preloadjs/net/MediaTagRequest.js: -------------------------------------------------------------------------------- 1 | /* 2 | * MediaTagRequest 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * An {{#crossLink "TagRequest"}}{{/crossLink}} that loads HTML tags for video and audio. 43 | * @class MediaTagRequest 44 | * @param {LoadItem} loadItem 45 | * @param {HTMLAudioElement|HTMLVideoElement} tag 46 | * @param {String} srcAttribute The tag attribute that specifies the source, such as "src", "href", etc. 47 | * @constructor 48 | */ 49 | function MediaTagRequest(loadItem, tag, srcAttribute) { 50 | this.AbstractRequest_constructor(loadItem); 51 | 52 | // protected properties 53 | this._tag = tag; 54 | this._tagSrcAttribute = srcAttribute; 55 | this._loadedHandler = createjs.proxy(this._handleTagComplete, this); 56 | }; 57 | 58 | var p = createjs.extend(MediaTagRequest, createjs.TagRequest); 59 | var s = MediaTagRequest; 60 | 61 | // public methods 62 | p.load = function () { 63 | var sc = createjs.proxy(this._handleStalled, this); 64 | this._stalledCallback = sc; 65 | 66 | var pc = createjs.proxy(this._handleProgress, this); 67 | this._handleProgress = pc; 68 | 69 | this._tag.addEventListener("stalled", sc); 70 | this._tag.addEventListener("progress", pc); 71 | 72 | // This will tell us when audio is buffered enough to play through, but not when its loaded. 73 | // The tag doesn't keep loading in Chrome once enough has buffered, and we have decided that behaviour is sufficient. 74 | this._tag.addEventListener && this._tag.addEventListener("canplaythrough", this._loadedHandler, false); // canplaythrough callback doesn't work in Chrome, so we use an event. 75 | 76 | this.TagRequest_load(); 77 | }; 78 | 79 | // private methods 80 | p._handleReadyStateChange = function () { 81 | clearTimeout(this._loadTimeout); 82 | // This is strictly for tags in browsers that do not support onload. 83 | var tag = this._tag; 84 | 85 | // Complete is for old IE support. 86 | if (tag.readyState == "loaded" || tag.readyState == "complete") { 87 | this._handleTagComplete(); 88 | } 89 | }; 90 | 91 | p._handleStalled = function () { 92 | //Ignore, let the timeout take care of it. Sometimes its not really stopped. 93 | }; 94 | 95 | /** 96 | * An XHR request has reported progress. 97 | * @method _handleProgress 98 | * @param {Object} event The XHR progress event. 99 | * @private 100 | */ 101 | p._handleProgress = function (event) { 102 | if (!event || event.loaded > 0 && event.total == 0) { 103 | return; // Sometimes we get no "total", so just ignore the progress event. 104 | } 105 | 106 | var newEvent = new createjs.ProgressEvent(event.loaded, event.total); 107 | this.dispatchEvent(newEvent); 108 | }; 109 | 110 | // protected methods 111 | p._clean = function () { 112 | this._tag.removeEventListener && this._tag.removeEventListener("canplaythrough", this._loadedHandler); 113 | this._tag.removeEventListener("stalled", this._stalledCallback); 114 | this._tag.removeEventListener("progress", this._progressCallback); 115 | 116 | this.TagRequest__clean(); 117 | }; 118 | 119 | createjs.MediaTagRequest = createjs.promote(MediaTagRequest, "TagRequest"); 120 | 121 | }()); 122 | -------------------------------------------------------------------------------- /src/preloadjs/utils/DataUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DataUtils 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | (function () { 35 | 36 | /** 37 | * A few data utilities for formatting different data types. 38 | * @class DataUtils 39 | */ 40 | var s = {}; 41 | 42 | // static methods 43 | /** 44 | * Parse XML using the DOM. This is required when preloading XML or SVG. 45 | * @method parseXML 46 | * @param {String} text The raw text or XML that is loaded by XHR. 47 | * @return {XML} An XML document 48 | * @static 49 | */ 50 | s.parseXML = function (text) { 51 | var xml = null; 52 | // CocoonJS does not support XML parsing with either method. 53 | 54 | // Most browsers will use DOMParser 55 | // IE fails on certain SVG files, so we have a fallback below. 56 | try { 57 | if (window.DOMParser) { 58 | var parser = new DOMParser(); 59 | xml = parser.parseFromString(text, "text/xml"); 60 | } 61 | } catch (e) { 62 | } 63 | 64 | // Fallback for IE support. 65 | if (!xml) { 66 | try { 67 | xml = new ActiveXObject("Microsoft.XMLDOM"); 68 | xml.async = false; 69 | xml.loadXML(text); 70 | } catch (e) { 71 | xml = null; 72 | } 73 | } 74 | 75 | return xml; 76 | }; 77 | 78 | /** 79 | * Parse a string into an Object. 80 | * @method parseJSON 81 | * @param {String} value The loaded JSON string 82 | * @returns {Object} A JavaScript object. 83 | */ 84 | s.parseJSON = function (value) { 85 | if (value == null) { 86 | return null; 87 | } 88 | 89 | try { 90 | return JSON.parse(value); 91 | } catch (e) { 92 | // TODO; Handle this with a custom error? 93 | throw e; 94 | } 95 | }; 96 | 97 | createjs.DataUtils = s; 98 | 99 | }()); 100 | -------------------------------------------------------------------------------- /src/preloadjs/utils/DomUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DomUtils 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | (function () { 35 | 36 | /** 37 | * A few utilities for interacting with the dom. 38 | * @class DomUtils 39 | */ 40 | var s = { 41 | container: null 42 | }; 43 | 44 | s.appendToHead = function (el) { 45 | s.getHead().appendChild(el); 46 | } 47 | 48 | s.appendToBody = function (el) { 49 | if (s.container == null) { 50 | s.container = document.createElement("div"); 51 | s.container.id = "preloadjs-container"; 52 | var style = s.container.style; 53 | style.visibility = "hidden"; 54 | style.position = "absolute"; 55 | style.width = s.container.style.height = "10px"; 56 | style.overflow = "hidden"; 57 | style.transform = style.msTransform = style.webkitTransform = style.oTransform = "translate(-10px, -10px)"; //LM: Not working 58 | s.getBody().appendChild(s.container); 59 | } 60 | s.container.appendChild(el); 61 | } 62 | 63 | s.getHead = function () { 64 | return document.head || document.getElementsByTagName("head")[0]; 65 | } 66 | 67 | s.getBody = function () { 68 | return document.body || document.getElementsByTagName("body")[0]; 69 | } 70 | 71 | s.removeChild = function(el) { 72 | if (el.parent) { 73 | el.parent.removeChild(el); 74 | } 75 | } 76 | 77 | /** 78 | * Check if item is a valid HTMLImageElement 79 | * @method isImageTag 80 | * @param {Object} item 81 | * @returns {Boolean} 82 | * @static 83 | */ 84 | s.isImageTag = function(item) { 85 | return item instanceof HTMLImageElement; 86 | }; 87 | 88 | /** 89 | * Check if item is a valid HTMLAudioElement 90 | * @method isAudioTag 91 | * @param {Object} item 92 | * @returns {Boolean} 93 | * @static 94 | */ 95 | s.isAudioTag = function(item) { 96 | if (window.HTMLAudioElement) { 97 | return item instanceof HTMLAudioElement; 98 | } else { 99 | return false; 100 | } 101 | }; 102 | 103 | /** 104 | * Check if item is a valid HTMLVideoElement 105 | * @method isVideoTag 106 | * @param {Object} item 107 | * @returns {Boolean} 108 | * @static 109 | */ 110 | s.isVideoTag = function(item) { 111 | if (window.HTMLVideoElement) { 112 | return item instanceof HTMLVideoElement; 113 | } else { 114 | return false; 115 | } 116 | }; 117 | 118 | createjs.DomUtils = s; 119 | 120 | }()); 121 | -------------------------------------------------------------------------------- /src/preloadjs/utils/Elements.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Elements 3 | * 4 | * Visit http://createjs.com/ for documentation, updates and examples. 5 | * 6 | * 7 | * Copyright (c) 2012 gskinner.com, inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person 10 | * obtaining a copy of this software and associated documentation 11 | * files (the "Software"), to deal in the Software without 12 | * restriction, including without limitation the rights to use, 13 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, and to permit persons to whom the 15 | * Software is furnished to do so, subject to the following 16 | * conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be 19 | * included in all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | * OTHER DEALINGS IN THE SOFTWARE. 29 | */ 30 | 31 | /** 32 | * @module PreloadJS 33 | */ 34 | 35 | (function () { 36 | 37 | /** 38 | * Convenience methods for creating various elements used by PrelaodJS. 39 | * 40 | * @class DomUtils 41 | */ 42 | var s = {}; 43 | 44 | s.a = function() { 45 | return s.el("a"); 46 | } 47 | 48 | s.svg = function() { 49 | return s.el("svg"); 50 | } 51 | 52 | s.object = function() { 53 | return s.el("object"); 54 | } 55 | 56 | s.image = function() { 57 | return s.el("image"); 58 | } 59 | 60 | s.img = function() { 61 | return s.el("img"); 62 | } 63 | 64 | s.style = function() { 65 | return s.el("style"); 66 | } 67 | 68 | s.link = function() { 69 | return s.el("link"); 70 | } 71 | 72 | s.script = function() { 73 | return s.el("script"); 74 | } 75 | 76 | s.audio = function() { 77 | return s.el("audio"); 78 | } 79 | 80 | s.video = function() { 81 | return s.el("video"); 82 | } 83 | 84 | s.text = function(value) { 85 | return document.createTextNode(value); 86 | } 87 | 88 | s.el = function(name) { 89 | return document.createElement(name); 90 | } 91 | 92 | createjs.Elements = s; 93 | 94 | }()); 95 | -------------------------------------------------------------------------------- /src/preloadjs/utils/RequestUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * RequestUtils 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | (function () { 35 | 36 | /** 37 | * Utilities that assist with parsing load items, and determining file types, etc. 38 | * @class RequestUtils 39 | */ 40 | var s = {}; 41 | 42 | /** 43 | * Determine if a specific type should be loaded as a binary file. Currently, only images and items marked 44 | * specifically as "binary" are loaded as binary. Note that audio is not a binary type, as we can not play 45 | * back using an audio tag if it is loaded as binary. Plugins can change the item type to binary to ensure they get 46 | * a binary result to work with. Binary files are loaded using XHR2. Types are defined as static constants on 47 | * {{#crossLink "AbstractLoader"}}{{/crossLink}}. 48 | * @method isBinary 49 | * @param {String} type The item type. 50 | * @return {Boolean} If the specified type is binary. 51 | * @static 52 | */ 53 | s.isBinary = function (type) { 54 | switch (type) { 55 | case createjs.Types.IMAGE: 56 | case createjs.Types.BINARY: 57 | return true; 58 | default: 59 | return false; 60 | } 61 | }; 62 | 63 | /** 64 | * Determine if a specific type is a text-based asset, and should be loaded as UTF-8. 65 | * @method isText 66 | * @param {String} type The item type. 67 | * @return {Boolean} If the specified type is text. 68 | * @static 69 | */ 70 | s.isText = function (type) { 71 | switch (type) { 72 | case createjs.Types.TEXT: 73 | case createjs.Types.JSON: 74 | case createjs.Types.MANIFEST: 75 | case createjs.Types.XML: 76 | case createjs.Types.CSS: 77 | case createjs.Types.SVG: 78 | case createjs.Types.JAVASCRIPT: 79 | case createjs.Types.SPRITESHEET: 80 | return true; 81 | default: 82 | return false; 83 | } 84 | }; 85 | 86 | /** 87 | * Determine the type of the object using common extensions. Note that the type can be passed in with the load item 88 | * if it is an unusual extension. 89 | * @method getTypeByExtension 90 | * @param {String} extension The file extension to use to determine the load type. 91 | * @return {String} The determined load type (for example, `createjs.Types.IMAGE`). Will return `null` if 92 | * the type can not be determined by the extension. 93 | * @static 94 | */ 95 | s.getTypeByExtension = function (extension) { 96 | if (extension == null) { 97 | return createjs.Types.TEXT; 98 | } 99 | 100 | switch (extension.toLowerCase()) { 101 | case "jpeg": 102 | case "jpg": 103 | case "gif": 104 | case "png": 105 | case "webp": 106 | case "bmp": 107 | return createjs.Types.IMAGE; 108 | case "ogg": 109 | case "mp3": 110 | case "webm": 111 | case "aac": 112 | return createjs.Types.SOUND; 113 | case "mp4": 114 | case "webm": 115 | case "ts": 116 | return createjs.Types.VIDEO; 117 | case "json": 118 | return createjs.Types.JSON; 119 | case "xml": 120 | return createjs.Types.XML; 121 | case "css": 122 | return createjs.Types.CSS; 123 | case "js": 124 | return createjs.Types.JAVASCRIPT; 125 | case 'svg': 126 | return createjs.Types.SVG; 127 | default: 128 | return createjs.Types.TEXT; 129 | } 130 | }; 131 | 132 | createjs.RequestUtils = s; 133 | 134 | }()); 135 | -------------------------------------------------------------------------------- /src/preloadjs/version.js: -------------------------------------------------------------------------------- 1 | this.createjs = this.createjs || {}; 2 | 3 | (function () { 4 | "use strict"; 5 | 6 | /** 7 | * Static class holding library specific information such as the version and buildDate of the library. 8 | * @class PreloadJS 9 | **/ 10 | var s = createjs.PreloadJS = createjs.PreloadJS || {}; 11 | 12 | /** 13 | * The version string for this release. 14 | * @property version 15 | * @type {String} 16 | * @static 17 | **/ 18 | s.version = /*=version*/""; // injected by build process 19 | 20 | /** 21 | * The build date for this release in UTC format. 22 | * @property buildDate 23 | * @type {String} 24 | * @static 25 | **/ 26 | s.buildDate = /*=date*/""; // injected by build process 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /tests/Gruntfile.js: -------------------------------------------------------------------------------- 1 | var url = require('url'); 2 | 3 | module.exports = function (grunt) { 4 | grunt.initConfig( 5 | { 6 | pkg: grunt.file.readJSON('package.json'), 7 | 8 | jasmine: { 9 | run: { 10 | src: [ 11 | '../lib/preloadjs-NEXT.js' 12 | ], 13 | 14 | options: { 15 | specs: 'spec/*Spec.js', 16 | helpers: [ 17 | 'spec/Helpers.js' 18 | ], 19 | vendor: [ 20 | '../_assets/libs/easeljs-NEXT.min.js' 21 | ], 22 | host: 'http://127.0.0.1:<%=connect.serve.options.port%>/' 23 | } 24 | } 25 | }, 26 | 27 | connect: { 28 | serve: { 29 | options: { 30 | keepalive: true, 31 | base: [ 32 | { 33 | path: __dirname, 34 | options: { 35 | index: '_SpecRunner.html' 36 | } 37 | }, '..', '../_assets/', '../lib/', './' 38 | ], 39 | useAvailablePort: true, 40 | port: 8000, 41 | open: true, 42 | // Used to test the POST / GET functionality, it just echo's back what data was sent. 43 | middleware: function (connect, options, middlewares) { 44 | middlewares.unshift(function (req, res, next) { 45 | if (req.method == "POST") { 46 | res.end(JSON.stringify(req.body)); 47 | } else if(req.method == "GET") { 48 | var url_parts = url.parse(req.originalUrl, true); 49 | if (url_parts.query.foo != null) { 50 | res.end(JSON.stringify(url_parts.query)); 51 | } else { 52 | next(); 53 | } 54 | } else { 55 | next(); 56 | } 57 | }); 58 | 59 | var bodyParser = require('body-parser') 60 | middlewares.unshift(bodyParser.json()); 61 | middlewares.unshift(bodyParser.urlencoded({extended: false})); 62 | 63 | return middlewares; 64 | }, 65 | } 66 | } 67 | }, 68 | 69 | listips: { 70 | run: { 71 | options: { 72 | label: "Normal" 73 | } 74 | } 75 | } 76 | } 77 | ); 78 | 79 | grunt.registerTask('configureConnectHeadless', function () { 80 | grunt.config('connect.serve.options.keepalive', false); 81 | grunt.config('connect.serve.options.open', false); 82 | }); 83 | 84 | // Load all the tasks we need 85 | grunt.loadNpmTasks('grunt-contrib-jasmine'); 86 | grunt.loadNpmTasks('grunt-contrib-connect'); 87 | grunt.loadTasks('tasks/'); 88 | 89 | grunt.registerTask("default", "Launches browser-based tests", "serve"); 90 | grunt.registerTask("serve", "Launches browser-based tests", ["jasmine:run:build", "listips", "connect"]); 91 | 92 | grunt.registerTask("headless", "phantom"); 93 | grunt.registerTask("phantom", "Launches phantom-based tests", ["configureConnectHeadless", "connect", "jasmine"]); 94 | }; 95 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | ## Setup and run tests ## 2 | * Run via Grunt 3 | * Install dependencies; npm install; 4 | * Run tests in browser: grunt; 5 | * Run headless: grunt jasmine; 6 | 7 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2014 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/boot.js: -------------------------------------------------------------------------------- 1 | /** 2 | Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project. 3 | 4 | If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms. 5 | 6 | The location of `boot.js` can be specified and/or overridden in `jasmine.yml`. 7 | 8 | [jasmine-gem]: http://github.com/pivotal/jasmine-gem 9 | */ 10 | 11 | (function() { 12 | 13 | /** 14 | * ## Require & Instantiate 15 | * 16 | * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference. 17 | */ 18 | window.jasmine = jasmineRequire.core(jasmineRequire); 19 | 20 | /** 21 | * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference. 22 | */ 23 | jasmineRequire.html(jasmine); 24 | 25 | /** 26 | * Create the Jasmine environment. This is used to run all specs in a project. 27 | */ 28 | var env = jasmine.getEnv(); 29 | 30 | /** 31 | * ## The Global Interface 32 | * 33 | * Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged. 34 | */ 35 | var jasmineInterface = jasmineRequire.interface(jasmine, env); 36 | 37 | /** 38 | * Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`. 39 | */ 40 | if (typeof window == "undefined" && typeof exports == "object") { 41 | extend(exports, jasmineInterface); 42 | } else { 43 | extend(window, jasmineInterface); 44 | } 45 | 46 | /** 47 | * ## Runner Parameters 48 | * 49 | * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface. 50 | */ 51 | 52 | var queryString = new jasmine.QueryString({ 53 | getWindowLocation: function() { return window.location; } 54 | }); 55 | 56 | var catchingExceptions = queryString.getParam("catch"); 57 | env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions); 58 | 59 | /** 60 | * ## Reporters 61 | * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any). 62 | */ 63 | var htmlReporter = new jasmine.HtmlReporter({ 64 | env: env, 65 | onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); }, 66 | getContainer: function() { return document.body; }, 67 | createElement: function() { return document.createElement.apply(document, arguments); }, 68 | createTextNode: function() { return document.createTextNode.apply(document, arguments); }, 69 | timer: new jasmine.Timer() 70 | }); 71 | 72 | /** 73 | * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript. 74 | */ 75 | env.addReporter(jasmineInterface.jsApiReporter); 76 | env.addReporter(htmlReporter); 77 | 78 | /** 79 | * Filter which specs will be run by matching the start of the full name against the `spec` query param. 80 | */ 81 | var specFilter = new jasmine.HtmlSpecFilter({ 82 | filterString: function() { return queryString.getParam("spec"); } 83 | }); 84 | 85 | env.specFilter = function(spec) { 86 | return specFilter.matches(spec.getFullName()); 87 | }; 88 | 89 | /** 90 | * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack. 91 | */ 92 | window.setTimeout = window.setTimeout; 93 | window.setInterval = window.setInterval; 94 | window.clearTimeout = window.clearTimeout; 95 | window.clearInterval = window.clearInterval; 96 | 97 | /** 98 | * ## Execution 99 | * 100 | * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded. 101 | */ 102 | var currentWindowOnload = window.onload; 103 | 104 | window.onload = function() { 105 | if (currentWindowOnload) { 106 | currentWindowOnload(); 107 | } 108 | htmlReporter.initialize(); 109 | env.execute(); 110 | }; 111 | 112 | /** 113 | * Helper function for readability above. 114 | */ 115 | function extend(destination, source) { 116 | for (var property in source) destination[property] = source[property]; 117 | return destination; 118 | } 119 | 120 | }()); 121 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/console.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2014 Pivotal Labs 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | function getJasmineRequireObj() { 24 | if (typeof module !== 'undefined' && module.exports) { 25 | return exports; 26 | } else { 27 | window.jasmineRequire = window.jasmineRequire || {}; 28 | return window.jasmineRequire; 29 | } 30 | } 31 | 32 | getJasmineRequireObj().console = function(jRequire, j$) { 33 | j$.ConsoleReporter = jRequire.ConsoleReporter(); 34 | }; 35 | 36 | getJasmineRequireObj().ConsoleReporter = function() { 37 | 38 | var noopTimer = { 39 | start: function(){}, 40 | elapsed: function(){ return 0; } 41 | }; 42 | 43 | function ConsoleReporter(options) { 44 | var print = options.print, 45 | showColors = options.showColors || false, 46 | onComplete = options.onComplete || function() {}, 47 | timer = options.timer || noopTimer, 48 | specCount, 49 | failureCount, 50 | failedSpecs = [], 51 | pendingCount, 52 | ansi = { 53 | green: '\x1B[32m', 54 | red: '\x1B[31m', 55 | yellow: '\x1B[33m', 56 | none: '\x1B[0m' 57 | }; 58 | 59 | this.jasmineStarted = function() { 60 | specCount = 0; 61 | failureCount = 0; 62 | pendingCount = 0; 63 | print('Started'); 64 | printNewline(); 65 | timer.start(); 66 | }; 67 | 68 | this.jasmineDone = function() { 69 | printNewline(); 70 | for (var i = 0; i < failedSpecs.length; i++) { 71 | specFailureDetails(failedSpecs[i]); 72 | } 73 | 74 | if(specCount > 0) { 75 | printNewline(); 76 | 77 | var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' + 78 | failureCount + ' ' + plural('failure', failureCount); 79 | 80 | if (pendingCount) { 81 | specCounts += ', ' + pendingCount + ' pending ' + plural('spec', pendingCount); 82 | } 83 | 84 | print(specCounts); 85 | } else { 86 | print('No specs found'); 87 | } 88 | 89 | printNewline(); 90 | var seconds = timer.elapsed() / 1000; 91 | print('Finished in ' + seconds + ' ' + plural('second', seconds)); 92 | 93 | printNewline(); 94 | 95 | onComplete(failureCount === 0); 96 | }; 97 | 98 | this.specDone = function(result) { 99 | specCount++; 100 | 101 | if (result.status == 'pending') { 102 | pendingCount++; 103 | print(colored('yellow', '*')); 104 | return; 105 | } 106 | 107 | if (result.status == 'passed') { 108 | print(colored('green', '.')); 109 | return; 110 | } 111 | 112 | if (result.status == 'failed') { 113 | failureCount++; 114 | failedSpecs.push(result); 115 | print(colored('red', 'F')); 116 | } 117 | }; 118 | 119 | return this; 120 | 121 | function printNewline() { 122 | print('\n'); 123 | } 124 | 125 | function colored(color, str) { 126 | return showColors ? (ansi[color] + str + ansi.none) : str; 127 | } 128 | 129 | function plural(str, count) { 130 | return count == 1 ? str : str + 's'; 131 | } 132 | 133 | function repeat(thing, times) { 134 | var arr = []; 135 | for (var i = 0; i < times; i++) { 136 | arr.push(thing); 137 | } 138 | return arr; 139 | } 140 | 141 | function indent(str, spaces) { 142 | var lines = (str || '').split('\n'); 143 | var newArr = []; 144 | for (var i = 0; i < lines.length; i++) { 145 | newArr.push(repeat(' ', spaces).join('') + lines[i]); 146 | } 147 | return newArr.join('\n'); 148 | } 149 | 150 | function specFailureDetails(result) { 151 | printNewline(); 152 | print(result.fullName); 153 | 154 | for (var i = 0; i < result.failedExpectations.length; i++) { 155 | var failedExpectation = result.failedExpectations[i]; 156 | printNewline(); 157 | print(indent(failedExpectation.message, 2)); 158 | print(indent(failedExpectation.stack, 2)); 159 | } 160 | 161 | printNewline(); 162 | } 163 | } 164 | 165 | return ConsoleReporter; 166 | }; 167 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/jasmine_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/PreloadJS/4938426b9c19dd525167cda473ad4ed00082ffe7/tests/lib/jasmine-2.0.2/jasmine_favicon.png -------------------------------------------------------------------------------- /tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PreloadJS-UnitTests", 3 | "version": "0.0.1", 4 | "description": "PreloadJS unit testing.", 5 | "url": "http://www.createjs.com/#!/PreloadJS", 6 | "logo": "assets/docs-icon-PreloadJS.png", 7 | "devDependencies": { 8 | "body-parser": "^1.9.2", 9 | "grunt": "~0.4.5", 10 | "grunt-contrib-connect": "^0.9.0", 11 | "grunt-contrib-jasmine": "^0.8.2" 12 | }, 13 | "scripts": { 14 | "next":"cd ../build/ && grunt nextlib && cd ../tests && grunt" 15 | }, 16 | "engine": "node >= 0.10.22" 17 | } 18 | -------------------------------------------------------------------------------- /tests/spec/Helpers.js: -------------------------------------------------------------------------------- 1 | beforeEach(function () { 2 | this.baseAssetsPath = "../_assets/"; 3 | 4 | this.getFilePath = function (fileObj) { 5 | var path = ""; 6 | if (typeof fileObj == "string") { 7 | return this._formatFilePath(fileObj); 8 | } else if (fileObj.src instanceof Array) { 9 | for (var i=0;i= 0; i--) { 30 | var cssRules = document.styleSheets[i].cssRules || 31 | document.styleSheets[i].rules || []; // IE support 32 | for (var c = 0; c < cssRules.length; c++) { 33 | if (cssRules[c].selectorText === selector) { 34 | return true; 35 | } 36 | } 37 | } 38 | return false; 39 | } 40 | }); 41 | -------------------------------------------------------------------------------- /tests/tasks/findopenport.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 gskinner.com, inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | module.exports = function (grunt) { 27 | var net = require('net'); 28 | var _callback; 29 | var _ports; 30 | var _opts; 31 | var _done; 32 | 33 | grunt.registerMultiTask('findopenport', 'Prints a list of active ips.', function() { 34 | _opts = this.options(); 35 | 36 | _done = this.async(); 37 | _ports = _opts['ports'] || [80, 8888, 9000, 9999, 9001]; 38 | checkNext(); 39 | }); 40 | 41 | function checkNext() { 42 | if (!_ports.length) { 43 | grunt.option(_portName, -1); 44 | _done(); 45 | return; 46 | } 47 | 48 | check(_ports.shift(), function(success, port) { 49 | if (!success) { 50 | checkNext(); 51 | } else { 52 | //grunt.option(_portName, port); 53 | var configNames = Array.isArray(_opts.configName)?_opts.configName:[_opts.configName]; 54 | 55 | configNames.forEach(function(item) { 56 | grunt.config.set(item, port); 57 | }); 58 | _done(); 59 | } 60 | }); 61 | } 62 | 63 | function check(port, callback) { 64 | var server = net.createServer(); 65 | server.on('error', function(e) { 66 | callback(false, port); 67 | }); 68 | 69 | server.listen(port, function() { 70 | callback(true, port); 71 | server.close(); 72 | }); 73 | } 74 | }; 75 | -------------------------------------------------------------------------------- /tests/tasks/listips.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 gskinner.com, inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | module.exports = function (grunt) { 27 | var os = require('os'); 28 | 29 | grunt.registerMultiTask('listips', 'Prints a list of active ips.', function() { 30 | var opts = this.options({"port": 80}); 31 | 32 | var port = opts.port; 33 | var label = opts.label?'('+opts.label+') ':''; 34 | 35 | if (port == 80) { 36 | port = ''; 37 | } else { 38 | port = ':'+port; 39 | } 40 | 41 | var interfaces = os.networkInterfaces(); 42 | var addresses = []; 43 | for (var n in interfaces) { 44 | for (var n2 in interfaces[n]) { 45 | var address = interfaces[n][n2]; 46 | if (address.family == 'IPv4' && !address.internal) { 47 | addresses.push('http://'+address.address+port); 48 | } 49 | } 50 | } 51 | 52 | addresses.push('http://localhost'+port); 53 | grunt.log.subhead('\n'+label+'Listening on:\n\t', addresses.join('\n\t ')); 54 | }); 55 | } 56 | --------------------------------------------------------------------------------