├── .gitignore ├── BSD_LICENSE.txt ├── README.md ├── doc ├── files.html ├── index.html └── symbols │ ├── _global_.html │ ├── jQuery.html │ ├── jQueryChrono.html │ └── src │ └── lib_jquery.chrono.js.html ├── lib ├── jquery.chrono.js └── jquery.chrono.min.js ├── test ├── qunit.css ├── qunit.js ├── test.html └── tests.js └── tools ├── jsdoc-toolkit ├── README.txt ├── app │ ├── frame.js │ ├── frame │ │ ├── Chain.js │ │ ├── Dumper.js │ │ ├── Hash.js │ │ ├── Link.js │ │ ├── Namespace.js │ │ ├── Opt.js │ │ ├── Reflection.js │ │ ├── String.js │ │ └── Testrun.js │ ├── handlers │ │ ├── FOODOC.js │ │ ├── XMLDOC.js │ │ └── XMLDOC │ │ │ ├── DomReader.js │ │ │ ├── XMLDoc.js │ │ │ └── XMLParse.js │ ├── lib │ │ ├── JSDOC.js │ │ └── JSDOC │ │ │ ├── DocComment.js │ │ │ ├── DocTag.js │ │ │ ├── JsDoc.js │ │ │ ├── JsPlate.js │ │ │ ├── Lang.js │ │ │ ├── Parser.js │ │ │ ├── PluginManager.js │ │ │ ├── Symbol.js │ │ │ ├── SymbolSet.js │ │ │ ├── TextStream.js │ │ │ ├── Token.js │ │ │ ├── TokenReader.js │ │ │ ├── TokenStream.js │ │ │ ├── Util.js │ │ │ └── Walker.js │ ├── main.js │ ├── plugins │ │ ├── commentSrcJson.js │ │ ├── frameworkPrototype.js │ │ ├── functionCall.js │ │ ├── publishSrcHilite.js │ │ ├── symbolLink.js │ │ ├── tagParamConfig.js │ │ └── tagSynonyms.js │ ├── run.js │ ├── t │ │ ├── TestDoc.js │ │ └── runner.js │ ├── test.js │ └── test │ │ ├── addon.js │ │ ├── anon_inner.js │ │ ├── augments.js │ │ ├── augments2.js │ │ ├── borrows.js │ │ ├── borrows2.js │ │ ├── config.js │ │ ├── constructs.js │ │ ├── encoding.js │ │ ├── encoding_other.js │ │ ├── event.js │ │ ├── exports.js │ │ ├── functions_anon.js │ │ ├── functions_nested.js │ │ ├── global.js │ │ ├── globals.js │ │ ├── ignore.js │ │ ├── inner.js │ │ ├── jsdoc_test.js │ │ ├── lend.js │ │ ├── memberof.js │ │ ├── memberof2.js │ │ ├── memberof3.js │ │ ├── memberof_constructor.js │ │ ├── module.js │ │ ├── multi_methods.js │ │ ├── name.js │ │ ├── namespace_nested.js │ │ ├── nocode.js │ │ ├── oblit_anon.js │ │ ├── overview.js │ │ ├── param_inline.js │ │ ├── params_optional.js │ │ ├── prototype.js │ │ ├── prototype_nested.js │ │ ├── prototype_oblit.js │ │ ├── prototype_oblit_constructor.js │ │ ├── public.js │ │ ├── scripts │ │ ├── code.js │ │ └── notcode.txt │ │ ├── shared.js │ │ ├── shared2.js │ │ ├── shortcuts.js │ │ ├── static_this.js │ │ ├── synonyms.js │ │ ├── tosource.js │ │ └── variable_redefine.js ├── changes.txt ├── conf │ └── sample.conf ├── java │ ├── build.xml │ ├── build_1.4.xml │ ├── classes │ │ └── js.jar │ └── src │ │ ├── JsDebugRun.java │ │ └── JsRun.java ├── jsdebug.jar ├── jsrun.jar ├── jsrun.sh └── templates │ └── jsdoc │ ├── allclasses.tmpl │ ├── allfiles.tmpl │ ├── class.tmpl │ ├── index.tmpl │ ├── publish.js │ ├── static │ ├── default.css │ ├── header.html │ └── index.html │ └── symbol.tmpl └── yuicompressor-2.4.6 ├── LICENSE.TXT ├── ant.properties ├── build.xml ├── build └── yuicompressor-2.4.6.jar ├── doc ├── CHANGELOG └── README ├── lib ├── jargs-1.0.jar └── rhino-1.6R7.jar ├── ports └── js │ └── cssmin.js ├── src ├── com │ └── yahoo │ │ └── platform │ │ └── yui │ │ └── compressor │ │ ├── Bootstrap.java │ │ ├── CssCompressor.java │ │ ├── JarClassLoader.java │ │ ├── JavaScriptCompressor.java │ │ ├── JavaScriptIdentifier.java │ │ ├── JavaScriptToken.java │ │ ├── ScriptOrFnScope.java │ │ └── YUICompressor.java └── org │ └── mozilla │ └── javascript │ ├── Decompiler.java │ ├── Decompiler.java.orig │ ├── Parser.java │ ├── Parser.java.orig │ ├── Token.java │ ├── Token.java.orig │ ├── TokenStream.java │ └── TokenStream.java.orig └── tests ├── README ├── _munge.js ├── _munge.js.min ├── _string_combo.js ├── _string_combo.js.min ├── _syntax_error.js ├── _syntax_error.js.min ├── background-position.css ├── background-position.css.min ├── border-none.css ├── border-none.css.min ├── box-model-hack.css ├── box-model-hack.css.min ├── bug2527974.css ├── bug2527974.css.min ├── bug2527991.css ├── bug2527991.css.min ├── bug2527998.css ├── bug2527998.css.min ├── bug2528034.css ├── bug2528034.css.min ├── charset-media.css ├── charset-media.css.min ├── color.css ├── color.css.min ├── comment.css ├── comment.css.min ├── concat-charset.css ├── concat-charset.css.min ├── decimals.css ├── decimals.css.min ├── dollar-header.css ├── dollar-header.css.min ├── float.js ├── float.js.min ├── font-face.css ├── font-face.css.min ├── ie5mac.css ├── ie5mac.css.min ├── media-empty-class.css ├── media-empty-class.css.min ├── media-multi.css ├── media-multi.css.min ├── media-test.css ├── media-test.css.min ├── opacity-filter.css ├── opacity-filter.css.min ├── preserve-new-line.css ├── preserve-new-line.css.min ├── preserve-strings.css ├── preserve-strings.css.min ├── pseudo-first.css ├── pseudo-first.css.min ├── pseudo.css ├── pseudo.css.min ├── special-comments.css ├── special-comments.css.min ├── star-underscore-hacks.css ├── star-underscore-hacks.css.min ├── string-in-comment.css ├── string-in-comment.css.min ├── suite.rhino ├── suite.sh ├── webkit-transform.css ├── webkit-transform.css.min ├── zeros.css └── zeros.css.min /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /BSD_LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Arthur Klepchukov (arthur.klepchukov@gmail.com) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jQuery Chrono plugin (version 1.2) 2 | ================================== 3 | 4 | jQuery Chrono provides syntactic sugar around JavaScript's native 5 | `setTimeout` and `setInterval` functions. 6 | 7 | To execute some code in 5 minutes, instead of writing: 8 | 9 | ```js 10 | setTimeout(function() { ... }, 300000); // how many zeros is that? 11 | ``` 12 | 13 | or the slightly more readable: 14 | 15 | ```js 16 | setTimeout(function() { ... }, 5 * 60 * 1000); // 5... (multiplies in head) min 17 | ``` 18 | 19 | now you can just write: 20 | 21 | ```js 22 | $.after(5, "minutes", function() { ... }); // :) 23 | ```` 24 | 25 | `setTimeout` becomes `$.after` and `setInterval` becomes `$.every`. 26 | 27 | If you don't have jQuery, you can use the aliases `jQueryChrono.every` and 28 | `jQueryChrono.after`. 29 | 30 | Usage 31 | ----- 32 | 33 | These are all valid calls: 34 | 35 | ```js 36 | $.after(100, function() { ... }); // 100 milliseconds 37 | $.after("9.7", function() { ... }); // 9.7 milliseconds 38 | $.after("50sec", function() { ... }); // 50 seconds 39 | $.after("1 minute", function() { ... }); // 1 minute 40 | $.after(7, "mins", function() { ... }); // 7 minutes 41 | $.after("33", "hours", function() { ... }); // 33 hours 42 | $.after("minute", function() { ... }); // 1 minute 43 | $.after("1 hour, 2 minutes, 15 seconds", function() { ... }); // 1:02:15 hours 44 | $.after("1min, 15 s", function() { ... }); // 1:15 minutes 45 | ``` 46 | 47 | `$.every`, for creating intervals, has the same exact syntax as `$.after`. 48 | 49 | Valid time units include: 50 | 51 | * millisecond (default) 52 | 53 | * second 54 | 55 | * minute 56 | 57 | * hour 58 | 59 | * day 60 | 61 | along with all their common abbreviations and pluralizations. 62 | 63 | jQuery Version 64 | -------------- 65 | 66 | This project works with jQuery 1.4+ (see __test/test.html__) but as of version 1.2, also works without jQuery. 67 | 68 | Contributing 69 | ------------ 70 | 71 | * Add relevant QUnit tests and make sure all existing tests pass (in __test/tests.js__) 72 | 73 | * Update the JsDoc (__doc/__) with: 74 | 75 | java -jar tools/jsdoc-toolkit/jsrun.jar tools/jsdoc-toolkit/app/run.js -a -t=tools/jsdoc-toolkit/templates/jsdoc/ -d=doc/ lib/jquery.chrono.js 76 | 77 | * Update the minified file (__lib/jquery.chrono.min.js__) with: 78 | 79 | java -jar tools/yuicompressor-2.4.6/build/yuicompressor-2.4.6.jar -o lib/jquery.chrono.min.js lib/jquery.chrono.js 80 | 81 | Meta 82 | ---- 83 | 84 | _Licensed under the 3-clause **BSD license** (BSD_LICENSE.txt)_ 85 | 86 | Copyright (c) 2011, Arthur Klepchukov (at gmail) 87 | -------------------------------------------------------------------------------- /doc/files.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - File Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 179 | 180 |
181 |
Class Index 182 | | File Index
183 |
184 |

Classes

185 | 194 |
195 |
196 | 197 |
198 |

File Index

199 | 200 | 201 |
202 |

jquery.chrono.js

203 | 204 | The jQuery Chrono plugin 205 | Copyright (c) 2011 Arthur Klepchukov 206 | Licensed under the BSD license (BSD_LICENSE.txt) 207 |
208 | 209 |
Author:
210 |
Arthur Klepchukov
211 | 212 | 213 |
Version:
214 |
1.2
215 | 216 | 217 | 218 |
219 |
220 |
221 | 222 | 223 |
224 |
225 | 226 | Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 22 2011 20:47:20 GMT-0500 (EST) 227 |
228 | 229 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 179 | 180 |
181 |
Class Index 182 | | File Index
183 |
184 |

Classes

185 | 194 |
195 |
196 | 197 |
198 |

Class Index

199 | 200 | 201 |
202 |

_global_

203 | 204 |
205 |
206 | 207 |
208 |

jQuery

209 | the extended jQuery library 210 |
211 |
212 | 213 |
214 |

jQueryChrono

215 | Main namespace 216 |
217 |
218 | 219 | 220 |
221 |
222 | 223 | Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 22 2011 20:47:20 GMT-0500 (EST) 224 |
225 | 226 | -------------------------------------------------------------------------------- /doc/symbols/_global_.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | JsDoc Reference - _global_ 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 181 | 182 | 183 | 184 |
185 | 186 |
Class Index 187 | | File Index
188 |
189 |

Classes

190 | 199 |
200 | 201 |
202 | 203 |
204 | 205 |

206 | 207 | Built-In Namespace _global_ 208 |

209 | 210 | 211 |

212 | 213 | 214 | 215 | 216 | 217 | 218 |

219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 245 | 246 | 247 | 248 |
Field Summary
Field AttributesField Name and Description
  240 |
241 | jQueryanonymous 242 |
243 |
244 |
249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 |
265 | Field Detail 266 |
267 | 268 | 269 |
270 | 271 | 272 | jQueryanonymous 273 | 274 |
275 |
276 | 277 | 278 |
279 | Defined in: jquery.chrono.js. 280 | 281 | 282 |
283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 |
302 |
303 | 304 | 305 | 306 |
307 | 308 | Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 22 2011 20:47:20 GMT-0500 (EST) 309 |
310 | 311 | 312 | -------------------------------------------------------------------------------- /lib/jquery.chrono.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileOverview The jQuery Chrono plugin 3 | * Copyright (c) 2011 Arthur Klepchukov 4 | * Licensed under the BSD license (BSD_LICENSE.txt) 5 | * 6 | * @author Arthur Klepchukov 7 | * @version 1.2 8 | */ 9 | var jQueryChrono;jQueryChrono=(function(){function b(){var p=jQueryChrono.create_timer.apply(this,arguments);return setTimeout(p.callback,p.when)}function i(){var p=jQueryChrono.create_timer.apply(this,arguments);return setInterval(p.callback,p.when)}var e={delay:4,units:"milliseconds"},c=1,k=c*1000,g=k*60,o=g*60,m=o*24;var n={millisecond:c,milliseconds:c,ms:c,second:k,seconds:k,sec:k,secs:k,s:k,minute:g,minutes:g,min:g,mins:g,m:g,hour:o,hours:o,hr:o,hrs:o,h:o,day:m,days:m,d:m};var d;if(typeof(jQuery)!=="undefined"){d=jQuery.trim}else{d=String.prototype.trim2?function(p){return p==null?"":String.prototype.trim.call(p)}:function(p){return p==null?"":p.toString().replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")}}function h(p,q){if(typeof q[0]==="string"){p.delay=parseFloat(q[0],10);if(isNaN(p.delay)){p.delay=(n[q[0]]>c)?1:e.delay}}else{p.delay=q[0]}if(typeof p.delay!=="number"||isNaN(p.delay)){throw"$.after and $.every - Require a numerical delay as the 1st argument"}return p}function l(p,q){if(typeof q[0]==="string"&&p.delay!==null){p.units=d(q[0].replace(p.delay,""))||null}if(typeof q[1]==="string"){p.units=q[1]}if(p.units===null&&q.length===2){p.units=e.units}if(typeof n[p.units]!=="number"){throw"$.after and $.every - Require a valid unit of time as the 2nd argument"}return p}function a(p,q){p.callback=q[q.length-1];if(typeof(p.callback)!="function"){throw"$.after and $.every - Require a callback as the last argument"}return p}function j(q,t){var s,r,p="",v,u=[];s=(typeof t[0]==="string")?t[0].split(","):[];for(r in s){if(!/\d\s?\w+/.test(s[r])){throw"$.after and $.every - Invalid delays with units sequence: "+s.join(",")}v=f.call(this,s[r],q.callback);if(p===""||n[v.units]<=n[p]){p=v.units}u[r]=v}q.units=p;for(r in u){q.delay+=u[r].delay*(n[u[r].units]/n[p])}return q}function f(){var p={delay:null,units:null,when:null,callback:null};if(arguments.length<2||arguments.length>3){throw"$.after and $.every - Accept only 2 or 3 arguments"}p=a(p,arguments);if(typeof arguments[0]==="string"&&arguments[0].search(",")>-1){p=j(p,arguments)}else{p=h(p,arguments);p=l(p,arguments)}if(p.delay li:last-child { 182 | border-radius: 0 0 15px 15px; 183 | -moz-border-radius: 0 0 15px 15px; 184 | -webkit-border-bottom-right-radius: 15px; 185 | -webkit-border-bottom-left-radius: 15px; 186 | } 187 | 188 | #qunit-tests .fail { color: #000000; background-color: #EE5757; } 189 | #qunit-tests .fail .test-name, 190 | #qunit-tests .fail .module-name { color: #000000; } 191 | 192 | #qunit-tests .fail .test-actual { color: #EE5757; } 193 | #qunit-tests .fail .test-expected { color: green; } 194 | 195 | #qunit-banner.qunit-fail { background-color: #EE5757; } 196 | 197 | 198 | /** Result */ 199 | 200 | #qunit-testresult { 201 | padding: 0.5em 0.5em 0.5em 2.5em; 202 | 203 | color: #2b81af; 204 | background-color: #D2E0E6; 205 | 206 | border-bottom: 1px solid white; 207 | } 208 | 209 | /** Fixture */ 210 | 211 | #qunit-fixture { 212 | position: absolute; 213 | top: -10000px; 214 | left: -10000px; 215 | } 216 | -------------------------------------------------------------------------------- /test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery Chrono Unit Tests 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

jQuery Chrono Unit Tests

20 |

21 |
22 |

23 |
    24 |
    25 | 26 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/README.txt: -------------------------------------------------------------------------------- 1 | ====================================================================== 2 | 3 | DESCRIPTION: 4 | 5 | This is the source code for JsDoc Toolkit, an automatic documentation 6 | generation tool for JavaScript. It is written in JavaScript and is run 7 | from a command line (or terminal) using Java and Mozilla's Rhino 8 | JavaScript runtime engine. 9 | 10 | Using this tool you can automatically turn JavaDoc-like comments in 11 | your JavaScript source code into published output files, such as HTML 12 | or XML. 13 | 14 | For more information, to report a bug, or to browse the technical 15 | documentation for this tool please visit the official JsDoc Toolkit 16 | project homepage at http://code.google.com/p/jsdoc-toolkit/ 17 | 18 | For the most up-to-date documentation on JsDoc Toolkit see the 19 | official wiki at http://code.google.com/p/jsdoc-toolkit/w/list 20 | 21 | ====================================================================== 22 | 23 | REQUIREMENTS: 24 | 25 | JsDoc Toolkit is known to work with: 26 | java version "1.6.0_03" 27 | Java(TM) SE Runtime Environment (build 1.6.0_03-b05) 28 | on Windows XP, 29 | and java version "1.5.0_19" 30 | Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304) 31 | on Mac OS X 10.5. 32 | 33 | Other versions of java may or may not work with JsDoc Toolkit. 34 | 35 | ====================================================================== 36 | 37 | USAGE: 38 | 39 | Running JsDoc Toolkit requires you to have Java installed on your 40 | computer. For more information see http://www.java.com/getjava/ 41 | 42 | Before running the JsDoc Toolkit app you should change your current 43 | working directory to the jsdoc-toolkit folder. Then follow the 44 | examples below, or as shown on the project wiki. 45 | 46 | On a computer running Windows a valid command line to run JsDoc 47 | Toolkit might look like this: 48 | 49 | > java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode.js 50 | 51 | On Mac OS X or Linux the same command would look like this: 52 | 53 | $ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc mycode.js 54 | 55 | The above assumes your current working directory contains jsrun.jar, 56 | the "app" and "templates" subdirectories from the standard JsDoc 57 | Toolkit distribution and that the relative path to the code you wish 58 | to document is "mycode.js". 59 | 60 | The output documentation files will be saved to a new directory named 61 | "out" (by default) in the current directory, or if you specify a 62 | -d=somewhere_else option, to the somewhere_else directory. 63 | 64 | For help (usage notes) enter this on the command line: 65 | 66 | $ java -jar jsrun.jar app/run.js --help 67 | 68 | More information about the various command line options used by JsDoc 69 | Toolkit are available on the project wiki. 70 | 71 | ====================================================================== 72 | 73 | RUNNING VIA SHELL SCRIPT 74 | 75 | Avi Deitcher has contributed the file jsrun.sh with the following usage notes: 76 | 77 | A script to simplify running jsdoc from the command-line, especially when 78 | running from within a development or build environment such as ant. 79 | 80 | Normally, to run jsdoc, you need a command-line as the following: 81 | java -Djsdoc.dir=/some/long/dir/path/to/jsdoc -jar 82 | /some/long/dir/path/to/jsdoc/jsrun.jar /some/long/dir/path/to/jsdoc/app/run.js 83 | -t=template -r=4 /some/long/dir/path/to/my/src/code 84 | 85 | This can get tedious to redo time and again, and difficult to use from within a build environment. 86 | 87 | To simplify the process, jsrun.sh will automatically run this path, as well as passing through any arguments. 88 | 89 | Usage: jsrun.sh 90 | 91 | All will be passed through. 92 | Additionally, jsrun.sh will take the following actions: 93 | 1) If the environment variable JSDOCDIR is set, it will add 94 | "-Djsdoc.dir=$JSDOCDIR" to the command-line 95 | 2) If the environment variable JSDOCTEMPLATEDIR is set, it will add 96 | "-Djsdoc.template.dir=$JSDOCTEMPLATEDIR" to the command-line 97 | 3) java with the appropriate path to jsrun.jar and run.js will be instantiated 98 | 99 | If not variables are set, it is assumed that the path to jsrun.jar and app/ is in the current working directory. 100 | 101 | Example: 102 | # jsrun.sh ./src/ 103 | Assuming JSDOCDIR=/some/path/to/my/jsdoc will cause the following command to 104 | execute: 105 | java -Djsdoc.dir=/some/path/to/my/jsdoc -jar /some/path/to/my/jsdoc/jsrun.jar 106 | /some/path/to/my/jsdoc/app/run.js ./src/ 107 | 108 | ====================================================================== 109 | 110 | TESTING: 111 | 112 | To run the suite of unit tests included with JsDoc Toolkit enter this 113 | on the command line: 114 | 115 | $ java -jar jsrun.jar app/run.js -T 116 | 117 | To see a dump of the internal data structure that JsDoc Toolkit has 118 | built from your source files use this command: 119 | 120 | $ java -jar jsrun.jar app/run.js mycode.js -Z 121 | 122 | ====================================================================== 123 | 124 | LICENSE: 125 | 126 | JSDoc.pm 127 | 128 | This project is based on the JSDoc.pm tool, created by Michael 129 | Mathews and Gabriel Reid. More information on JsDoc.pm can 130 | be found on the JSDoc.pm homepage: http://jsdoc.sourceforge.net/ 131 | 132 | Complete documentation on JsDoc Toolkit can be found on the project 133 | wiki at http://code.google.com/p/jsdoc-toolkit/w/list 134 | 135 | Rhino 136 | 137 | Rhino (JavaScript in Java) is open source and licensed by Mozilla 138 | under the MPL 1.1 or later/GPL 2.0 or later licenses, the text of 139 | which is available at http://www.mozilla.org/MPL/ 140 | 141 | You can obtain the source code for Rhino from the Mozilla web site at 142 | http://www.mozilla.org/rhino/download.html 143 | 144 | JsDoc Toolkit is a larger work that uses the Rhino JavaScript engine 145 | but is not derived from it in any way. The Rhino library is used 146 | without modification and without any claims whatsoever. 147 | 148 | The Rhino Debugger 149 | 150 | You can obtain more information about the Rhino Debugger from the 151 | Mozilla web site at http://www.mozilla.org/rhino/debugger.html 152 | 153 | JsDoc Toolkit is a larger work that uses the Rhino Debugger but 154 | is not derived from it in any way. The Rhino Debugger is used 155 | without modification and without any claims whatsoever. 156 | 157 | JsDoc Toolkit 158 | 159 | All code specific to JsDoc Toolkit are free, open source and licensed 160 | for use under the X11/MIT License. 161 | 162 | JsDoc Toolkit is Copyright (c)2009 Michael Mathews 163 | 164 | This program is free software; you can redistribute it and/or 165 | modify it under the terms below. 166 | 167 | Permission is hereby granted, free of charge, to any person obtaining 168 | a copy of this software and associated documentation files (the 169 | "Software"), to deal in the Software without restriction, including 170 | without limitation the rights to use, copy, modify, merge, publish, 171 | distribute, sublicense, and/or sell copies of the Software, and to 172 | permit persons to whom the Software is furnished to do so, subject to 173 | the following conditions: The above copyright notice and this 174 | permission notice must be included in all copies or substantial 175 | portions of the Software. 176 | 177 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 178 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 179 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 180 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 181 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 182 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 183 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 184 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame.js: -------------------------------------------------------------------------------- 1 | IO.include("frame/Opt.js"); 2 | IO.include("frame/Chain.js"); 3 | IO.include("frame/Link.js"); 4 | IO.include("frame/String.js"); 5 | IO.include("frame/Hash.js"); 6 | IO.include("frame/Namespace.js"); 7 | //IO.include("frame/Reflection.js"); 8 | 9 | /** A few helper functions to make life a little easier. */ 10 | 11 | function defined(o) { 12 | return (o !== undefined); 13 | } 14 | 15 | function copy(o) { // todo check for circular refs 16 | if (o == null || typeof(o) != 'object') return o; 17 | var c = new o.constructor(); 18 | for(var p in o) c[p] = copy(o[p]); 19 | return c; 20 | } 21 | 22 | function isUnique(arr) { 23 | var l = arr.length; 24 | for(var i = 0; i < l; i++ ) { 25 | if (arr.lastIndexOf(arr[i]) > i) return false; 26 | } 27 | return true; 28 | } 29 | 30 | /** Returns the given string with all regex meta characters backslashed. */ 31 | RegExp.escapeMeta = function(str) { 32 | return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1"); 33 | } 34 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/Chain.js: -------------------------------------------------------------------------------- 1 | /**@constructor*/ 2 | function ChainNode(object, link) { 3 | this.value = object; 4 | this.link = link; // describes this node's relationship to the previous node 5 | } 6 | 7 | /**@constructor*/ 8 | function Chain(valueLinks) { 9 | this.nodes = []; 10 | this.cursor = -1; 11 | 12 | if (valueLinks && valueLinks.length > 0) { 13 | this.push(valueLinks[0], "//"); 14 | for (var i = 1, l = valueLinks.length; i < l; i+=2) { 15 | this.push(valueLinks[i+1], valueLinks[i]); 16 | } 17 | } 18 | } 19 | 20 | Chain.prototype.push = function(o, link) { 21 | if (this.nodes.length > 0 && link) this.nodes.push(new ChainNode(o, link)); 22 | else this.nodes.push(new ChainNode(o)); 23 | } 24 | 25 | Chain.prototype.unshift = function(o, link) { 26 | if (this.nodes.length > 0 && link) this.nodes[0].link = link; 27 | this.nodes.unshift(new ChainNode(o)); 28 | this.cursor++; 29 | } 30 | 31 | Chain.prototype.get = function() { 32 | if (this.cursor < 0 || this.cursor > this.nodes.length-1) return null; 33 | return this.nodes[this.cursor]; 34 | } 35 | 36 | Chain.prototype.first = function() { 37 | this.cursor = 0; 38 | return this.get(); 39 | } 40 | 41 | Chain.prototype.last = function() { 42 | this.cursor = this.nodes.length-1; 43 | return this.get(); 44 | } 45 | 46 | Chain.prototype.next = function() { 47 | this.cursor++; 48 | return this.get(); 49 | } 50 | 51 | Chain.prototype.prev = function() { 52 | this.cursor--; 53 | return this.get(); 54 | } 55 | 56 | Chain.prototype.toString = function() { 57 | var string = ""; 58 | for (var i = 0, l = this.nodes.length; i < l; i++) { 59 | if (this.nodes[i].link) string += " -("+this.nodes[i].link+")-> "; 60 | string += this.nodes[i].value.toString(); 61 | } 62 | return string; 63 | } 64 | 65 | Chain.prototype.joinLeft = function() { 66 | var result = ""; 67 | for (var i = 0, l = this.cursor; i < l; i++) { 68 | if (result && this.nodes[i].link) result += this.nodes[i].link; 69 | result += this.nodes[i].value.toString(); 70 | } 71 | return result; 72 | } 73 | 74 | 75 | /* USAGE: 76 | 77 | var path = "one/two/three.four/five-six"; 78 | var pathChain = new Chain(path.split(/([\/.-])/)); 79 | print(pathChain); 80 | 81 | var lineage = new Chain(); 82 | lineage.push("Port"); 83 | lineage.push("Les", "son"); 84 | lineage.push("Dawn", "daughter"); 85 | lineage.unshift("Purdie", "son"); 86 | 87 | print(lineage); 88 | 89 | // walk left 90 | for (var node = lineage.last(); node !== null; node = lineage.prev()) { 91 | print("< "+node.value); 92 | } 93 | 94 | // walk right 95 | var node = lineage.first() 96 | while (node !== null) { 97 | print(node.value); 98 | node = lineage.next(); 99 | if (node && node.link) print("had a "+node.link+" named"); 100 | } 101 | 102 | */ -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/Dumper.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class 3 |
      4 | This is a lightly modified version of Kevin Jones' JavaScript
      5 | library Data.Dump. To download the original visit:
      6 |     http://openjsan.org/doc/k/ke/kevinj/Data/Dump/
      7 | 
      8 | AUTHORS
      9 | 
     10 | The Data.Dump JavaScript module is written by Kevin Jones 
     11 | (kevinj@cpan.org), based on Data::Dump by Gisle Aas (gisle@aas.no),
     12 | based on Data::Dumper by Gurusamy Sarathy (gsar@umich.edu).
     13 | 
     14 | COPYRIGHT
     15 | 
     16 | Copyright 2007 Kevin Jones. Copyright 1998-2000,2003-2004 Gisle Aas.
     17 | Copyright 1996-1998 Gurusamy Sarathy.
     18 | 
     19 | This program is free software; you can redistribute it and/or modify
     20 | it under the terms of the Perl Artistic License
     21 | 
     22 | See http://www.perl.com/perl/misc/Artistic.html
     23 | 
    24 | * @static 25 | */ 26 | Dumper = { 27 | /** @param [...] The objects to dump. */ 28 | dump: function () { 29 | if (arguments.length > 1) 30 | return this._dump(arguments); 31 | else if (arguments.length == 1) 32 | return this._dump(arguments[0]); 33 | else 34 | return "()"; 35 | }, 36 | 37 | _dump: function (obj) { 38 | if (typeof obj == 'undefined') return 'undefined'; 39 | var out; 40 | if (obj.serialize) { return obj.serialize(); } 41 | var type = this._typeof(obj); 42 | if (obj.circularReference) obj.circularReference++; 43 | switch (type) { 44 | case 'circular': 45 | out = "{ //circularReference\n}"; 46 | break; 47 | case 'object': 48 | var pairs = new Array; 49 | 50 | for (var prop in obj) { 51 | if (prop != "circularReference" && obj.hasOwnProperty(prop)) { //hide inherited properties 52 | pairs.push(prop + ': ' + this._dump(obj[prop])); 53 | } 54 | } 55 | 56 | out = '{' + this._format_list(pairs) + '}'; 57 | break; 58 | 59 | case 'string': 60 | for (var prop in Dumper.ESC) { 61 | if (Dumper.ESC.hasOwnProperty(prop)) { 62 | obj = obj.replace(prop, Dumper.ESC[prop]); 63 | } 64 | } 65 | 66 | // Escape UTF-8 Strings 67 | if (obj.match(/^[\x00-\x7f]*$/)) { 68 | out = '"' + obj.replace(/\"/g, "\\\"").replace(/([\n\r]+)/g, "\\$1") + '"'; 69 | } 70 | else { 71 | out = "unescape('"+escape(obj)+"')"; 72 | } 73 | break; 74 | 75 | case 'array': 76 | var elems = new Array; 77 | 78 | for (var i=0; i 60 ? '\n' : ' '; 109 | return nl + list.join(',' + nl) + nl; 110 | }, 111 | 112 | _typeof: function (obj) { 113 | if (obj && obj.circularReference && obj.circularReference > 1) return 'circular'; 114 | if (Array.prototype.isPrototypeOf(obj)) return 'array'; 115 | if (Date.prototype.isPrototypeOf(obj)) return 'date'; 116 | if (typeof obj.nodeType != 'undefined') return 'element'; 117 | return typeof(obj); 118 | }, 119 | 120 | _dump_dom: function (obj) { 121 | return '"' + Dumper.nodeTypes[obj.nodeType] + '"'; 122 | } 123 | }; 124 | 125 | Dumper.ESC = { 126 | "\t": "\\t", 127 | "\n": "\\n", 128 | "\f": "\\f" 129 | }; 130 | 131 | Dumper.nodeTypes = { 132 | 1: "ELEMENT_NODE", 133 | 2: "ATTRIBUTE_NODE", 134 | 3: "TEXT_NODE", 135 | 4: "CDATA_SECTION_NODE", 136 | 5: "ENTITY_REFERENCE_NODE", 137 | 6: "ENTITY_NODE", 138 | 7: "PROCESSING_INSTRUCTION_NODE", 139 | 8: "COMMENT_NODE", 140 | 9: "DOCUMENT_NODE", 141 | 10: "DOCUMENT_TYPE_NODE", 142 | 11: "DOCUMENT_FRAGMENT_NODE", 143 | 12: "NOTATION_NODE" 144 | }; -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/Hash.js: -------------------------------------------------------------------------------- 1 | /** 2 | @constructor 3 | @example 4 | var _index = new Hash(); 5 | _index.set("a", "apple"); 6 | _index.set("b", "blue"); 7 | _index.set("c", "coffee"); 8 | 9 | for (var p = _index.first(); p; p = _index.next()) { 10 | print(p.key+" is for "+p.value); 11 | } 12 | 13 | */ 14 | var Hash = function() { 15 | this._map = {}; 16 | this._keys = []; 17 | this._vals = []; 18 | this.reset(); 19 | } 20 | 21 | Hash.prototype.set = function(k, v) { 22 | if (k != "") { 23 | this._keys.push(k); 24 | this._map["="+k] = this._vals.length; 25 | this._vals.push(v); 26 | } 27 | } 28 | 29 | Hash.prototype.replace = function(k, k2, v) { 30 | if (k == k2) return; 31 | 32 | var offset = this._map["="+k]; 33 | this._keys[offset] = k2; 34 | if (typeof v != "undefined") this._vals[offset] = v; 35 | this._map["="+k2] = offset; 36 | delete(this._map["="+k]); 37 | } 38 | 39 | Hash.prototype.drop = function(k) { 40 | if (k != "") { 41 | var offset = this._map["="+k]; 42 | this._keys.splice(offset, 1); 43 | this._vals.splice(offset, 1); 44 | delete(this._map["="+k]); 45 | for (var p in this._map) { 46 | if (this._map[p] >= offset) this._map[p]--; 47 | } 48 | if (this._cursor >= offset && this._cursor > 0) this._cursor--; 49 | } 50 | } 51 | 52 | Hash.prototype.get = function(k) { 53 | if (k != "") { 54 | return this._vals[this._map["="+k]]; 55 | } 56 | } 57 | 58 | Hash.prototype.keys = function() { 59 | return this._keys; 60 | } 61 | 62 | Hash.prototype.hasKey = function(k) { 63 | if (k != "") { 64 | return (typeof this._map["="+k] != "undefined"); 65 | } 66 | } 67 | 68 | Hash.prototype.values = function() { 69 | return this._vals; 70 | } 71 | 72 | Hash.prototype.reset = function() { 73 | this._cursor = 0; 74 | } 75 | 76 | Hash.prototype.first = function() { 77 | this.reset(); 78 | return this.next(); 79 | } 80 | 81 | Hash.prototype.next = function() { 82 | if (this._cursor++ < this._keys.length) 83 | return {key: this._keys[this._cursor-1], value: this._vals[this._cursor-1]}; 84 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/Link.js: -------------------------------------------------------------------------------- 1 | /** Handle the creation of HTML links to documented symbols. 2 | @constructor 3 | */ 4 | function Link() { 5 | this.alias = ""; 6 | this.src = ""; 7 | this.file = ""; 8 | this.text = ""; 9 | this.innerName = ""; 10 | this.classLink = false; 11 | this.targetName = ""; 12 | 13 | this.target = function(targetName) { 14 | if (defined(targetName)) this.targetName = targetName; 15 | return this; 16 | } 17 | this.inner = function(inner) { 18 | if (defined(inner)) this.innerName = inner; 19 | return this; 20 | } 21 | this.withText = function(text) { 22 | if (defined(text)) this.text = text; 23 | return this; 24 | } 25 | this.toSrc = function(filename) { 26 | if (defined(filename)) this.src = filename; 27 | return this; 28 | } 29 | this.toSymbol = function(alias) { 30 | if (defined(alias)) this.alias = new String(alias); 31 | return this; 32 | } 33 | this.toClass = function(alias) { 34 | this.classLink = true; 35 | return this.toSymbol(alias); 36 | } 37 | this.toFile = function(file) { 38 | if (defined(file)) this.file = file; 39 | return this; 40 | } 41 | 42 | this.toString = function() { 43 | var linkString; 44 | var thisLink = this; 45 | 46 | if (this.alias) { 47 | linkString = this.alias.replace(/(^|[^a-z$0-9_#.:^-])([|a-z$0-9_#.:^-]+)($|[^a-z$0-9_#.:^-])/i, 48 | function(match, prematch, symbolName, postmatch) { 49 | var symbolNames = symbolName.split("|"); 50 | var links = []; 51 | for (var i = 0, l = symbolNames.length; i < l; i++) { 52 | thisLink.alias = symbolNames[i]; 53 | links.push(thisLink._makeSymbolLink(symbolNames[i])); 54 | } 55 | return prematch+links.join("|")+postmatch; 56 | } 57 | ); 58 | } 59 | else if (this.src) { 60 | linkString = thisLink._makeSrcLink(this.src); 61 | } 62 | else if (this.file) { 63 | linkString = thisLink._makeFileLink(this.file); 64 | } 65 | 66 | return linkString; 67 | } 68 | } 69 | 70 | /** prefixed for hashes */ 71 | Link.hashPrefix = ""; 72 | 73 | /** Appended to the front of relative link paths. */ 74 | Link.base = ""; 75 | 76 | Link.symbolNameToLinkName = function(symbol) { 77 | var linker = "", 78 | ns = ""; 79 | 80 | if (symbol.isStatic) linker = "."; 81 | else if (symbol.isInner) linker = "-"; 82 | 83 | if (symbol.isEvent && !/^event:/.test(symbol.name)) { 84 | ns = "event:"; 85 | } 86 | return Link.hashPrefix+linker+ns+symbol.name; 87 | } 88 | 89 | Link.getSymbol= function(alias) { 90 | var symbol= Link.symbolSet.getSymbol(alias); 91 | 92 | if (symbol) 93 | return symbol; 94 | 95 | if ('#'!==alias.charAt(0) || !Link.currentSymbol) 96 | return null; 97 | 98 | // resolve relative name 99 | var container= Link.currentSymbol; 100 | 101 | while (container) 102 | { 103 | symbol= Link.symbolSet.getSymbol(container.alias + alias); 104 | if (symbol) 105 | return symbol; 106 | 107 | // No superclass 108 | if (!container.augments.length) 109 | return null; 110 | 111 | container= Link.symbolSet.getSymbol(container.augments[0].desc); 112 | } 113 | 114 | return null; 115 | } 116 | 117 | /** Create a link to another symbol. */ 118 | Link.prototype._makeSymbolLink = function(alias) { 119 | var linkBase = Link.base+publish.conf.symbolsDir; 120 | var linkTo = Link.getSymbol(alias); 121 | var linkPath; 122 | var target = (this.targetName)? " target=\""+this.targetName+"\"" : ""; 123 | 124 | // if there is no symbol by that name just return the name unaltered 125 | if (!linkTo) 126 | return this.text || alias; 127 | 128 | // it's a symbol in another file 129 | else { 130 | if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property 131 | linkPath= (Link.filemap) ? Link.filemap[linkTo.memberOf] : 132 | escape(linkTo.memberOf) || "_global_"; 133 | linkPath += publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo); 134 | } 135 | else { 136 | linkPath = (Link.filemap)? Link.filemap[linkTo.alias] : escape(linkTo.alias); 137 | linkPath += publish.conf.ext;// + (this.classLink? "":"#" + Link.hashPrefix + "constructor"); 138 | } 139 | linkPath = linkBase + linkPath 140 | } 141 | 142 | var linkText= this.text || alias; 143 | 144 | var link = {linkPath: linkPath, linkText: linkText, linkInner: (this.innerName? "#"+this.innerName : "")}; 145 | 146 | if (typeof JSDOC.PluginManager != "undefined") { 147 | JSDOC.PluginManager.run("onSymbolLink", link); 148 | } 149 | 150 | return ""+link.linkText+""; 151 | } 152 | 153 | /** Create a link to a source file. */ 154 | Link.prototype._makeSrcLink = function(srcFilePath) { 155 | var target = (this.targetName)? " target=\""+this.targetName+"\"" : ""; 156 | 157 | // transform filepath into a filename 158 | var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "_"); 159 | var outFilePath = Link.base + publish.conf.srcDir + srcFile + publish.conf.ext; 160 | 161 | if (!this.text) this.text = FilePath.fileName(srcFilePath); 162 | return ""+this.text+""; 163 | } 164 | 165 | /** Create a link to a source file. */ 166 | Link.prototype._makeFileLink = function(filePath) { 167 | var target = (this.targetName)? " target=\""+this.targetName+"\"" : ""; 168 | 169 | var outFilePath = Link.base + filePath; 170 | 171 | if (!this.text) this.text = filePath; 172 | return ""+this.text+""; 173 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/Namespace.js: -------------------------------------------------------------------------------- 1 | _global_ = this; 2 | 3 | function Namespace(name, f) { 4 | var n = name.split("."); 5 | for (var o = _global_, i = 0, l = n.length; i < l; i++) { 6 | o = o[n[i]] = o[n[i]] || {}; 7 | } 8 | 9 | if (f) f(); 10 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/Opt.js: -------------------------------------------------------------------------------- 1 | /** @namespace */ 2 | Opt = { 3 | /** 4 | * Get commandline option values. 5 | * @param {Array} args Commandline arguments. Like ["-a=xml", "-b", "--class=new", "--debug"] 6 | * @param {object} optNames Map short names to long names. Like {a:"accept", b:"backtrace", c:"class", d:"debug"}. 7 | * @return {object} Short names and values. Like {a:"xml", b:true, c:"new", d:true} 8 | */ 9 | get: function(args, optNames) { 10 | var opt = {"_": []}; // the unnamed option allows multiple values 11 | for (var i = 0; i < args.length; i++) { 12 | var arg = new String(args[i]); 13 | var name; 14 | var value; 15 | if (arg.charAt(0) == "-") { 16 | if (arg.charAt(1) == "-") { // it's a longname like --foo 17 | arg = arg.substring(2); 18 | var m = arg.split("="); 19 | name = m.shift(); 20 | value = m.shift(); 21 | if (typeof value == "undefined") value = true; 22 | 23 | for (var n in optNames) { // convert it to a shortname 24 | if (name == optNames[n]) { 25 | name = n; 26 | } 27 | } 28 | } 29 | else { // it's a shortname like -f 30 | arg = arg.substring(1); 31 | var m = arg.split("="); 32 | name = m.shift(); 33 | value = m.shift(); 34 | if (typeof value == "undefined") value = true; 35 | 36 | for (var n in optNames) { // find the matching key 37 | if (name == n || name+'[]' == n) { 38 | name = n; 39 | break; 40 | } 41 | } 42 | } 43 | if (name.match(/(.+)\[\]$/)) { // it's an array type like n[] 44 | name = RegExp.$1; 45 | if (!opt[name]) opt[name] = []; 46 | } 47 | 48 | if (opt[name] && opt[name].push) { 49 | opt[name].push(value); 50 | } 51 | else { 52 | opt[name] = value; 53 | } 54 | } 55 | else { // not associated with any optname 56 | opt._.push(args[i]); 57 | } 58 | } 59 | return opt; 60 | } 61 | } 62 | 63 | /*t: 64 | plan(11, "Testing Opt."); 65 | 66 | is( 67 | typeof Opt, 68 | "object", 69 | "Opt is an object." 70 | ); 71 | 72 | is( 73 | typeof Opt.get, 74 | "function", 75 | "Opt.get is a function." 76 | ); 77 | 78 | var optNames = {a:"accept", b:"backtrace", c:"class", d:"debug", "e[]":"exceptions"}; 79 | var t_options = Opt.get(["-a=xml", "-b", "--class=new", "--debug", "-e=one", "-e=two", "foo", "bar"], optNames); 80 | 81 | is( 82 | t_options.a, 83 | "xml", 84 | "an option defined with a short name can be accessed by its short name." 85 | ); 86 | 87 | is( 88 | t_options.b, 89 | true, 90 | "an option defined with a short name and no value are true." 91 | ); 92 | 93 | is( 94 | t_options.c, 95 | "new", 96 | "an option defined with a long name can be accessed by its short name." 97 | ); 98 | 99 | is( 100 | t_options.d, 101 | true, 102 | "an option defined with a long name and no value are true." 103 | ); 104 | 105 | is( 106 | typeof t_options.e, 107 | "object", 108 | "an option that can accept multiple values is defined." 109 | ); 110 | 111 | is( 112 | t_options.e.length, 113 | 2, 114 | "an option that can accept multiple values can have more than one value." 115 | ); 116 | 117 | is( 118 | t_options.e[1], 119 | "two", 120 | "an option that can accept multiple values can be accessed as an array." 121 | ); 122 | 123 | is( 124 | typeof t_options._, 125 | "object", 126 | "the property '_' is defined for unnamed options." 127 | ); 128 | 129 | is( 130 | t_options._[0], 131 | "foo", 132 | "the property '_' can be accessed as an array." 133 | ); 134 | */ -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/Reflection.js: -------------------------------------------------------------------------------- 1 | /**@constructor*/ 2 | function Reflection(obj) { 3 | this.obj = obj; 4 | } 5 | 6 | Reflection.prototype.getConstructorName = function() { 7 | if (this.obj.constructor.name) return this.obj.constructor.name; 8 | var src = this.obj.constructor.toSource(); 9 | var name = src.substring(name.indexOf("function")+8, src.indexOf('(')).replace(/ /g,''); 10 | return name; 11 | } 12 | 13 | Reflection.prototype.getMethod = function(name) { 14 | for (var p in this.obj) { 15 | if (p == name && typeof(this.obj[p]) == "function") return this.obj[p]; 16 | } 17 | return null; 18 | } 19 | 20 | Reflection.prototype.getParameterNames = function() { 21 | var src = this.obj.toSource(); 22 | src = src.substring( 23 | src.indexOf("(", 8)+1, src.indexOf(")") 24 | ); 25 | return src.split(/, ?/); 26 | } 27 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/frame/String.js: -------------------------------------------------------------------------------- 1 | /** 2 | @name String 3 | @class Additions to the core string object. 4 | */ 5 | 6 | /** @author Steven Levithan, released as public domain. */ 7 | String.prototype.trim = function() { 8 | var str = this.replace(/^\s+/, ''); 9 | for (var i = str.length - 1; i >= 0; i--) { 10 | if (/\S/.test(str.charAt(i))) { 11 | str = str.substring(0, i + 1); 12 | break; 13 | } 14 | } 15 | return str; 16 | } 17 | /*t: 18 | plan(6, "Testing String.prototype.trim."); 19 | 20 | var s = " a bc ".trim(); 21 | is(s, "a bc", "multiple spaces front and back are trimmed."); 22 | 23 | s = "a bc\n\n".trim(); 24 | is(s, "a bc", "newlines only in back are trimmed."); 25 | 26 | s = "\ta bc".trim(); 27 | is(s, "a bc", "tabs only in front are trimmed."); 28 | 29 | s = "\n \t".trim(); 30 | is(s, "", "an all-space string is trimmed to empty."); 31 | 32 | s = "a b\nc".trim(); 33 | is(s, "a b\nc", "a string with no spaces in front or back is trimmed to itself."); 34 | 35 | s = "".trim(); 36 | is(s, "", "an empty string is trimmed to empty."); 37 | 38 | */ 39 | 40 | String.prototype.balance = function(open, close) { 41 | var i = 0; 42 | while (this.charAt(i) != open) { 43 | if (i == this.length) return [-1, -1]; 44 | i++; 45 | } 46 | 47 | var j = i+1; 48 | var balance = 1; 49 | while (j < this.length) { 50 | if (this.charAt(j) == open) balance++; 51 | if (this.charAt(j) == close) balance--; 52 | if (balance == 0) break; 53 | j++; 54 | if (j == this.length) return [-1, -1]; 55 | } 56 | 57 | return [i, j]; 58 | } 59 | /*t: 60 | plan(16, "Testing String.prototype.balance."); 61 | 62 | var s = "{abc}".balance("{","}"); 63 | is(s[0], 0, "opener in first is found."); 64 | is(s[1], 4, "closer in last is found."); 65 | 66 | s = "ab{c}de".balance("{","}"); 67 | is(s[0], 2, "opener in middle is found."); 68 | is(s[1], 4, "closer in middle is found."); 69 | 70 | s = "a{b{c}de}f".balance("{","}"); 71 | is(s[0], 1, "nested opener is found."); 72 | is(s[1], 8, "nested closer is found."); 73 | 74 | s = "{}".balance("{","}"); 75 | is(s[0], 0, "opener with no content is found."); 76 | is(s[1], 1, "closer with no content is found."); 77 | 78 | s = "".balance("{","}"); 79 | is(s[0], -1, "empty string opener is -1."); 80 | is(s[1], -1, "empty string closer is -1."); 81 | 82 | s = "{abc".balance("{","}"); 83 | is(s[0], -1, "opener with no closer returns -1."); 84 | is(s[1], -1, "no closer returns -1."); 85 | 86 | s = "abc".balance("{","}"); 87 | is(s[0], -1, "no opener or closer returns -1 for opener."); 88 | is(s[1], -1, "no opener or closer returns -1 for closer."); 89 | 90 | s = "aX11/MIT License 8 | * (See the accompanying README file for full details.) 9 | */ 10 | 11 | /** 12 | Yet another unit testing tool for JavaScript. 13 | @author Michael Mathews micmath@gmail.com 14 | @param {object} testCases Properties are testcase names, values are functions to execute as tests. 15 | */ 16 | function testrun(testCases) { 17 | var ran = 0; 18 | for (t in testCases) { 19 | var result = testCases[t](); 20 | ran++; 21 | } 22 | 23 | return testrun.reportOut+"-------------------------------\n"+((testrun.fails>0)? ":( Failed "+testrun.fails+"/" : ":) Passed all ")+testrun.count+" test"+((testrun.count == 1)? "":"s")+".\n"; 24 | } 25 | 26 | 27 | testrun.count = 0; 28 | testrun.current = null; 29 | testrun.passes = 0; 30 | testrun.fails = 0; 31 | testrun.reportOut = ""; 32 | 33 | /** @private */ 34 | testrun.report = function(text) { 35 | testrun.reportOut += text+"\n"; 36 | } 37 | 38 | /** 39 | Check if test evaluates to true. 40 | @param {string} test To be evaluated. 41 | @param {string} message Optional. To be displayed in the report. 42 | @return {boolean} True if the string test evaluates to true. 43 | */ 44 | ok = function(test, message) { 45 | testrun.count++; 46 | 47 | var result; 48 | try { 49 | result = eval(test); 50 | 51 | if (result) { 52 | testrun.passes++; 53 | testrun.report(" OK "+testrun.count+" - "+((message != null)? message : "")); 54 | } 55 | else { 56 | testrun.fails++; 57 | testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); 58 | } 59 | } 60 | catch(e) { 61 | testrun.fails++ 62 | testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); 63 | 64 | } 65 | } 66 | 67 | /** 68 | Check if test is same as expected. 69 | @param {string} test To be evaluated. 70 | @param {string} expected 71 | @param {string} message Optional. To be displayed in the report. 72 | @return {boolean} True if (test == expected). Note that the comparison is not a strict equality check. 73 | */ 74 | is = function(test, expected, message) { 75 | testrun.count++; 76 | 77 | var result; 78 | try { 79 | result = eval(test); 80 | 81 | if (result == expected) { 82 | testrun.passes++ 83 | testrun.report(" OK "+testrun.count+" - "+((message != null)? message : "")); 84 | } 85 | else { 86 | testrun.fails++ 87 | testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); 88 | testrun.report("expected: "+expected); 89 | testrun.report(" got: "+result); 90 | } 91 | } 92 | catch(e) { 93 | testrun.fails++ 94 | testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); 95 | testrun.report("expected: "+expected); 96 | testrun.report(" got: "+result);} 97 | } 98 | 99 | /** 100 | Check if test matches pattern. 101 | @param {string} test To be evaluated. 102 | @param {string} pattern Used to create a RegExp. 103 | @param {string} message Optional. To be displayed in the report. 104 | @return {boolean} True if test matches pattern. 105 | */ 106 | like = function(test, pattern, message) { 107 | testrun.count++; 108 | 109 | var result; 110 | try { 111 | result = eval(test); 112 | var rgx = new RegExp(pattern); 113 | 114 | if (rgx.test(result)) { 115 | testrun.passes++ 116 | testrun.report(" OK "+testrun.count+" - "+((message != null)? message : "")); 117 | } 118 | else { 119 | testrun.fails++ 120 | testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); 121 | testrun.report(" this: "+result); 122 | testrun.report("is not like: "+pattern); 123 | } 124 | } 125 | catch(e) { 126 | testrun.fails++ 127 | testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); 128 | } 129 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/handlers/FOODOC.js: -------------------------------------------------------------------------------- 1 | /** 2 | This is the main container for the FOODOC handler. 3 | @namespace 4 | */ 5 | FOODOC = { 6 | }; 7 | 8 | /** The current version string of this application. */ 9 | FOODOC.VERSION = "1.0"; 10 | 11 | FOODOC.handle = function(srcFile, src) { 12 | LOG.inform("Handling file '" + srcFile + "'"); 13 | 14 | return [ 15 | new JSDOC.Symbol( 16 | "foo", 17 | [], 18 | "VIRTUAL", 19 | new JSDOC.DocComment("/** This is a foo. */") 20 | ) 21 | ]; 22 | }; 23 | 24 | FOODOC.publish = function(symbolgroup) { 25 | LOG.inform("Publishing symbolgroup."); 26 | }; 27 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/handlers/XMLDOC.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the main container for the XMLDOC handler. 3 | * @namespace 4 | * @author Brett Fattori (bfattori@fry.com) 5 | * @version $Revision: 498 $ 6 | */ 7 | XMLDOC = { 8 | 9 | }; 10 | 11 | /** The current version string of this application. */ 12 | XMLDOC.VERSION = "1.0"; 13 | 14 | /** Include the library necessary to handle XML files */ 15 | IO.includeDir("handlers/XMLDOC/"); 16 | 17 | /** 18 | * @type Symbol[] 19 | */ 20 | XMLDOC.handle = function(srcFile, src) { 21 | 22 | }; 23 | 24 | XMLDOC.publish = function(symbolgroup) { 25 | 26 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js: -------------------------------------------------------------------------------- 1 | LOG.inform("XMLDOC.DomReader loaded"); 2 | 3 | XMLDOC.DomReader = function(root) { 4 | 5 | this.dom = root; 6 | 7 | /** 8 | * The current node the reader is on 9 | */ 10 | this.node = root; 11 | 12 | /** 13 | * Get the current node the reader is on 14 | * @type XMLDOC.Parser.node 15 | */ 16 | XMLDOC.DomReader.prototype.getNode = function() { 17 | return this.node; 18 | }; 19 | 20 | /** 21 | * Set the node the reader should be positioned on. 22 | * @param node {XMLDOC.Parser.node} 23 | */ 24 | XMLDOC.DomReader.prototype.setNode = function(node) { 25 | this.node = node; 26 | }; 27 | 28 | /** 29 | * A helper method to make sure the current node will 30 | * never return null, unless null is passed as the root. 31 | * @param step {String} An expression to evaluate - should return a node or null 32 | */ 33 | XMLDOC.DomReader.prototype.navigate = function(step) { 34 | var n; 35 | if ((n = step) != null) 36 | { 37 | this.node = n; 38 | return this.node; 39 | } 40 | return null; 41 | }; 42 | 43 | /** 44 | * Get the root node of the current node's document. 45 | */ 46 | XMLDOC.DomReader.prototype.root = function() { 47 | this.navigate(this.dom); 48 | }; 49 | 50 | /** 51 | * Get the parent of the current node. 52 | */ 53 | XMLDOC.DomReader.prototype.parent = function() { 54 | return this.navigate(this.node.parentNode()); 55 | }; 56 | 57 | /** 58 | * Get the first child of the current node. 59 | */ 60 | XMLDOC.DomReader.prototype.firstChild = function() { 61 | return this.navigate(this.node.firstChild()); 62 | }; 63 | 64 | /** 65 | * Get the last child of the current node. 66 | */ 67 | XMLDOC.DomReader.prototype.lastChild = function() { 68 | return this.navigate(this.node.lastChild()); 69 | }; 70 | 71 | /** 72 | * Get the next sibling of the current node. 73 | */ 74 | XMLDOC.DomReader.prototype.nextSibling = function() { 75 | return this.navigate(this.node.nextSibling()); 76 | }; 77 | 78 | /** 79 | * Get the previous sibling of the current node. 80 | */ 81 | XMLDOC.DomReader.prototype.prevSibling = function() { 82 | return this.navigate(this.node.prevSibling()); 83 | }; 84 | 85 | //=============================================================================================== 86 | // Support methods 87 | 88 | /** 89 | * Walk the tree starting with the current node, calling the plug-in for 90 | * each node visited. Each time the plug-in is called, the DomReader 91 | * is passed as the only parameter. Use the {@link XMLDOC.DomReader#getNode} method 92 | * to access the current node. This method uses a depth first traversal pattern. 93 | * 94 | * @param srcFile {String} The source file being evaluated 95 | */ 96 | XMLDOC.DomReader.prototype.getSymbols = function(srcFile) 97 | { 98 | XMLDOC.DomReader.symbols = []; 99 | XMLDOC.DomReader.currentFile = srcFile; 100 | JSDOC.Symbol.srcFile = (srcFile || ""); 101 | 102 | if (defined(JSDOC.PluginManager)) { 103 | JSDOC.PluginManager.run("onDomGetSymbols", this); 104 | } 105 | 106 | return XMLDOC.DomReader.symbols; 107 | }; 108 | 109 | /** 110 | * Find the node with the given name using a depth first traversal. 111 | * Does not modify the DomReader's current node. 112 | * 113 | * @param name {String} The name of the node to find 114 | * @return the node that was found, or null if not found 115 | */ 116 | XMLDOC.DomReader.prototype.findNode = function(name) 117 | { 118 | var findNode = null; 119 | 120 | // Start at the current node and move into the subtree, 121 | // looking for the node with the given name 122 | function deeper(node, find) 123 | { 124 | var look = null; 125 | 126 | if (node) { 127 | if (node.name == find) 128 | { 129 | return node; 130 | } 131 | 132 | if (node.firstChild()) 133 | { 134 | look = deeper(node.firstChild(), find); 135 | } 136 | 137 | if (!look && node.nextSibling()) 138 | { 139 | look = deeper(node.nextSibling(), find); 140 | } 141 | } 142 | 143 | return look; 144 | } 145 | 146 | return deeper(this.getNode().firstChild(), name); 147 | }; 148 | 149 | /** 150 | * Find the next node with the given name using a depth first traversal. 151 | * 152 | * @param name {String} The name of the node to find 153 | */ 154 | XMLDOC.DomReader.prototype.findPreviousNode = function(name) 155 | { 156 | }; 157 | 158 | }; 159 | 160 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js: -------------------------------------------------------------------------------- 1 | LOG.inform("XMLDOC.symbolize loaded"); 2 | 3 | /** 4 | * Convert the source file to a set of symbols 5 | */ 6 | XMLDOC.symbolize = function(srcFile, src) { 7 | 8 | LOG.inform("Symbolizing file '" + srcFile + "'"); 9 | 10 | // XML files already have a defined structure, so we don't need to 11 | // do anything but parse them. The DOM reader can create a symbol 12 | // table from the parsed XML. 13 | var dr = new XMLDOC.DomReader(XMLDOC.Parser.parse(src)); 14 | return dr.getSymbols(srcFile); 15 | 16 | }; 17 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC.js: -------------------------------------------------------------------------------- 1 | /** 2 | @overview 3 | @date $Date: 2010-06-13 22:02:44 +0100 (Sun, 13 Jun 2010) $ 4 | @version $Revision: 837 $ 5 | @location $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-2.4.0/jsdoc-toolkit/app/lib/JSDOC.js $ 6 | @name JSDOC.js 7 | */ 8 | 9 | /** 10 | This is the main container for the JSDOC application. 11 | @namespace 12 | */ 13 | JSDOC = { 14 | }; 15 | 16 | /** 17 | @requires Opt 18 | */ 19 | if (typeof arguments == "undefined") arguments = []; 20 | JSDOC.opt = Opt.get( 21 | arguments, 22 | { 23 | a: "allfunctions", 24 | c: "conf", 25 | d: "directory", 26 | "D[]": "define", 27 | e: "encoding", 28 | "E[]": "exclude", 29 | h: "help", 30 | m: "multiple", 31 | n: "nocode", 32 | o: "out", 33 | p: "private", 34 | q: "quiet", 35 | r: "recurse", 36 | S: "securemodules", 37 | s: "suppress", 38 | t: "template", 39 | T: "testmode", 40 | u: "unique", 41 | v: "verbose", 42 | x: "ext" 43 | } 44 | ); 45 | 46 | /** The current version string of this application. */ 47 | JSDOC.VERSION = "2.4.0"; 48 | 49 | /** Print out usage information and quit. */ 50 | JSDOC.usage = function() { 51 | print("USAGE: java -jar jsrun.jar app/run.js [OPTIONS] ..."); 52 | print(""); 53 | print("OPTIONS:"); 54 | print(" -a or --allfunctions\n Include all functions, even undocumented ones.\n"); 55 | print(" -c or --conf\n Load a configuration file.\n"); 56 | print(" -d= or --directory=\n Output to this directory (defaults to \"out\").\n"); 57 | print(" -D=\"myVar:My value\" or --define=\"myVar:My value\"\n Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.myVar.\n"); 58 | print(" -e= or --encoding=\n Use this encoding to read and write files.\n"); 59 | print(" -E=\"REGEX\" or --exclude=\"REGEX\"\n Multiple. Exclude files based on the supplied regex.\n"); 60 | print(" -h or --help\n Show this message and exit.\n"); 61 | print(" -m or --multiples\n Don't warn about symbols being documented more than once.\n"); 62 | print(" -n or --nocode\n Ignore all code, only document comments with @name tags.\n"); 63 | print(" -o= or --out=\n Print log messages to a file (defaults to stdout).\n"); 64 | print(" -p or --private\n Include symbols tagged as private, underscored and inner symbols.\n"); 65 | print(" -q or --quiet\n Do not output any messages, not even warnings.\n"); 66 | print(" -r= or --recurse=\n Descend into src directories.\n"); 67 | print(" -s or --suppress\n Suppress source code output.\n"); 68 | print(" -S or --securemodules\n Use Secure Modules mode to parse source code.\n"); 69 | print(" -t= or --template=\n Required. Use this template to format the output.\n"); 70 | print(" -T or --test\n Run all unit tests and exit.\n"); 71 | print(" -u or --unique\n Force file names to be unique, but not based on symbol names.\n"); 72 | print(" -v or --verbose\n Provide verbose feedback about what is happening.\n"); 73 | print(" -x=[,EXT]... or --ext=[,EXT]...\n Scan source files with the given extension/s (defaults to js).\n"); 74 | 75 | quit(); 76 | } 77 | 78 | /*t: 79 | plan(4, "Testing JSDOC namespace."); 80 | 81 | is( 82 | typeof JSDOC, 83 | "object", 84 | "JSDOC.usage is a function." 85 | ); 86 | 87 | is( 88 | typeof JSDOC.VERSION, 89 | "string", 90 | "JSDOC.VERSION is a string." 91 | ); 92 | 93 | is( 94 | typeof JSDOC.usage, 95 | "function", 96 | "JSDOC.usage is a function." 97 | ); 98 | 99 | is( 100 | typeof JSDOC.opt, 101 | "object", 102 | "JSDOC.opt is a object." 103 | ); 104 | */ 105 | 106 | if (this.IO) IO.includeDir("lib/JSDOC/"); 107 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/DocComment.js: -------------------------------------------------------------------------------- 1 | if (typeof JSDOC == "undefined") JSDOC = {}; 2 | 3 | /** 4 | Create a new DocComment. This takes a raw documentation comment, 5 | and wraps it in useful accessors. 6 | @class Represents a documentation comment object. 7 | */ 8 | JSDOC.DocComment = function(/**String*/comment) { 9 | this.init(); 10 | if (typeof comment != "undefined") { 11 | this.parse(comment); 12 | } 13 | } 14 | 15 | JSDOC.DocComment.prototype.init = function() { 16 | this.isUserComment = true; 17 | this.src = ""; 18 | this.meta = ""; 19 | this.tagTexts = []; 20 | this.tags = []; 21 | } 22 | 23 | /** 24 | @requires JSDOC.DocTag 25 | */ 26 | JSDOC.DocComment.prototype.parse = function(/**String*/comment) { 27 | if (comment == "") { 28 | comment = "/** @desc */"; 29 | this.isUserComment = false; 30 | } 31 | 32 | this.src = JSDOC.DocComment.unwrapComment(comment); 33 | 34 | this.meta = ""; 35 | if (this.src.indexOf("#") == 0) { 36 | this.src.match(/#(.+[+-])([\s\S]*)$/); 37 | if (RegExp.$1) this.meta = RegExp.$1; 38 | if (RegExp.$2) this.src = RegExp.$2; 39 | } 40 | 41 | if (typeof JSDOC.PluginManager != "undefined") { 42 | JSDOC.PluginManager.run("onDocCommentSrc", this); 43 | } 44 | 45 | this.fixDesc(); 46 | 47 | this.src = JSDOC.DocComment.shared+"\n"+this.src; 48 | 49 | this.tagTexts = 50 | this.src 51 | .split(/(^|[\r\n])\s*@/) 52 | .filter(function($){return $.match(/\S/)}); 53 | 54 | /** 55 | The tags found in the comment. 56 | @type JSDOC.DocTag[] 57 | */ 58 | this.tags = this.tagTexts.map(function($){return new JSDOC.DocTag($)}); 59 | 60 | if (typeof JSDOC.PluginManager != "undefined") { 61 | JSDOC.PluginManager.run("onDocCommentTags", this); 62 | } 63 | } 64 | 65 | /*t: 66 | plan(5, "testing JSDOC.DocComment"); 67 | requires("../frame/String.js"); 68 | requires("../lib/JSDOC/DocTag.js"); 69 | 70 | var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/"); 71 | is(com.tagTexts[0], "foo some\ncomment here", "first tag text is found."); 72 | is(com.tags[0].title, "foo", "the title is found in a comment with one tag."); 73 | 74 | var com = new JSDOC.DocComment("/** @foo first\n* @bar second*"+"/"); 75 | is(com.getTag("bar").length, 1, "getTag() returns one tag by that title."); 76 | 77 | JSDOC.DocComment.shared = "@author John Smith"; 78 | var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/"); 79 | is(com.tags[0].title, "author", "shared comment is added."); 80 | is(com.tags[1].title, "foo", "shared comment is added to existing tag."); 81 | */ 82 | 83 | /** 84 | If no @desc tag is provided, this function will add it. 85 | */ 86 | JSDOC.DocComment.prototype.fixDesc = function() { 87 | if (this.meta && this.meta != "@+") return; 88 | if (/^\s*[^@\s]/.test(this.src)) { 89 | this.src = "@desc "+this.src; 90 | } 91 | } 92 | 93 | /*t: 94 | plan(5, "testing JSDOC.DocComment#fixDesc"); 95 | 96 | var com = new JSDOC.DocComment(); 97 | 98 | com.src = "this is a desc\n@author foo"; 99 | com.fixDesc(); 100 | is(com.src, "@desc this is a desc\n@author foo", "if no @desc tag is provided one is added."); 101 | 102 | com.src = "x"; 103 | com.fixDesc(); 104 | is(com.src, "@desc x", "if no @desc tag is provided one is added to a single character."); 105 | 106 | com.src = "\nx"; 107 | com.fixDesc(); 108 | is(com.src, "@desc \nx", "if no @desc tag is provided one is added to return and character."); 109 | 110 | com.src = " "; 111 | com.fixDesc(); 112 | is(com.src, " ", "if no @desc tag is provided one is not added to just whitespace."); 113 | 114 | com.src = ""; 115 | com.fixDesc(); 116 | is(com.src, "", "if no @desc tag is provided one is not added to empty."); 117 | */ 118 | 119 | /** 120 | Remove slash-star comment wrapper from a raw comment string. 121 | @type String 122 | */ 123 | JSDOC.DocComment.unwrapComment = function(/**String*/comment) { 124 | if (!comment) return ""; 125 | var unwrapped = comment.replace(/(^\/\*\*|\*\/$)/g, "").replace(/^\s*\* ?/gm, ""); 126 | return unwrapped; 127 | } 128 | 129 | /*t: 130 | plan(5, "testing JSDOC.DocComment.unwrapComment"); 131 | 132 | var com = "/**x*"+"/"; 133 | var unwrapped = JSDOC.DocComment.unwrapComment(com); 134 | is(unwrapped, "x", "a single character jsdoc is found."); 135 | 136 | com = "/***x*"+"/"; 137 | unwrapped = JSDOC.DocComment.unwrapComment(com); 138 | is(unwrapped, "x", "three stars are allowed in the opener."); 139 | 140 | com = "/****x*"+"/"; 141 | unwrapped = JSDOC.DocComment.unwrapComment(com); 142 | is(unwrapped, "*x", "fourth star in the opener is kept."); 143 | 144 | com = "/**x\n * y\n*"+"/"; 145 | unwrapped = JSDOC.DocComment.unwrapComment(com); 146 | is(unwrapped, "x\ny\n", "leading stars and spaces are trimmed."); 147 | 148 | com = "/**x\n * y\n*"+"/"; 149 | unwrapped = JSDOC.DocComment.unwrapComment(com); 150 | is(unwrapped, "x\n y\n", "only first space after leading stars are trimmed."); 151 | */ 152 | 153 | /** 154 | Provides a printable version of the comment. 155 | @type String 156 | */ 157 | JSDOC.DocComment.prototype.toString = function() { 158 | return this.src; 159 | } 160 | 161 | /*t: 162 | plan(1, "testing JSDOC.DocComment#fixDesc"); 163 | var com = new JSDOC.DocComment(); 164 | com.src = "foo"; 165 | is(""+com, "foo", "stringifying a comment returns the unwrapped src."); 166 | */ 167 | 168 | /** 169 | Given the title of a tag, returns all tags that have that title. 170 | @type JSDOC.DocTag[] 171 | */ 172 | JSDOC.DocComment.prototype.getTag = function(/**String*/tagTitle) { 173 | return this.tags.filter(function($){return $.title == tagTitle}); 174 | } 175 | 176 | JSDOC.DocComment.prototype.deleteTag = function(/**String*/tagTitle) { 177 | this.tags = this.tags.filter(function($){return $.title != tagTitle}) 178 | } 179 | 180 | /*t: 181 | plan(1, "testing JSDOC.DocComment#getTag"); 182 | requires("../frame/String.js"); 183 | requires("../lib/JSDOC/DocTag.js"); 184 | 185 | var com = new JSDOC.DocComment("/**@foo some\n* @bar\n* @bar*"+"/"); 186 | is(com.getTag("bar").length, 2, "getTag returns expected number of tags."); 187 | */ 188 | 189 | /** 190 | Used to store the currently shared tag text. 191 | */ 192 | JSDOC.DocComment.shared = ""; 193 | 194 | /*t: 195 | plan(2, "testing JSDOC.DocComment.shared"); 196 | requires("../frame/String.js"); 197 | requires("../lib/JSDOC/DocTag.js"); 198 | 199 | JSDOC.DocComment.shared = "@author Michael"; 200 | 201 | var com = new JSDOC.DocComment("/**@foo\n* @foo*"+"/"); 202 | is(com.getTag("author").length, 1, "getTag returns shared tag."); 203 | is(com.getTag("foo").length, 2, "getTag returns unshared tags too."); 204 | */ -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js: -------------------------------------------------------------------------------- 1 | /** 2 | @constructor 3 | @param [opt] Used to override the commandline options. Useful for testing. 4 | @version $Id: JsDoc.js 831 2010-03-09 14:24:56Z micmath $ 5 | */ 6 | JSDOC.JsDoc = function(/**object*/ opt) { 7 | if (opt) { 8 | JSDOC.opt = opt; 9 | } 10 | 11 | if (JSDOC.opt.h) { 12 | JSDOC.usage(); 13 | quit(); 14 | } 15 | 16 | // defend against options that are not sane 17 | if (JSDOC.opt._.length == 0) { 18 | LOG.warn("No source files to work on. Nothing to do."); 19 | quit(); 20 | } 21 | if (JSDOC.opt.t === true || JSDOC.opt.d === true) { 22 | JSDOC.usage(); 23 | } 24 | 25 | if (typeof JSDOC.opt.d == "string") { 26 | if (!JSDOC.opt.d.charAt(JSDOC.opt.d.length-1).match(/[\\\/]/)) { 27 | JSDOC.opt.d = JSDOC.opt.d+"/"; 28 | } 29 | LOG.inform("Output directory set to '"+JSDOC.opt.d+"'."); 30 | IO.mkPath(JSDOC.opt.d); 31 | } 32 | if (JSDOC.opt.e) IO.setEncoding(JSDOC.opt.e); 33 | 34 | // the -r option: scan source directories recursively 35 | if (typeof JSDOC.opt.r == "boolean") JSDOC.opt.r = 10; 36 | else if (!isNaN(parseInt(JSDOC.opt.r))) JSDOC.opt.r = parseInt(JSDOC.opt.r); 37 | else JSDOC.opt.r = 1; 38 | 39 | // the -D option: define user variables 40 | var D = {}; 41 | if (JSDOC.opt.D) { 42 | for (var i = 0; i < JSDOC.opt.D.length; i++) { 43 | var param = JSDOC.opt.D[i]; 44 | // remove first and last character if both == " 45 | if ( 46 | param.length > 1 47 | && param.charAt(0) == '"' 48 | && param.charAt(param.length-1) == '"' 49 | ) { 50 | param = param.substr(1, param.length-2); 51 | } 52 | var defineParts = param.split(":"); 53 | if (defineParts && defineParts.length > 1) { 54 | for ( var dpIdx = 2; dpIdx < defineParts.length; dpIdx++ ) { 55 | defineParts[1] += ':' + defineParts[dpIdx]; 56 | } 57 | D[defineParts[0]] = defineParts[1]; 58 | } 59 | } 60 | } 61 | JSDOC.opt.D = D; 62 | // combine any conf file D options with the commandline D options 63 | if (defined(JSDOC.conf)) for (var c in JSDOC.conf.D) { 64 | if (!defined(JSDOC.opt.D[c])) { 65 | JSDOC.opt.D[c] = JSDOC.conf.D[c]; 66 | } 67 | } 68 | 69 | // Give plugins a chance to initialize 70 | if (defined(JSDOC.PluginManager)) { 71 | JSDOC.PluginManager.run("onInit", JSDOC.opt); 72 | } 73 | 74 | JSDOC.opt.srcFiles = JSDOC.JsDoc._getSrcFiles(); 75 | JSDOC.JsDoc._parseSrcFiles(); 76 | JSDOC.JsDoc.symbolSet = JSDOC.Parser.symbols; 77 | } 78 | 79 | /** 80 | Retrieve source file list. 81 | @returns {String[]} The pathnames of the files to be parsed. 82 | */ 83 | JSDOC.JsDoc._getSrcFiles = function() { 84 | JSDOC.JsDoc.srcFiles = []; 85 | 86 | var ext = ["js"]; 87 | if (JSDOC.opt.x) { 88 | ext = JSDOC.opt.x.split(",").map(function($) {return $.toLowerCase()}); 89 | } 90 | 91 | for (var i = 0; i < JSDOC.opt._.length; i++) { 92 | JSDOC.JsDoc.srcFiles = JSDOC.JsDoc.srcFiles.concat( 93 | IO.ls(JSDOC.opt._[i], JSDOC.opt.r).filter( 94 | function($) { 95 | var thisExt = $.split(".").pop().toLowerCase(); 96 | 97 | if (JSDOC.opt.E) { 98 | for(var n = 0; n < JSDOC.opt.E.length; n++) { 99 | if ($.match(new RegExp(JSDOC.opt.E[n]))) { 100 | LOG.inform("Excluding " + $); 101 | return false; // if the file matches the regex then it's excluded. 102 | } 103 | } 104 | } 105 | 106 | return (ext.indexOf(thisExt) > -1); // we're only interested in files with certain extensions 107 | } 108 | ) 109 | ); 110 | } 111 | 112 | return JSDOC.JsDoc.srcFiles; 113 | } 114 | 115 | JSDOC.JsDoc._parseSrcFiles = function() { 116 | JSDOC.Parser.init(); 117 | for (var i = 0, l = JSDOC.JsDoc.srcFiles.length; i < l; i++) { 118 | var srcFile = JSDOC.JsDoc.srcFiles[i]; 119 | 120 | if (JSDOC.opt.v) LOG.inform("Parsing file: " + srcFile); 121 | 122 | try { 123 | var src = IO.readFile(srcFile); 124 | } 125 | catch(e) { 126 | LOG.warn("Can't read source file '"+srcFile+"': "+e.message); 127 | } 128 | 129 | var tr = new JSDOC.TokenReader(); 130 | var ts = new JSDOC.TokenStream(tr.tokenize(new JSDOC.TextStream(src))); 131 | 132 | JSDOC.Parser.parse(ts, srcFile); 133 | 134 | } 135 | JSDOC.Parser.finish(); 136 | 137 | if (JSDOC.PluginManager) { 138 | JSDOC.PluginManager.run("onFinishedParsing", JSDOC.Parser.symbols); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js: -------------------------------------------------------------------------------- 1 | /** 2 | @constructor 3 | */ 4 | JSDOC.JsPlate = function(templateFile) { 5 | if (templateFile) this.template = IO.readFile(templateFile); 6 | 7 | this.templateFile = templateFile; 8 | this.code = ""; 9 | this.parse(); 10 | } 11 | 12 | JSDOC.JsPlate.prototype.parse = function() { 13 | this.template = this.template.replace(/\{#[\s\S]+?#\}/gi, ""); 14 | this.code = "var output=\u001e"+this.template; 15 | 16 | this.code = this.code.replace( 17 | //gi, 18 | function (match, eachName, inName) { 19 | return "\u001e;\rvar $"+eachName+"_keys = keys("+inName+");\rfor(var $"+eachName+"_i = 0; $"+eachName+"_i < $"+eachName+"_keys.length; $"+eachName+"_i++) {\rvar $"+eachName+"_last = ($"+eachName+"_i == $"+eachName+"_keys.length-1);\rvar $"+eachName+"_key = $"+eachName+"_keys[$"+eachName+"_i];\rvar "+eachName+" = "+inName+"[$"+eachName+"_key];\routput+=\u001e"; 20 | } 21 | ); 22 | this.code = this.code.replace(//g, "\u001e;\rif ($1) { output+=\u001e"); 23 | this.code = this.code.replace(//g, "\u001e;}\relse if ($1) { output+=\u001e"); 24 | this.code = this.code.replace(//g, "\u001e;}\relse { output+=\u001e"); 25 | this.code = this.code.replace(/<\/(if|for)>/g, "\u001e;\r};\routput+=\u001e"); 26 | this.code = this.code.replace( 27 | /\{\+\s*([\s\S]+?)\s*\+\}/gi, 28 | function (match, code) { 29 | code = code.replace(/"/g, "\u001e"); // prevent qoute-escaping of inline code 30 | code = code.replace(/(\r?\n)/g, " "); 31 | return "\u001e+ ("+code+") +\u001e"; 32 | } 33 | ); 34 | this.code = this.code.replace( 35 | /\{!\s*([\s\S]+?)\s*!\}/gi, 36 | function (match, code) { 37 | code = code.replace(/"/g, "\u001e"); // prevent qoute-escaping of inline code 38 | code = code.replace(/(\n)/g, " "); 39 | return "\u001e; "+code+";\routput+=\u001e"; 40 | } 41 | ); 42 | this.code = this.code+"\u001e;"; 43 | 44 | this.code = this.code.replace(/(\r?\n)/g, "\\n"); 45 | this.code = this.code.replace(/"/g, "\\\""); 46 | this.code = this.code.replace(/\u001e/g, "\""); 47 | } 48 | 49 | JSDOC.JsPlate.prototype.toCode = function() { 50 | return this.code; 51 | } 52 | 53 | JSDOC.JsPlate.keys = function(obj) { 54 | var keys = []; 55 | if (obj.constructor.toString().indexOf("Array") > -1) { 56 | for (var i = 0; i < obj.length; i++) { 57 | keys.push(i); 58 | } 59 | } 60 | else { 61 | for (var i in obj) { 62 | keys.push(i); 63 | } 64 | } 65 | return keys; 66 | }; 67 | 68 | JSDOC.JsPlate.values = function(obj) { 69 | var values = []; 70 | if (obj.constructor.toString().indexOf("Array") > -1) { 71 | for (var i = 0; i < obj.length; i++) { 72 | values.push(obj[i]); 73 | } 74 | } 75 | else { 76 | for (var i in obj) { 77 | values.push(obj[i]); 78 | } 79 | } 80 | return values; 81 | }; 82 | 83 | JSDOC.JsPlate.prototype.process = function(data, compact) { 84 | var keys = JSDOC.JsPlate.keys; 85 | var values = JSDOC.JsPlate.values; 86 | 87 | try { 88 | eval(this.code); 89 | } 90 | catch (e) { 91 | print(">> There was an error evaluating the compiled code from template: "+this.templateFile); 92 | print(" The error was on line "+e.lineNumber+" "+e.name+": "+e.message); 93 | var lines = this.code.split("\r"); 94 | if (e.lineNumber-2 >= 0) print("line "+(e.lineNumber-1)+": "+lines[e.lineNumber-2]); 95 | print("line "+e.lineNumber+": "+lines[e.lineNumber-1]); 96 | print(""); 97 | } 98 | 99 | if (compact) { // patch by mcbain.asm 100 | // Remove lines that contain only space-characters, usually left by lines in the template 101 | // which originally only contained JSPlate tags or code. This makes it easier to write 102 | // non-tricky templates which still put out nice code (not bloated with extra lines). 103 | // Lines purposely left blank (just a line ending) are left alone. 104 | output = output.replace(/\s+?(\r?)\n/g, "$1\n"); 105 | } 106 | 107 | /*debug*///print(this.code); 108 | return output; 109 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/Lang.js: -------------------------------------------------------------------------------- 1 | /** 2 | @namespace 3 | */ 4 | JSDOC.Lang = { 5 | } 6 | 7 | JSDOC.Lang.isBuiltin = function(name) { 8 | return (JSDOC.Lang.isBuiltin.coreObjects.indexOf(name) > -1); 9 | } 10 | JSDOC.Lang.isBuiltin.coreObjects = ['_global_', 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String']; 11 | 12 | JSDOC.Lang.whitespace = function(ch) { 13 | return JSDOC.Lang.whitespace.names[ch]; 14 | } 15 | JSDOC.Lang.whitespace.names = { 16 | " ": "SPACE", 17 | "\f": "FORMFEED", 18 | "\t": "TAB", 19 | "\u0009": "UNICODE_TAB", 20 | "\u000A": "UNICODE_NBR", 21 | "\u0008": "VERTICAL_TAB" 22 | }; 23 | 24 | JSDOC.Lang.newline = function(ch) { 25 | return JSDOC.Lang.newline.names[ch]; 26 | } 27 | JSDOC.Lang.newline.names = { 28 | "\n": "NEWLINE", 29 | "\r": "RETURN", 30 | "\u000A": "UNICODE_LF", 31 | "\u000D": "UNICODE_CR", 32 | "\u2029": "UNICODE_PS", 33 | "\u2028": "UNICODE_LS" 34 | }; 35 | 36 | JSDOC.Lang.keyword = function(word) { 37 | return JSDOC.Lang.keyword.names["="+word]; 38 | } 39 | JSDOC.Lang.keyword.names = { 40 | "=break": "BREAK", 41 | "=case": "CASE", 42 | "=catch": "CATCH", 43 | "=const": "VAR", 44 | "=continue": "CONTINUE", 45 | "=default": "DEFAULT", 46 | "=delete": "DELETE", 47 | "=do": "DO", 48 | "=else": "ELSE", 49 | "=false": "FALSE", 50 | "=finally": "FINALLY", 51 | "=for": "FOR", 52 | "=function": "FUNCTION", 53 | "=if": "IF", 54 | "=in": "IN", 55 | "=instanceof": "INSTANCEOF", 56 | "=new": "NEW", 57 | "=null": "NULL", 58 | "=return": "RETURN", 59 | "=switch": "SWITCH", 60 | "=this": "THIS", 61 | "=throw": "THROW", 62 | "=true": "TRUE", 63 | "=try": "TRY", 64 | "=typeof": "TYPEOF", 65 | "=void": "VOID", 66 | "=while": "WHILE", 67 | "=with": "WITH", 68 | "=var": "VAR" 69 | }; 70 | 71 | JSDOC.Lang.punc = function(ch) { 72 | return JSDOC.Lang.punc.names[ch]; 73 | } 74 | JSDOC.Lang.punc.names = { 75 | ";": "SEMICOLON", 76 | ",": "COMMA", 77 | "?": "HOOK", 78 | ":": "COLON", 79 | "||": "OR", 80 | "&&": "AND", 81 | "|": "BITWISE_OR", 82 | "^": "BITWISE_XOR", 83 | "&": "BITWISE_AND", 84 | "===": "STRICT_EQ", 85 | "==": "EQ", 86 | "=": "ASSIGN", 87 | "!==": "STRICT_NE", 88 | "!=": "NE", 89 | "<<": "LSH", 90 | "<=": "LE", 91 | "<": "LT", 92 | ">>>": "URSH", 93 | ">>": "RSH", 94 | ">=": "GE", 95 | ">": "GT", 96 | "++": "INCREMENT", 97 | "--": "DECREMENT", 98 | "+": "PLUS", 99 | "-": "MINUS", 100 | "*": "MUL", 101 | "/": "DIV", 102 | "%": "MOD", 103 | "!": "NOT", 104 | "~": "BITWISE_NOT", 105 | ".": "DOT", 106 | "[": "LEFT_BRACKET", 107 | "]": "RIGHT_BRACKET", 108 | "{": "LEFT_CURLY", 109 | "}": "RIGHT_CURLY", 110 | "(": "LEFT_PAREN", 111 | ")": "RIGHT_PAREN" 112 | }; 113 | 114 | JSDOC.Lang.matching = function(name) { 115 | return JSDOC.Lang.matching.names[name]; 116 | } 117 | JSDOC.Lang.matching.names = { 118 | "LEFT_PAREN": "RIGHT_PAREN", 119 | "RIGHT_PAREN": "LEFT_PAREN", 120 | "LEFT_CURLY": "RIGHT_CURLY", 121 | "RIGHT_CURLY": "LEFT_CURLY", 122 | "LEFT_BRACE": "RIGHT_BRACE", 123 | "RIGHT_BRACE": "LEFT_BRACE" 124 | } 125 | 126 | JSDOC.Lang.isNumber = function(str) { 127 | return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str); 128 | } 129 | 130 | JSDOC.Lang.isHexDec = function(str) { 131 | return /^0x[0-9A-F]+$/i.test(str); 132 | } 133 | 134 | JSDOC.Lang.isWordChar = function(str) { 135 | return /^[a-zA-Z0-9$_.]+$/.test(str); 136 | } 137 | 138 | JSDOC.Lang.isSpace = function(str) { 139 | return (typeof JSDOC.Lang.whitespace(str) != "undefined"); 140 | } 141 | 142 | JSDOC.Lang.isNewline = function(str) { 143 | return (typeof JSDOC.Lang.newline(str) != "undefined"); 144 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/Parser.js: -------------------------------------------------------------------------------- 1 | if (typeof JSDOC == "undefined") JSDOC = {}; 2 | 3 | /** 4 | @namespace 5 | @requires JSDOC.Walker 6 | @requires JSDOC.Symbol 7 | @requires JSDOC.DocComment 8 | */ 9 | JSDOC.Parser = { 10 | conf: { 11 | ignoreCode: JSDOC.opt.n, 12 | ignoreAnonymous: true, // factory: true 13 | treatUnderscoredAsPrivate: true, // factory: true 14 | explain: false // factory: false 15 | }, 16 | 17 | addSymbol: function(symbol) { 18 | 19 | if (JSDOC.Parser.rename) { 20 | for (var n in JSDOC.Parser.rename) { 21 | if (symbol.alias.indexOf(n) == 0) { 22 | if (symbol.name == symbol.alias) { 23 | symbol.name = symbol.name.replace(n, JSDOC.Parser.rename[n]); 24 | } 25 | symbol.alias = symbol.alias.replace(n, JSDOC.Parser.rename[n]); 26 | } 27 | } 28 | } 29 | 30 | if (JSDOC.opt.S) { 31 | if (typeof JSDOC.Parser.secureModules == "undefined") JSDOC.Parser.secureModules = {}; 32 | if (/^exports\./.test(symbol.alias)) { 33 | symbol.srcFile.match(/(^|[\\\/])([^\\\/]+)\.js/i); 34 | var fileNS = RegExp.$2; 35 | 36 | // need to create the namespace associated with this file first 37 | if (!JSDOC.Parser.secureModules[fileNS]) { 38 | JSDOC.Parser.secureModules[fileNS] = 1; 39 | var nsSymbol = new JSDOC.Symbol(fileNS, [], "GLOBAL", new JSDOC.DocComment("")); 40 | nsSymbol.isNamespace = true; 41 | nsSymbol.srcFile = ""; 42 | nsSymbol.isPrivate = false; 43 | nsSymbol.srcFile = symbol.srcFile; 44 | nsSymbol.desc = (JSDOC.Parser.symbols.getSymbol(symbol.srcFile) || {desc: ""}).desc; 45 | JSDOC.Parser.addSymbol(nsSymbol); 46 | } 47 | 48 | symbol.alias = symbol.alias.replace(/^exports\./, fileNS + '.'); 49 | symbol.name = symbol.name.replace(/^exports\./, ''); 50 | symbol.memberOf = fileNS; 51 | symbol.isStatic = true; 52 | } 53 | } 54 | 55 | // if a symbol alias is documented more than once the first one with the user docs wins 56 | if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) { 57 | var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias); 58 | if (oldSymbol.comment.isUserComment) { 59 | if (JSDOC.opt.m) return; 60 | if (symbol.comment.isUserComment) { // old and new are both documented 61 | LOG.warn("The symbol '"+symbol.alias+"' is documented more than once."); 62 | return; 63 | } 64 | else { // old is documented but new isn't 65 | return; 66 | } 67 | } 68 | } 69 | 70 | // we don't document anonymous things 71 | if (JSDOC.Parser.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return; 72 | 73 | // uderscored things may be treated as if they were marked private, this cascades 74 | if (JSDOC.Parser.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) { 75 | if (!symbol.comment.getTag("public").length > 0) symbol.isPrivate = true; 76 | } 77 | 78 | // -p flag is required to document private things 79 | if (!JSDOC.opt.p && symbol.isPrivate) return; // issue #161 fixed by mcbain.asm 80 | 81 | // ignored things are not documented, this doesn't cascade 82 | if (symbol.isIgnored) return; 83 | JSDOC.Parser.symbols.addSymbol(symbol); 84 | }, 85 | 86 | addBuiltin: function(name) { 87 | var builtin = new JSDOC.Symbol(name, [], "CONSTRUCTOR", new JSDOC.DocComment("")); 88 | builtin.isNamespace = true; 89 | builtin.srcFile = ""; 90 | builtin.isPrivate = false; 91 | JSDOC.Parser.addSymbol(builtin); 92 | return builtin; 93 | }, 94 | 95 | init: function() { 96 | JSDOC.Parser.symbols = new JSDOC.SymbolSet(); 97 | JSDOC.Parser.walker = new JSDOC.Walker(); 98 | }, 99 | 100 | finish: function() { 101 | JSDOC.Parser.symbols.relate(); 102 | 103 | // make a litle report about what was found 104 | if (JSDOC.Parser.conf.explain) { 105 | var symbols = JSDOC.Parser.symbols.toArray(); 106 | var srcFile = ""; 107 | for (var i = 0, l = symbols.length; i < l; i++) { 108 | var symbol = symbols[i]; 109 | if (srcFile != symbol.srcFile) { 110 | srcFile = symbol.srcFile; 111 | print("\n"+srcFile+"\n-------------------"); 112 | } 113 | print(i+":\n alias => "+symbol.alias + "\n name => "+symbol.name+ "\n isa => "+symbol.isa + "\n memberOf => " + symbol.memberOf + "\n isStatic => " + symbol.isStatic + ", isInner => " + symbol.isInner+ ", isPrivate => " + symbol.isPrivate); 114 | } 115 | print("-------------------\n"); 116 | } 117 | } 118 | } 119 | 120 | JSDOC.Parser.parse = function(/**JSDOC.TokenStream*/ts, /**String*/srcFile) { 121 | JSDOC.Symbol.srcFile = (srcFile || ""); 122 | JSDOC.DocComment.shared = ""; // shared comments don't cross file boundaries 123 | 124 | if (!JSDOC.Parser.walker) JSDOC.Parser.init(); 125 | JSDOC.Parser.walker.walk(ts); // adds to our symbols 126 | 127 | // filter symbols by option 128 | for (var p = JSDOC.Parser.symbols._index.first(); p; p = JSDOC.Parser.symbols._index.next()) { 129 | var symbol = p.value; 130 | 131 | if (!symbol) continue; 132 | 133 | if (symbol.is("FILE") || symbol.is("GLOBAL")) { 134 | continue; 135 | } 136 | else if (!JSDOC.opt.a && !symbol.comment.isUserComment) { 137 | JSDOC.Parser.symbols.deleteSymbol(symbol.alias); 138 | } 139 | 140 | if (/#$/.test(symbol.alias)) { // we don't document prototypes 141 | JSDOC.Parser.symbols.deleteSymbol(symbol.alias); 142 | } 143 | } 144 | 145 | return JSDOC.Parser.symbols.toArray(); 146 | } 147 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js: -------------------------------------------------------------------------------- 1 | /** 2 | @namespace Holds functionality related to running plugins. 3 | */ 4 | JSDOC.PluginManager = { 5 | } 6 | 7 | /** 8 | @param name A unique name that identifies that plugin. 9 | @param handlers A collection of named functions. The names correspond to hooks in the core code. 10 | */ 11 | JSDOC.PluginManager.registerPlugin = function(/**String*/name, /**Object*/handlers) { 12 | if (!defined(JSDOC.PluginManager.plugins)) 13 | /** The collection of all plugins. Requires a unique name for each. 14 | */ 15 | JSDOC.PluginManager.plugins = {}; 16 | 17 | 18 | JSDOC.PluginManager.plugins[name] = handlers; 19 | } 20 | 21 | /** 22 | @param hook The name of the hook that is being caught. 23 | @param target Any object. This will be passed as the only argument to the handler whose 24 | name matches the hook name. Handlers cannot return a value, so must modify the target 25 | object to have an effect. 26 | */ 27 | JSDOC.PluginManager.run = function(/**String*/hook, /**Mixed*/target) { 28 | for (var name in JSDOC.PluginManager.plugins) { 29 | if (defined(JSDOC.PluginManager.plugins[name][hook])) { 30 | JSDOC.PluginManager.plugins[name][hook](target); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/TextStream.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | @constructor 4 | */ 5 | JSDOC.TextStream = function(text) { 6 | if (typeof(text) == "undefined") text = ""; 7 | text = ""+text; 8 | this.text = text; 9 | this.cursor = 0; 10 | } 11 | 12 | JSDOC.TextStream.prototype.look = function(n) { 13 | if (typeof n == "undefined") n = 0; 14 | 15 | if (this.cursor+n < 0 || this.cursor+n >= this.text.length) { 16 | var result = new String(""); 17 | result.eof = true; 18 | return result; 19 | } 20 | return this.text.charAt(this.cursor+n); 21 | } 22 | 23 | JSDOC.TextStream.prototype.next = function(n) { 24 | if (typeof n == "undefined") n = 1; 25 | if (n < 1) return null; 26 | 27 | var pulled = ""; 28 | for (var i = 0; i < n; i++) { 29 | if (this.cursor+i < this.text.length) { 30 | pulled += this.text.charAt(this.cursor+i); 31 | } 32 | else { 33 | var result = new String(""); 34 | result.eof = true; 35 | return result; 36 | } 37 | } 38 | 39 | this.cursor += n; 40 | return pulled; 41 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/Token.js: -------------------------------------------------------------------------------- 1 | if (typeof JSDOC == "undefined") JSDOC = {}; 2 | 3 | /** 4 | @constructor 5 | */ 6 | JSDOC.Token = function(data, type, name) { 7 | this.data = data; 8 | this.type = type; 9 | this.name = name; 10 | } 11 | 12 | JSDOC.Token.prototype.toString = function() { 13 | return "<"+this.type+" name=\""+this.name+"\">"+this.data+""; 14 | } 15 | 16 | JSDOC.Token.prototype.is = function(what) { 17 | return this.name === what || this.type === what; 18 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js: -------------------------------------------------------------------------------- 1 | if (typeof JSDOC == "undefined") JSDOC = {}; 2 | 3 | /** 4 | @constructor 5 | */ 6 | JSDOC.TokenStream = function(tokens) { 7 | this.tokens = (tokens || []); 8 | this.rewind(); 9 | } 10 | 11 | /** 12 | @constructor 13 | @private 14 | */ 15 | function VoidToken(/**String*/type) { 16 | this.toString = function() {return ""}; 17 | this.is = function(){return false;} 18 | } 19 | 20 | JSDOC.TokenStream.prototype.rewind = function() { 21 | this.cursor = -1; 22 | } 23 | 24 | /** 25 | @type JSDOC.Token 26 | */ 27 | JSDOC.TokenStream.prototype.look = function(/**Number*/n, /**Boolean*/considerWhitespace) { 28 | if (typeof n == "undefined") n = 0; 29 | 30 | if (considerWhitespace == true) { 31 | if (this.cursor+n < 0 || this.cursor+n > this.tokens.length) return {}; 32 | return this.tokens[this.cursor+n]; 33 | } 34 | else { 35 | var count = 0; 36 | var i = this.cursor; 37 | 38 | while (true) { 39 | if (i < 0) return new JSDOC.Token("", "VOID", "START_OF_STREAM"); 40 | else if (i > this.tokens.length) return new JSDOC.Token("", "VOID", "END_OF_STREAM"); 41 | 42 | if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT"))) { 43 | if (n < 0) i--; else i++; 44 | continue; 45 | } 46 | 47 | if (count == Math.abs(n)) { 48 | return this.tokens[i]; 49 | } 50 | count++; 51 | (n < 0)? i-- : i++; 52 | } 53 | 54 | return new JSDOC.Token("", "VOID", "STREAM_ERROR"); // because null isn't an object and caller always expects an object 55 | } 56 | } 57 | 58 | /** 59 | @type JSDOC.Token|JSDOC.Token[] 60 | */ 61 | JSDOC.TokenStream.prototype.next = function(/**Number*/howMany) { 62 | if (typeof howMany == "undefined") howMany = 1; 63 | if (howMany < 1) return null; 64 | var got = []; 65 | 66 | for (var i = 1; i <= howMany; i++) { 67 | if (this.cursor+i >= this.tokens.length) { 68 | return null; 69 | } 70 | got.push(this.tokens[this.cursor+i]); 71 | } 72 | this.cursor += howMany; 73 | 74 | if (howMany == 1) { 75 | return got[0]; 76 | } 77 | else return got; 78 | } 79 | 80 | /** 81 | @type JSDOC.Token[] 82 | */ 83 | JSDOC.TokenStream.prototype.balance = function(/**String*/start, /**String*/stop) { 84 | if (!stop) stop = JSDOC.Lang.matching(start); 85 | 86 | var depth = 0; 87 | var got = []; 88 | var started = false; 89 | 90 | while ((token = this.look())) { 91 | if (token.is(start)) { 92 | depth++; 93 | started = true; 94 | } 95 | 96 | if (started) { 97 | got.push(token); 98 | } 99 | 100 | if (token.is(stop)) { 101 | depth--; 102 | if (depth == 0) return got; 103 | } 104 | if (!this.next()) break; 105 | } 106 | } 107 | 108 | JSDOC.TokenStream.prototype.getMatchingToken = function(/**String*/start, /**String*/stop) { 109 | var depth = 0; 110 | var cursor = this.cursor; 111 | 112 | if (!start) { 113 | start = JSDOC.Lang.matching(stop); 114 | depth = 1; 115 | } 116 | if (!stop) stop = JSDOC.Lang.matching(start); 117 | 118 | while ((token = this.tokens[cursor])) { 119 | if (token.is(start)) { 120 | depth++; 121 | } 122 | 123 | if (token.is(stop) && cursor) { 124 | depth--; 125 | if (depth == 0) return this.tokens[cursor]; 126 | } 127 | cursor++; 128 | } 129 | } 130 | 131 | JSDOC.TokenStream.prototype.insertAhead = function(/**JSDOC.Token*/token) { 132 | this.tokens.splice(this.cursor+1, 0, token); 133 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/lib/JSDOC/Util.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @namespace 3 | * @deprecated Use {@link FilePath} instead. 4 | */ 5 | JSDOC.Util = { 6 | } 7 | 8 | /** 9 | * @deprecated Use {@link FilePath.fileName} instead. 10 | */ 11 | JSDOC.Util.fileName = function(path) { 12 | LOG.warn("JSDOC.Util.fileName is deprecated. Use FilePath.fileName instead."); 13 | var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); 14 | return path.substring(nameStart); 15 | } 16 | 17 | /** 18 | * @deprecated Use {@link FilePath.fileExtension} instead. 19 | */ 20 | JSDOC.Util.fileExtension = function(filename) { 21 | LOG.warn("JSDOC.Util.fileExtension is deprecated. Use FilePath.fileExtension instead."); 22 | return filename.split(".").pop().toLowerCase(); 23 | }; 24 | 25 | /** 26 | * @deprecated Use {@link FilePath.dir} instead. 27 | */ 28 | JSDOC.Util.dir = function(path) { 29 | LOG.warn("JSDOC.Util.dir is deprecated. Use FilePath.dir instead."); 30 | var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); 31 | return path.substring(0, nameStart-1); 32 | } 33 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @version $Id: main.js 818 2009-11-08 14:51:41Z micmath $ 3 | */ 4 | 5 | function main() { 6 | IO.include("lib/JSDOC.js"); 7 | IO.includeDir("plugins/"); 8 | 9 | // process the options 10 | 11 | // the -c option: options are defined in a configuration file 12 | if (JSDOC.opt.c) { 13 | eval("JSDOC.conf = " + IO.readFile(JSDOC.opt.c)); 14 | 15 | LOG.inform("Using configuration file at '"+JSDOC.opt.c+"'."); 16 | 17 | for (var c in JSDOC.conf) { 18 | if (c !== "D" && !defined(JSDOC.opt[c])) { // commandline overrules config file 19 | JSDOC.opt[c] = JSDOC.conf[c]; 20 | } 21 | } 22 | 23 | if (typeof JSDOC.conf["_"] != "undefined") { 24 | JSDOC.opt["_"] = JSDOC.opt["_"].concat(JSDOC.conf["_"]); 25 | } 26 | 27 | LOG.inform("With configuration: "); 28 | for (var o in JSDOC.opt) { 29 | LOG.inform(" "+o+": "+JSDOC.opt[o]); 30 | } 31 | } 32 | 33 | // be verbose 34 | if (JSDOC.opt.v) LOG.verbose = true; 35 | 36 | // send log messages to a file 37 | if (JSDOC.opt.o) LOG.out = IO.open(JSDOC.opt.o); 38 | 39 | // run the unit tests 40 | if (JSDOC.opt.T) { 41 | LOG.inform("JsDoc Toolkit running in test mode at "+new Date()+"."); 42 | IO.include("frame/Testrun.js"); 43 | IO.include("test.js"); 44 | } 45 | else { 46 | // a template must be defined and must be a directory path 47 | if (!JSDOC.opt.t && System.getProperty("jsdoc.template.dir")) { 48 | JSDOC.opt.t = System.getProperty("jsdoc.template.dir"); 49 | } 50 | if (JSDOC.opt.t && SYS.slash != JSDOC.opt.t.slice(-1)) { 51 | JSDOC.opt.t += SYS.slash; 52 | } 53 | 54 | // verbose messages about the options we were given 55 | LOG.inform("JsDoc Toolkit main() running at "+new Date()+"."); 56 | LOG.inform("With options: "); 57 | for (var o in JSDOC.opt) { 58 | LOG.inform(" "+o+": "+JSDOC.opt[o]); 59 | } 60 | 61 | // initialize and build a symbolSet from your code 62 | JSDOC.JsDoc(); 63 | 64 | // debugger's option: dump the entire symbolSet produced from your code 65 | if (JSDOC.opt.Z) { 66 | LOG.warn("So you want to see the data structure, eh? This might hang if you have circular refs..."); 67 | IO.include("frame/Dumper.js"); 68 | var symbols = JSDOC.JsDoc.symbolSet.toArray(); 69 | for (var i = 0, l = symbols.length; i < l; i++) { 70 | var symbol = symbols[i]; 71 | print("// symbol: " + symbol.alias); 72 | print(symbol.serialize()); 73 | } 74 | } 75 | else { 76 | if (typeof JSDOC.opt.t != "undefined") { 77 | try { 78 | // a file named "publish.js" must exist in the template directory 79 | load(JSDOC.opt.t+"publish.js"); 80 | 81 | // and must define a function named "publish" 82 | if (!publish) { 83 | LOG.warn("No publish() function is defined in that template so nothing to do."); 84 | } 85 | else { 86 | // which will be called with the symbolSet produced from your code 87 | publish(JSDOC.JsDoc.symbolSet); 88 | } 89 | } 90 | catch(e) { 91 | LOG.warn("Sorry, that doesn't seem to be a valid template: "+JSDOC.opt.t+"publish.js : "+e); 92 | } 93 | } 94 | else { 95 | LOG.warn("No template given. Might as well read the usage notes."); 96 | JSDOC.usage(); 97 | } 98 | } 99 | } 100 | 101 | // notify of any warnings 102 | if (!JSDOC.opt.q && LOG.warnings.length) { 103 | print(LOG.warnings.length+" warning"+(LOG.warnings.length != 1? "s":"")+"."); 104 | } 105 | 106 | // stop sending log messages to a file 107 | if (LOG.out) { 108 | LOG.out.flush(); 109 | LOG.out.close(); 110 | } 111 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/plugins/commentSrcJson.js: -------------------------------------------------------------------------------- 1 | JSDOC.PluginManager.registerPlugin( 2 | "JSDOC.commentSrcJson", 3 | { 4 | onDocCommentSrc: function(comment) { 5 | var json; 6 | if (/^\s*@json\b/.test(comment)) { 7 | comment.src = new String(comment.src).replace("@json", ""); 8 | 9 | eval("json = "+comment.src); 10 | var tagged = ""; 11 | for (var i in json) { 12 | var tag = json[i]; 13 | // todo handle cases where tag is an object 14 | tagged += "@"+i+" "+tag+"\n"; 15 | } 16 | comment.src = tagged; 17 | } 18 | } 19 | } 20 | ); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/plugins/frameworkPrototype.js: -------------------------------------------------------------------------------- 1 | JSDOC.PluginManager.registerPlugin( 2 | "JSDOC.frameworkPrototype", 3 | { 4 | onPrototypeClassCreate: function(classCreator) { 5 | var desc = ""; 6 | if (classCreator.comment) { 7 | desc = classCreator.comment; 8 | } 9 | var insert = desc+"/** @name "+classCreator.name+"\n@constructor\n@scope "+classCreator.name+".prototype */" 10 | 11 | insert = insert.replace(/\*\/\/\*\*/g, "\n"); 12 | /*DEBUG*///print("insert is "+insert); 13 | classCreator.addComment.data = insert; 14 | } 15 | } 16 | ); 17 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/plugins/functionCall.js: -------------------------------------------------------------------------------- 1 | JSDOC.PluginManager.registerPlugin( 2 | "JSDOC.functionCall", 3 | { 4 | onFunctionCall: function(functionCall) { 5 | if (functionCall.name == "dojo.define" && functionCall.arg1) { 6 | functionCall.doc = "/** @lends "+eval(functionCall.arg1)+".prototype */"; 7 | } 8 | } 9 | } 10 | ); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/plugins/publishSrcHilite.js: -------------------------------------------------------------------------------- 1 | JSDOC.PluginManager.registerPlugin( 2 | "JSDOC.publishSrcHilite", 3 | { 4 | onPublishSrc: function(src) { 5 | if (src.path in JsHilite.cache) { 6 | return; // already generated src code 7 | } 8 | else JsHilite.cache[src.path] = true; 9 | 10 | try { 11 | var sourceCode = IO.readFile(src.path); 12 | } 13 | catch(e) { 14 | print(e.message); 15 | quit(); 16 | } 17 | 18 | var hiliter = new JsHilite(sourceCode, src.charset); 19 | src.hilited = hiliter.hilite(); 20 | } 21 | } 22 | ); 23 | 24 | function JsHilite(src, charset) { 25 | 26 | var tr = new JSDOC.TokenReader(); 27 | 28 | tr.keepComments = true; 29 | tr.keepDocs = true; 30 | tr.keepWhite = true; 31 | 32 | this.tokens = tr.tokenize(new JSDOC.TextStream(src)); 33 | 34 | // TODO is redefining toString() the best way? 35 | JSDOC.Token.prototype.toString = function() { 36 | return ""+this.data.replace(/"; 37 | } 38 | 39 | if (!charset) charset = "utf-8"; 40 | 41 | this.header = ' '+ 42 | "
    ";
    50 | 	this.footer = "
    "; 51 | this.showLinenumbers = true; 52 | } 53 | 54 | JsHilite.cache = {}; 55 | 56 | JsHilite.prototype.hilite = function() { 57 | var hilited = this.tokens.join(""); 58 | var line = 1; 59 | if (this.showLinenumbers) hilited = hilited.replace(/(^|\n)/g, function(m){return m+""+((line<10)? " ":"")+((line<100)? " ":"")+(line++)+" "}); 60 | 61 | return this.header+hilited+this.footer; 62 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/plugins/symbolLink.js: -------------------------------------------------------------------------------- 1 | JSDOC.PluginManager.registerPlugin( 2 | "JSDOC.symbolLink", 3 | { 4 | onSymbolLink: function(link) { 5 | // modify link.linkPath (the href part of the link) 6 | // or link.linkText (the text displayed) 7 | // or link.linkInner (the #name part of the link) 8 | } 9 | } 10 | ); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/plugins/tagParamConfig.js: -------------------------------------------------------------------------------- 1 | JSDOC.PluginManager.registerPlugin( 2 | "JSDOC.tagParamConfig", 3 | { 4 | onDocCommentTags: function(comment) { 5 | var currentParam = null; 6 | var tags = comment.tags; 7 | for (var i = 0, l = tags.length; i < l; i++) { 8 | 9 | if (tags[i].title == "param") { 10 | if (tags[i].name.indexOf(".") == -1) { 11 | currentParam = i; 12 | } 13 | } 14 | else if (tags[i].title == "config") { 15 | tags[i].title = "param"; 16 | if (currentParam == null) { 17 | tags[i].name = "arguments"+"."+tags[i].name; 18 | } 19 | else if (tags[i].name.indexOf(tags[currentParam].name+".") != 0) { 20 | tags[i].name = tags[currentParam].name+"."+tags[i].name; 21 | } 22 | currentParam != null 23 | //tags[currentParam].properties.push(tags[i]); 24 | } 25 | else { 26 | currentParam = null; 27 | } 28 | } 29 | } 30 | } 31 | ); 32 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/plugins/tagSynonyms.js: -------------------------------------------------------------------------------- 1 | JSDOC.PluginManager.registerPlugin( 2 | "JSDOC.tagSynonyms", 3 | { 4 | onDocCommentSrc: function(comment) { 5 | comment.src = comment.src.replace(/@methodOf\b/i, "@function\n@memberOf"); 6 | comment.src = comment.src.replace(/@fieldOf\b/i, "@field\n@memberOf"); 7 | }, 8 | 9 | onDocCommentTags: function(comment) { 10 | for (var i = 0, l = comment.tags.length; i < l; i++) { 11 | var title = comment.tags[i].title.toLowerCase(); 12 | var syn; 13 | if ((syn = JSDOC.tagSynonyms.synonyms["="+title])) { 14 | comment.tags[i].title = syn; 15 | } 16 | } 17 | } 18 | } 19 | ); 20 | 21 | new Namespace( 22 | "JSDOC.tagSynonyms", 23 | function() { 24 | JSDOC.tagSynonyms.synonyms = { 25 | "=member": "memberOf", 26 | "=memberof": "memberOf", 27 | "=description": "desc", 28 | "=exception": "throws", 29 | "=argument": "param", 30 | "=returns": "return", 31 | "=classdescription": "class", 32 | "=fileoverview": "overview", 33 | "=extends": "augments", 34 | "=base": "augments", 35 | "=projectdescription": "overview", 36 | "=classdescription": "class", 37 | "=link": "see", 38 | "=borrows": "inherits", 39 | "=scope": "lends", 40 | "=construct": "constructor" 41 | } 42 | } 43 | ); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/t/TestDoc.js: -------------------------------------------------------------------------------- 1 | var TestDoc = { 2 | fails: 0, 3 | plans: 0, 4 | passes: 0, 5 | results: [] 6 | }; 7 | 8 | TestDoc.record = function(result) { 9 | TestDoc.results.push(result); 10 | if (typeof result.verdict == "boolean") { 11 | if (result.verdict === false) TestDoc.fails++; 12 | if (result.verdict === true) TestDoc.passes++; 13 | } 14 | } 15 | 16 | TestDoc.prove = function(filePath) { 17 | if (typeof document != "undefined" && typeof document.write != "undefined") { 18 | if (TestDoc.console) print = function(s) { TestDoc.console.appendChild(document.createTextNode(s+"\n")); } 19 | else print = function(s) { document.write(s+"
    "); } 20 | } 21 | TestDoc.run(TestDoc.readFile(filePath)); 22 | } 23 | 24 | TestDoc.run = function(src) { 25 | try { eval(src); } catch(e) { print("# ERROR! "+e); } 26 | 27 | var chunks = src.split(/\/\*t:/); 28 | 29 | var run = function(chunk) { 30 | // local shortcuts 31 | var is = TestDoc.assertEquals; 32 | var isnt = TestDoc.assertNotEquals; 33 | var plan = TestDoc.plan; 34 | var requires = TestDoc.requires; 35 | 36 | try { eval(chunk); } catch(e) { print("# ERROR! "+e); } 37 | } 38 | for (var start = -1, end = 0; (start = src.indexOf("/*t:", end)) > end; start = end) { 39 | run( 40 | src.substring( 41 | start+4, 42 | (end = src.indexOf("*/", start)) 43 | ) 44 | ); 45 | } 46 | } 47 | 48 | TestDoc.Result = function(verdict, message) { 49 | this.verdict = verdict; 50 | this.message = message; 51 | } 52 | 53 | TestDoc.Result.prototype.toString = function() { 54 | if (typeof this.verdict == "boolean") { 55 | return (this.verdict? "ok" : "not ok") + " " + (++TestDoc.report.counter) + " - " + this.message; 56 | } 57 | 58 | return "# " + this.message; 59 | } 60 | 61 | TestDoc.requires = function(file) { 62 | if (!TestDoc.requires.loaded[file]) { 63 | load(file); 64 | TestDoc.requires.loaded[file] = true; 65 | } 66 | } 67 | TestDoc.requires.loaded = {}; 68 | 69 | TestDoc.report = function() { 70 | TestDoc.report.counter = 0; 71 | print("1.."+TestDoc.plans); 72 | for (var i = 0; i < TestDoc.results.length; i++) { 73 | print(TestDoc.results[i]); 74 | } 75 | print("----------------------------------------"); 76 | if (TestDoc.fails == 0 && TestDoc.passes == TestDoc.plans) { 77 | print("All tests successful."); 78 | } 79 | else { 80 | print("Failed " + TestDoc.fails + "/" + TestDoc.plans + " tests, "+((TestDoc.plans == 0)? 0 : Math.round(TestDoc.passes/(TestDoc.passes+TestDoc.fails)*10000)/100)+"% okay. Planned to run "+TestDoc.plans+", did run "+(TestDoc.passes+TestDoc.fails)+".") 81 | } 82 | } 83 | 84 | TestDoc.plan = function(n, message) { 85 | TestDoc.plans += n; 86 | TestDoc.record(new TestDoc.Result(null, message+" ("+n+" tests)")); 87 | } 88 | 89 | TestDoc.assertEquals = function(a, b, message) { 90 | var result = (a == b); 91 | if (!result) message += "\n#\n# " + a + " does not equal " + b + "\n#"; 92 | TestDoc.record(new TestDoc.Result(result, message)); 93 | } 94 | 95 | TestDoc.assertNotEquals = function(a, b, message) { 96 | var result = (a != b); 97 | if (!result) message += "\n#\n# " + a + " equals " + b + "\n#"; 98 | TestDoc.record(new TestDoc.Result(result, message)); 99 | } 100 | 101 | TestDoc.readFile = (function(){ 102 | // rhino 103 | if (typeof readFile == "function") { 104 | return function(url) { 105 | var text = readFile(url); 106 | return text || ""; 107 | } 108 | } 109 | 110 | // a web browser 111 | else { 112 | return function(url) { 113 | var httpRequest; 114 | 115 | if (window.XMLHttpRequest) { // Mozilla, Safari, etc 116 | httpRequest = new XMLHttpRequest(); 117 | } 118 | else if (window.ActiveXObject) { // IE 119 | try { 120 | httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); 121 | } 122 | catch (e) { 123 | try { 124 | httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); 125 | } 126 | catch (e) { 127 | } 128 | } 129 | } 130 | 131 | if (!httpRequest) { throw "Cannot create HTTP Request."; } 132 | 133 | httpRequest.open('GET', url, false); 134 | httpRequest.send(''); 135 | if (httpRequest.readyState == 4) { 136 | if (httpRequest.status >= 400) { 137 | throw "The HTTP Request returned an error code: "+httpRequest.status; 138 | } 139 | } 140 | 141 | return httpRequest.responseText || ""; 142 | } 143 | } 144 | })(); 145 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/t/runner.js: -------------------------------------------------------------------------------- 1 | // try: java -jar ../../jsrun.jar runner.js 2 | 3 | load("TestDoc.js"); 4 | 5 | TestDoc.prove("../frame/Opt.js"); 6 | TestDoc.prove("../lib/JSDOC.js"); 7 | TestDoc.prove("../frame/String.js"); 8 | TestDoc.prove("../lib/JSDOC/DocTag.js"); 9 | TestDoc.prove("../lib/JSDOC/DocComment.js"); 10 | TestDoc.prove("../lib/JSDOC/TokenReader.js"); 11 | TestDoc.prove("../lib/JSDOC/Symbol.js"); 12 | 13 | TestDoc.report(); 14 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/addon.js: -------------------------------------------------------------------------------- 1 | String.prototype.reverse = function() { 2 | } 3 | 4 | String.prototype.reverse.utf8 = function() { 5 | } 6 | 7 | Function.count = function() { 8 | } 9 | 10 | /** @memberOf Function */ 11 | Function.count.reset = function() { 12 | } 13 | 14 | /** @memberOf Function */ 15 | count.getValue = function() { 16 | } 17 | 18 | /** @memberOf Function.prototype */ 19 | getSig = function() { 20 | } 21 | 22 | /** @memberOf Function.prototype */ 23 | Function.prototype.getProps = function() { 24 | } 25 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/anon_inner.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @name bar 3 | * @namespace 4 | */ 5 | 6 | new function() { 7 | /** 8 | * @name bar-foo 9 | * @function 10 | * @param {number} x 11 | */ 12 | function foo(x) { 13 | } 14 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/augments.js: -------------------------------------------------------------------------------- 1 | /** 2 | @constructor 3 | */ 4 | function Layout(p) { 5 | this.init = function(p) { 6 | } 7 | 8 | this.getId = function() { 9 | } 10 | 11 | /** @type Page */ 12 | this.orientation = "landscape"; 13 | } 14 | 15 | /** 16 | @constructor 17 | @augments Layout 18 | */ 19 | function Page() { 20 | this.reset = function(b) { 21 | } 22 | } 23 | 24 | /** 25 | @extends Page 26 | @constructor 27 | */ 28 | function ThreeColumnPage() { 29 | this.init = function(resetCode) { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/augments2.js: -------------------------------------------------------------------------------- 1 | /** 2 | @constructor 3 | */ 4 | function LibraryItem() { 5 | this.reserve = function() { 6 | } 7 | } 8 | 9 | /** 10 | @constructor 11 | */ 12 | function Junkmail() { 13 | this.annoy = function() { 14 | } 15 | } 16 | 17 | /** 18 | @inherits Junkmail.prototype.annoy as pester 19 | @augments ThreeColumnPage 20 | @augments LibraryItem 21 | @constructor 22 | */ 23 | function NewsletterPage() { 24 | this.getHeadline = function() { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/borrows.js: -------------------------------------------------------------------------------- 1 | /** 2 | @constructor 3 | */ 4 | function Layout(p) { 5 | /** initilize 1 */ 6 | this.init = function(p) { 7 | } 8 | 9 | /** get the id */ 10 | this.getId = function() { 11 | } 12 | 13 | /** @type string */ 14 | this.orientation = "landscape"; 15 | 16 | function getInnerElements(elementSecretId){ 17 | } 18 | } 19 | 20 | /** A static method. */ 21 | Layout.units = function() { 22 | } 23 | 24 | /** 25 | @constructor 26 | @borrows Layout#orientation 27 | @borrows Layout-getInnerElements 28 | @borrows Layout.units 29 | */ 30 | function Page() { 31 | /** reset the page */ 32 | this.reset = function(b) { 33 | } 34 | } 35 | 36 | /** 37 | @constructor 38 | @borrows Layout.prototype.orientation as this.orientation 39 | @borrows Layout.prototype.init as #init 40 | @inherits Page.prototype.reset as #reset 41 | */ 42 | function ThreeColumnPage() { 43 | /** initilize 2 */ 44 | this.init = function(p) { 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/borrows2.js: -------------------------------------------------------------------------------- 1 | // testing circular borrows 2 | 3 | /** 4 | @class 5 | @borrows Bar#zop as this.my_zop 6 | */ 7 | function Foo() { 8 | /** this is a zip. */ 9 | this.zip = function() {} 10 | 11 | this.my_zop = new Bar().zop; 12 | } 13 | 14 | /** 15 | @class 16 | @borrows Foo#zip as this.my_zip 17 | */ 18 | function Bar() { 19 | /** this is a zop. */ 20 | this.zop = function() {} 21 | 22 | this.my_zip = new Foo().zip; 23 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @constructor 3 | * @param person The person. 4 | * @param {string} person.name The person's name. 5 | * @config {integer} age The person's age. 6 | * @config [id=1] Optional id number to use. 7 | * @param connection 8 | */ 9 | function Contact(person, connection) { 10 | 11 | } 12 | 13 | /** 14 | * @constructor 15 | * @param persons 16 | * @config {string} Father The paternal person. 17 | * @config {string} Mother The maternal person. 18 | * @config {string[]} Children And the rest. 19 | */ 20 | function Family(/**Object*/persons) { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/constructs.js: -------------------------------------------------------------------------------- 1 | var Person = makeClass( 2 | /** 3 | @scope Person 4 | */ 5 | { 6 | /** 7 | This is just another way to define a constructor. 8 | @constructs 9 | @param {string} name The name of the person. 10 | */ 11 | initialize: function(name) { 12 | this.name = name; 13 | }, 14 | say: function(message) { 15 | return this.name + " says: " + message; 16 | } 17 | } 18 | ); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/encoding.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @Constructor 4 | * @desc 配置文件 5 | * @class 什么也不返回 6 | */ 7 | function Test(conf) { 8 | // do something; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/encoding_other.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/jsdoc-toolkit/app/test/encoding_other.js -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/event.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @name Kitchen 3 | * @constructor 4 | * @fires Bakery#event:donutOrdered 5 | */ 6 | 7 | /** 8 | * Fired when some cake is eaten. 9 | * @name Kitchen#event:cakeEaten 10 | * @function 11 | * @param {Number} pieces The number of pieces eaten. 12 | */ 13 | 14 | /** 15 | * Find out if cake was eaten. 16 | * @name Kitchen#cakeEaten 17 | * @function 18 | * @param {Boolean} wasEaten 19 | */ 20 | 21 | /** 22 | * @name getDesert 23 | * @function 24 | * @fires Kitchen#event:cakeEaten 25 | */ 26 | 27 | /** 28 | * @name Bakery 29 | * @constructor 30 | * @extends Kitchen 31 | */ 32 | 33 | /** 34 | * Fired when a donut order is made. 35 | * @name Bakery#event:donutOrdered 36 | * @event 37 | * @param {Event} e The event object. 38 | * @param {String} [e.topping] Optional sprinkles. 39 | */ 40 | 41 | /** 42 | * @constructor 43 | * @borrows Bakery#event:donutOrdered as this.event:cakeOrdered 44 | */ 45 | function CakeShop() { 46 | } 47 | 48 | /** @event */ 49 | CakeShop.prototype.icingReady = function(isPink) { 50 | } 51 | 52 | /** @event */ 53 | function amHungry(/**Boolean*/enoughToEatAHorse) { 54 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/exports.js: -------------------------------------------------------------------------------- 1 | /** @namespace */ 2 | var mxn = {}; 3 | 4 | (function(){ 5 | /** @exports Map as mxn.Map */ 6 | var Map = 7 | /** @constructor */ 8 | mxn.Map = function() { 9 | }; 10 | 11 | /** A method. */ 12 | Map.prototype.doThings = function() { 13 | }; 14 | })(); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/functions_anon.js: -------------------------------------------------------------------------------- 1 | /** an anonymous constructor executed inline */ 2 | a = new function() { 3 | /** a.b*/ 4 | this.b = 1; 5 | /** a.f */ 6 | this.f = function() { 7 | /** a.c */ 8 | this.c = 2; 9 | } 10 | } 11 | 12 | 13 | /** 14 | named function executed inline 15 | */ 16 | bar1 = function Zoola1() { 17 | /** property of global */ 18 | this.g = 1; 19 | }(); 20 | 21 | /** 22 | named constructor executed inline 23 | */ 24 | bar2 = new function Zoola2() { 25 | /** property of bar */ 26 | this.p = 1; 27 | }; 28 | 29 | /** module pattern */ 30 | module = (function () { 31 | /** won't appear in documentation */ 32 | var priv = 1; 33 | 34 | /** @scope module */ 35 | return { 36 | /** will appear as a property of module */ 37 | pub: 1 38 | } 39 | })(); 40 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/functions_nested.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | function Zop() { 3 | } 4 | 5 | /** 6 | @class 7 | */ 8 | Foo = function(id) { 9 | // this is a bit twisted, but if you call Foo() you will then 10 | // modify Foo(). This is kinda, sorta non-insane, because you 11 | // would have to call Foo() 100% of the time to use Foo's methods 12 | Foo.prototype.methodOne = function(bar) { 13 | alert(bar); 14 | }; 15 | 16 | // same again 17 | Foo.prototype.methodTwo = function(bar2) { 18 | alert(bar2); 19 | }; 20 | 21 | // and these are only executed if the enclosing function is actually called 22 | // and who knows if that will ever happen? 23 | Bar = function(pez) { 24 | alert(pez); 25 | }; 26 | Zop.prototype.zap = function(p){ 27 | alert(p); 28 | }; 29 | 30 | // but this is only visible inside Foo 31 | function inner() { 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/global.js: -------------------------------------------------------------------------------- 1 | /** ecks */ 2 | var x = [1, 2, 4]; 3 | 4 | var y = { 5 | foo: function(){ 6 | } 7 | } 8 | 9 | bar = function() { 10 | } 11 | 12 | function zop() { 13 | } 14 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/globals.js: -------------------------------------------------------------------------------- 1 | function example(/**Circle*/a, b) { 2 | /** a global defined in function */ 3 | var number = a; 4 | 5 | var hideNumber = function(){ 6 | } 7 | 8 | setNumber = function(){ 9 | } 10 | alert('You have chosen: ' + b); 11 | } 12 | 13 | function initPage() { 14 | var supported = document.createElement && document.getElementsByTagName; 15 | if (!supported) return; 16 | // start of DOM script 17 | var x = document.getElementById('writeroot'); 18 | // etc. 19 | } 20 | 21 | /** an example var */ 22 | var document = new Document(x, y); 23 | 24 | var getNumber = function(){ 25 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/ignore.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A test constructor. 3 | * @constructor 4 | * @ignore 5 | */ 6 | function Ignored() { 7 | /** a method */ 8 | this.bar = function() { 9 | } 10 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/inner.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @constructor 3 | */ 4 | function Outer() { 5 | /** 6 | * @constructor 7 | */ 8 | function Inner(name) { 9 | /** The name of this. */ 10 | this.name = name; 11 | } 12 | 13 | this.open = function(name) { 14 | return (new Inner(name)); 15 | } 16 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/lend.js: -------------------------------------------------------------------------------- 1 | /** @class */ 2 | var Person = Class.create( 3 | /** 4 | @lends Person.prototype 5 | */ 6 | { 7 | initialize: function(name) { 8 | this.name = name; 9 | }, 10 | say: function(message) { 11 | return this.name + ': ' + message; 12 | } 13 | } 14 | ); 15 | 16 | /** @lends Person.prototype */ 17 | { 18 | /** like say but more musical */ 19 | sing: function(song) { 20 | } 21 | } 22 | 23 | /** @lends Person */ 24 | { 25 | getCount: function() { 26 | } 27 | } 28 | 29 | /** @lends Unknown.prototype */ 30 | { 31 | notok: function() { 32 | } 33 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/memberof.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | pack = function() { 3 | this.init = function(){} 4 | function config(){} 5 | } 6 | 7 | pack.build = function(task) {}; 8 | 9 | /** @memberOf pack */ 10 | pack.install = function() {} 11 | 12 | /** @memberOf pack */ 13 | pack.install.overwrite = function() {} 14 | 15 | /** @memberOf pack */ 16 | clean = function() {} 17 | 18 | /** @memberOf pack-config */ 19 | install = function() {}; 20 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/memberof2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @constructor 3 | */ 4 | function Foo() { 5 | /** 6 | @memberOf Foo.prototype 7 | */ 8 | function bar(a, b) { 9 | } 10 | 11 | /** 12 | @memberOf Foo 13 | */ 14 | var zip = function(p, q) { 15 | } 16 | 17 | /** 18 | @memberOf Foo 19 | */ 20 | function zop( x,y ) { 21 | } 22 | 23 | /** 24 | @memberOf Foo 25 | @constructor 26 | */ 27 | function Fiz() { 28 | /** A method of Foo#Fiz. */ 29 | this.fipple = function(fop){} 30 | } 31 | } 32 | 33 | /** 34 | @memberOf Foo# 35 | */ 36 | var blat = function() { 37 | 38 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/memberof3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @name Foo 3 | * @class 4 | */ 5 | 6 | /**#@+ 7 | * @memberOf Foo# 8 | * @field 9 | */ 10 | 11 | /** 12 | * @name bar 13 | * @type Object[] 14 | */ 15 | 16 | /**#@-*/ 17 | 18 | /** 19 | * @name Foo2 20 | * @class 21 | */ 22 | 23 | /**#@+ 24 | * @memberOf Foo2# 25 | * @field 26 | */ 27 | 28 | /** 29 | * @name bar 30 | * @type Object[] 31 | */ 32 | 33 | /**#@-*/ -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/memberof_constructor.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | function Circle(){} 3 | 4 | /** 5 | @constructor 6 | @memberOf Circle# 7 | */ 8 | Circle.prototype.Tangent = function(){}; 9 | 10 | // renaming Circle#Tangent to Circle#Circle#Tangent 11 | 12 | /** 13 | @memberOf Circle#Tangent# 14 | */ 15 | Circle.prototype.Tangent.prototype.getDiameter = function(){}; 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/module.js: -------------------------------------------------------------------------------- 1 | /** @namespace */ 2 | myProject = myProject || {}; 3 | 4 | /** @namespace */ 5 | myProject.myModule = (function () { 6 | /** describe myPrivateVar here */ 7 | var myPrivateVar = ""; 8 | 9 | var myPrivateMethod = function () { 10 | } 11 | 12 | /** @scope myProject.myModule */ 13 | return { 14 | myPublicMethod: function () { 15 | } 16 | }; 17 | })(); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/multi_methods.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Get the entire flavor. 4 | @name flavor^3 5 | @function 6 | @returns {Object} The entire flavor hash. 7 | */ 8 | /** 9 | Get a named flavor. 10 | @name flavor^2 11 | @function 12 | @param {String} name The name of the flavor to get. 13 | @returns {String} The value of that flavor. 14 | */ 15 | /** 16 | Set the flavor. 17 | @param {String} name The name of the flavor to set. 18 | @param {String} value The value of the flavor. 19 | @returns {String} The value of that flavor. 20 | */ 21 | function flavor(name, value) { 22 | if (arguments.length > 1) flavor[name] = value; 23 | else if (arguments.length == 1) return flavor[name]; 24 | else return flavor; 25 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/name.js: -------------------------------------------------------------------------------- 1 | /** 2 | @name Response 3 | @class 4 | */ 5 | 6 | Response.prototype = { 7 | /** 8 | @name Response#text 9 | @function 10 | @description 11 | Gets the body of the response as plain text 12 | @returns {String} 13 | Response as text 14 | */ 15 | 16 | text: function() { 17 | return this.nativeResponse.responseText; 18 | } 19 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/namespace_nested.js: -------------------------------------------------------------------------------- 1 | /** 2 | @namespace This is the first namespace. 3 | */ 4 | ns1 = {}; 5 | 6 | /** 7 | This is the second namespace. 8 | @namespace 9 | */ 10 | ns1.ns2 = {}; 11 | 12 | /** 13 | This part of ns1.ns2 14 | @constructor 15 | */ 16 | ns1.ns2.Function1 = function() { 17 | }; 18 | 19 | ns1.staticFunction = function() { 20 | }; 21 | 22 | /** A static field in a namespace. */ 23 | ns1.ns2.staticField = 1; 24 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/nocode.js: -------------------------------------------------------------------------------- 1 | /**#nocode+*/ 2 | /** 3 | @name star 4 | @function 5 | */ 6 | function blahblah() { 7 | 8 | } 9 | /**#nocode-*/ 10 | 11 | function yaddayadda() { 12 | 13 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/oblit_anon.js: -------------------------------------------------------------------------------- 1 | /** the options */ 2 | opt = Opt.get( 3 | arguments, 4 | { 5 | d: "directory", 6 | c: "conf", 7 | "D[]": "define" 8 | } 9 | ); 10 | 11 | /** configuration */ 12 | opt.conf = { 13 | /** keep */ 14 | keep: true, 15 | /** base */ 16 | base: getBase(this, {p: properties}) 17 | } 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/overview.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @overview This "library" contains a 3 | * lot of classes and functions. 4 | * @example 5 |
     6 | 	var x (x < 1);
     7 | 	alert("This 'is' \"code\"");
     8 |  
    9 | * @name My Cool Library 10 | * @author Joe Smith jsmith@company.com 11 | * @version 0.1 12 | */ 13 | 14 | /** 15 | * Gets the current foo 16 | * @param {String} fooId The unique identifier for the foo. 17 | * @return {Object} Returns the current foo. 18 | */ 19 | function getFoo(fooID){ 20 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/param_inline.js: -------------------------------------------------------------------------------- 1 | /** 2 | @constructor 3 | @param columns The number of columns. 4 | */ 5 | function Layout(/**int*/columns){ 6 | /** 7 | @param [id] The id of the element. 8 | @param elName The name of the element. 9 | */ 10 | this.getElement = function( 11 | /** string */ elName, 12 | /** number|string */ id 13 | ) { 14 | }; 15 | 16 | /** 17 | @constructor 18 | */ 19 | this.Canvas = function(top, left, /**int*/width, height) { 20 | /** Is it initiated yet? */ 21 | this.initiated = true; 22 | } 23 | 24 | this.rotate = function(/**nothing*/) { 25 | } 26 | 27 | /** 28 | @param x 29 | @param y 30 | @param {zoppler} z*/ 31 | this.init = function(x, y, /**abbler*/z) { 32 | /** The xyz. */ 33 | this.xyz = x+y+z; 34 | this.getXyz = function() { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/params_optional.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @param {Page[]} pages 4 | * @param {number} [id] Specifies the id, if applicable. 5 | * @param {String} [title = This is untitled.] Specifies the title. 6 | */ 7 | function Document(pages, id, title){ 8 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/prototype.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | function Article() { 3 | } 4 | 5 | Article.prototype.init = function(title) { 6 | /** the instance title */ 7 | this.title = title; 8 | 9 | /** the static counter */ 10 | Article.counter = 1; 11 | } 12 | 13 | a = new Article(); 14 | a.Init("my title"); 15 | 16 | print(a.title); 17 | print(Article.counter); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/prototype_nested.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | function Word() { 3 | } 4 | 5 | Word.prototype.reverse = function() { 6 | } 7 | 8 | Word.prototype.reverse.utf8 = function() { 9 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/prototype_oblit.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | function Article() { 3 | } 4 | 5 | Article.prototype = { 6 | /** instance get title */ 7 | getTitle: function(){ 8 | } 9 | } 10 | 11 | /** static get title */ 12 | Article.getTitle = function(){ 13 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/prototype_oblit_constructor.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | function Article() { 3 | } 4 | 5 | Article.prototype = { 6 | /** @constructor */ 7 | Title: function(title) { 8 | /** the value of the Title instance */ 9 | this.title = title; 10 | }, 11 | 12 | init: function(pages) { 13 | /** the value of the pages of the Article instance */ 14 | this.pages = pages; 15 | } 16 | } 17 | 18 | f = new Article(); 19 | f.init("one two three"); 20 | 21 | t = new f.Title("my title"); 22 | 23 | print(f.pages); 24 | print(t.title); -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/public.js: -------------------------------------------------------------------------------- 1 | /**@constructor*/ 2 | function Foo() { 3 | /** 4 | @public 5 | @static 6 | @field 7 | */ 8 | var bar = function(x) { 9 | } 10 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/scripts/code.js: -------------------------------------------------------------------------------- 1 | /** 2 | @class 3 | */ 4 | function thisiscode() { 5 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/scripts/notcode.txt: -------------------------------------------------------------------------------- 1 | (This is not code) 2 | function foo(){{{{ 3 | ( 4 | ! 5 | @ -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/shared.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Builtin object. 4 | * @class 5 | * @name Array 6 | */ 7 | 8 | /**#@+ 9 | * Extension to builtin array. 10 | * @memberOf Array 11 | * @method 12 | */ 13 | 14 | /** 15 | * @returns Boolen if some array members... 16 | */ 17 | Array.prototype.some = function(){}; 18 | 19 | /** 20 | * Change every element of an array. 21 | * @returns Filtered array copy. 22 | */ 23 | Array.prototype.filter = function(){}; 24 | 25 | /**#@-*/ 26 | 27 | 28 | /** 29 | * A first in, first out data structure. 30 | * @constructor 31 | */ 32 | Queue = function(){}; 33 | 34 | /**#@+ 35 | * Extension to Queue. 36 | * @memberOf Queue 37 | */ 38 | 39 | rewind = function(){ 40 | } 41 | 42 | // should close automatically here. -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/shared2.js: -------------------------------------------------------------------------------- 1 | startOver = function(){ 2 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/shortcuts.js: -------------------------------------------------------------------------------- 1 | // /**#=+ 2 | // * { 3 | // * 'D': 'Date.prototype', 4 | // * '$N': 'Number' 5 | // * } 6 | // */ 7 | // var D = Date.prototype, 8 | // $N = Number; 9 | // 10 | // D.locale = function(){ 11 | // }; 12 | // 13 | // /** 14 | // @return {string} The cardinal number string. 15 | // */ 16 | // $N.nth = function(n){ 17 | // }; 18 | // 19 | // LOAD.file = function(){ 20 | // } 21 | // 22 | // /**#=-*/ -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/static_this.js: -------------------------------------------------------------------------------- 1 | /** the parent */ 2 | var box = {}; 3 | 4 | /** @namespace */ 5 | box.holder = {} 6 | 7 | box.holder.foo = function() { 8 | /** the counter */ 9 | this.counter = 1; 10 | } 11 | 12 | box.holder.foo(); 13 | print(box.holder.counter); 14 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/synonyms.js: -------------------------------------------------------------------------------- 1 | /** 2 | @class 3 | @inherits Bar#zop as #my_zop 4 | */ 5 | function Foo() { 6 | /** this is a zip. */ 7 | this.zip = function() {} 8 | 9 | /** from Bar */ 10 | this.my_zop = new Bar().zop; 11 | } 12 | 13 | /** 14 | @class 15 | @borrows Foo#zip as this.my_zip 16 | */ 17 | function Bar() { 18 | /** this is a zop. */ 19 | this.zop = function() {} 20 | 21 | /** from Foo */ 22 | this.my_zip = new Foo().zip; 23 | } 24 | 25 | /** @namespace */ 26 | var myObject = { 27 | /** 28 | @type function 29 | */ 30 | myFunc: getFunction() 31 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/tosource.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Object} object 3 | * @return {string} 4 | */ 5 | function valueOf(object) {} 6 | 7 | /** 8 | * @param {Object} object 9 | * @return {string} 10 | */ 11 | function toString(object) {} 12 | 13 | /** 14 | * @param {Object} object 15 | * @return {string} 16 | */ 17 | function toSource(object) {} 18 | 19 | /** 20 | * @param {Object} object 21 | * @return {string} 22 | */ 23 | function constructor(object) {} -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/app/test/variable_redefine.js: -------------------------------------------------------------------------------- 1 | /** @constructor */ 2 | function Foo() { 3 | var bar = 1; 4 | bar = 2; // redefining a private 5 | 6 | this.baz = 1; 7 | baz = 2; // global 8 | 9 | /** a private */ 10 | var blap = { 11 | /** in here */ 12 | tada: 1 13 | } 14 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/conf/sample.conf: -------------------------------------------------------------------------------- 1 | /* 2 | This is an example of one way you could set up a configuration file to more 3 | conveniently define some commandline options. You might like to do this if 4 | you frequently reuse the same options. Note that you don't need to define 5 | every option in this file, you can combine a configuration file with 6 | additional options on the commandline if your wish. 7 | 8 | You would include this configuration file by running JsDoc Toolkit like so: 9 | java -jar jsrun.jar app/run.js -c=conf/sample.conf 10 | 11 | */ 12 | 13 | { 14 | // source files to use 15 | _: ['app/test/jsdoc_test.js'], 16 | 17 | // document all functions, even uncommented ones 18 | a: true, 19 | 20 | // including those marked @private 21 | p: true, 22 | 23 | // some extra variables I want to include 24 | D: {generatedBy: "Michael Mathews", copyright: "2008"}, 25 | 26 | // use this directory as the output directory 27 | d: "docs", 28 | 29 | // use this template 30 | t: "templates/jsdoc" 31 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/java/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/java/build_1.4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/java/classes/js.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/jsdoc-toolkit/java/classes/js.jar -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/java/src/JsDebugRun.java: -------------------------------------------------------------------------------- 1 | /** 2 | * A trivial bootstrap class that simply adds the path to the 3 | * .js file as an argument to the Rhino call. This little hack 4 | * allows the code in the .js file to have access to it's own 5 | * path via the Rhino arguments object. This is necessary to 6 | * allow the .js code to find resource files in a location 7 | * relative to itself. 8 | * 9 | * USAGE: java -jar jsdebug.jar path/to/file.js 10 | */ 11 | public class JsDebugRun { 12 | public static void main(String[] args) { 13 | String[] jsargs = {"-j="+args[0]}; 14 | 15 | String[] allArgs = new String[jsargs.length + args.length]; 16 | System.arraycopy(args, 0, allArgs, 0, args.length); 17 | System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length); 18 | 19 | org.mozilla.javascript.tools.debugger.Main.main(allArgs); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/java/src/JsRun.java: -------------------------------------------------------------------------------- 1 | /** 2 | * A trivial bootstrap class that simply adds the path to the 3 | * .js file as an argument to the Rhino call. This little hack 4 | * allows the code in the .js file to have access to it's own 5 | * path via the Rhino arguments object. This is necessary to 6 | * allow the .js code to find resource files in a location 7 | * relative to itself. 8 | * 9 | * USAGE: java -jar jsrun.jar path/to/file.js 10 | */ 11 | public class JsRun { 12 | public static void main(String[] args) { 13 | String[] jsargs = {"-j="+args[0]}; 14 | 15 | String[] allArgs = new String[jsargs.length + args.length]; 16 | System.arraycopy(args, 0, allArgs, 0, args.length); 17 | System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length); 18 | 19 | org.mozilla.javascript.tools.shell.Main.main(allArgs); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/jsdebug.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/jsdoc-toolkit/jsdebug.jar -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/jsrun.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/jsdoc-toolkit/jsrun.jar -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/jsrun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ksh 2 | 3 | # launcher script for jsdoc 4 | # Author: Avi Deitcher 5 | # 6 | # This program is released under the MIT License as follows: 7 | 8 | # Copyright (c) 2008-2009 Atomic Inc 9 | # 10 | #Permission is hereby granted, free of charge, to any person 11 | #obtaining a copy of this software and associated documentation 12 | #files (the "Software"), to deal in the Software without 13 | #restriction, including without limitation the rights to use, 14 | #copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | #copies of the Software, and to permit persons to whom the 16 | #Software is furnished to do so, subject to the following 17 | #conditions: 18 | ## 19 | #The above copyright notice and this permission notice shall be 20 | #included in all copies or substantial portions of the Software. 21 | # 22 | #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | #OTHER DEALINGS IN THE SOFTWARE. 30 | # 31 | 32 | 33 | if [[ -n "$JSDOCDIR" ]]; then 34 | _DOCDIR="-Djsdoc.dir=$JSDOCDIR" 35 | _APPDIR="$JSDOCDIR/app" 36 | _BASEDIR="$JSDOCDIR" 37 | else 38 | _DOCDIR="" 39 | _APPDIR="./app" 40 | _BASEDIR="." 41 | fi 42 | 43 | if [[ -n "$JSDOCTEMPLATEDIR" ]]; then 44 | _TDIR="-Djsdoc.template.dir=$JSDOCTEMPLATEDIR" 45 | else 46 | _TDIR="" 47 | fi 48 | 49 | CMD="java $_DOCDIR $_TDIR -jar $_BASEDIR/jsrun.jar $_APPDIR/run.js $@" 50 | echo $CMD 51 | $CMD 52 | 53 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl: -------------------------------------------------------------------------------- 1 |
    {+new Link().toFile("index.html").withText("Class Index")+} 2 | | {+new Link().toFile("files.html").withText("File Index")+}
    3 |
    4 |

    Classes

    5 |
      6 | 7 |
    • {! 8 | if (thisClass.alias == "_global_") { 9 | output += ""+new Link().toClass(thisClass.alias)+""; 10 | } 11 | else { 12 | output += new Link().toClass(thisClass.alias); 13 | } 14 | !}
    • 15 |
      16 |
    17 |
    -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | {! Link.base = ""; /* all generated links will be relative to this */ !} 7 | JsDoc Reference - File Index 8 | 9 | 10 | 13 | 14 | 15 | 16 | {+include("static/header.html")+} 17 | 18 |
    19 | {+publish.classesIndex+} 20 |
    21 | 22 |
    23 |

    File Index

    24 | 25 | 26 |
    27 |

    {+new Link().toSrc(item.alias).withText(item.name)+}

    28 | {+resolveLinks(item.desc)+} 29 |
    30 | 31 |
    Author:
    32 |
    {+item.author+}
    33 |
    34 | 35 |
    Version:
    36 |
    {+item.version+}
    37 |
    38 | {! var locations = item.comment.getTag('location').map(function($){return $.toString().replace(/(^\$ ?| ?\$$)/g, '').replace(/^HeadURL: https:/g, 'http:');}) !} 39 | 40 |
    Location:
    41 | 42 |
    {+location+}
    43 |
    44 |
    45 |
    46 |
    47 |
    48 |
    49 | 50 |
    51 |
    52 | ©{+JSDOC.opt.D.copyright+}
    53 | Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} 54 |
    55 | 56 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/index.tmpl: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - Index 8 | 9 | 10 | 13 | 14 | 15 | 16 | {+include("static/header.html")+} 17 | 18 |
    19 | {+publish.classesIndex+} 20 |
    21 | 22 |
    23 |

    Class Index

    24 | 25 | 26 |
    27 |

    {+(new Link().toSymbol(thisClass.alias))+}

    28 | {+resolveLinks(summarize(thisClass.classDesc))+} 29 |
    30 |
    31 |
    32 | 33 |
    34 |
    35 | ©{+JSDOC.opt.D.copyright+}
    36 | Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} 37 |
    38 | 39 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/publish.js: -------------------------------------------------------------------------------- 1 | /** Called automatically by JsDoc Toolkit. */ 2 | function publish(symbolSet) { 3 | publish.conf = { // trailing slash expected for dirs 4 | ext: ".html", 5 | outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/", 6 | templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/jsdoc/", 7 | symbolsDir: "symbols/", 8 | srcDir: "symbols/src/" 9 | }; 10 | 11 | // is source output is suppressed, just display the links to the source file 12 | if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) { 13 | Link.prototype._makeSrcLink = function(srcFilePath) { 14 | return "<"+srcFilePath+">"; 15 | } 16 | } 17 | 18 | // create the folders and subfolders to hold the output 19 | IO.mkPath((publish.conf.outDir+"symbols/src").split("/")); 20 | 21 | // used to allow Link to check the details of things being linked to 22 | Link.symbolSet = symbolSet; 23 | 24 | // create the required templates 25 | try { 26 | var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"class.tmpl"); 27 | var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl"); 28 | } 29 | catch(e) { 30 | print("Couldn't create the required templates: "+e); 31 | quit(); 32 | } 33 | 34 | // some ustility filters 35 | function hasNoParent($) {return ($.memberOf == "")} 36 | function isaFile($) {return ($.is("FILE"))} 37 | function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)} 38 | 39 | // get an array version of the symbolset, useful for filtering 40 | var symbols = symbolSet.toArray(); 41 | 42 | // create the hilited source code files 43 | var files = JSDOC.opt.srcFiles; 44 | for (var i = 0, l = files.length; i < l; i++) { 45 | var file = files[i]; 46 | var srcDir = publish.conf.outDir + "symbols/src/"; 47 | makeSrcFile(file, srcDir); 48 | } 49 | 50 | // get a list of all the classes in the symbolset 51 | var classes = symbols.filter(isaClass).sort(makeSortby("alias")); 52 | 53 | // create a filemap in which outfiles must be to be named uniquely, ignoring case 54 | if (JSDOC.opt.u) { 55 | var filemapCounts = {}; 56 | Link.filemap = {}; 57 | for (var i = 0, l = classes.length; i < l; i++) { 58 | var lcAlias = classes[i].alias.toLowerCase(); 59 | 60 | if (!filemapCounts[lcAlias]) filemapCounts[lcAlias] = 1; 61 | else filemapCounts[lcAlias]++; 62 | 63 | Link.filemap[classes[i].alias] = 64 | (filemapCounts[lcAlias] > 1)? 65 | lcAlias+"_"+filemapCounts[lcAlias] : lcAlias; 66 | } 67 | } 68 | 69 | // create a class index, displayed in the left-hand column of every class page 70 | Link.base = "../"; 71 | publish.classesIndex = classesTemplate.process(classes); // kept in memory 72 | 73 | // create each of the class pages 74 | for (var i = 0, l = classes.length; i < l; i++) { 75 | var symbol = classes[i]; 76 | 77 | symbol.events = symbol.getEvents(); // 1 order matters 78 | symbol.methods = symbol.getMethods(); // 2 79 | 80 | Link.currentSymbol= symbol; 81 | var output = ""; 82 | output = classTemplate.process(symbol); 83 | 84 | IO.saveFile(publish.conf.outDir+"symbols/", ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias) + publish.conf.ext, output); 85 | } 86 | 87 | // regenerate the index with different relative links, used in the index pages 88 | Link.base = ""; 89 | publish.classesIndex = classesTemplate.process(classes); 90 | 91 | // create the class index page 92 | try { 93 | var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl"); 94 | } 95 | catch(e) { print(e.message); quit(); } 96 | 97 | var classesIndex = classesindexTemplate.process(classes); 98 | IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex); 99 | classesindexTemplate = classesIndex = classes = null; 100 | 101 | // create the file index page 102 | try { 103 | var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl"); 104 | } 105 | catch(e) { print(e.message); quit(); } 106 | 107 | var documentedFiles = symbols.filter(isaFile); // files that have file-level docs 108 | var allFiles = []; // not all files have file-level docs, but we need to list every one 109 | 110 | for (var i = 0; i < files.length; i++) { 111 | allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */"))); 112 | } 113 | 114 | for (var i = 0; i < documentedFiles.length; i++) { 115 | var offset = files.indexOf(documentedFiles[i].alias); 116 | allFiles[offset] = documentedFiles[i]; 117 | } 118 | 119 | allFiles = allFiles.sort(makeSortby("name")); 120 | 121 | // output the file index page 122 | var filesIndex = fileindexTemplate.process(allFiles); 123 | IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex); 124 | fileindexTemplate = filesIndex = files = null; 125 | } 126 | 127 | 128 | /** Just the first sentence (up to a full stop). Should not break on dotted variable names. */ 129 | function summarize(desc) { 130 | if (typeof desc != "undefined") 131 | return desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i)? RegExp.$1 : desc; 132 | } 133 | 134 | /** Make a symbol sorter by some attribute. */ 135 | function makeSortby(attribute) { 136 | return function(a, b) { 137 | if (a[attribute] != undefined && b[attribute] != undefined) { 138 | a = a[attribute].toLowerCase(); 139 | b = b[attribute].toLowerCase(); 140 | if (a < b) return -1; 141 | if (a > b) return 1; 142 | return 0; 143 | } 144 | } 145 | } 146 | 147 | /** Pull in the contents of an external file at the given path. */ 148 | function include(path) { 149 | var path = publish.conf.templatesDir+path; 150 | return IO.readFile(path); 151 | } 152 | 153 | /** Turn a raw source file into a code-hilited page in the docs. */ 154 | function makeSrcFile(path, srcDir, name) { 155 | if (JSDOC.opt.s) return; 156 | 157 | if (!name) { 158 | name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_"); 159 | name = name.replace(/\:/g, "_"); 160 | } 161 | 162 | var src = {path: path, name:name, charset: IO.encoding, hilited: ""}; 163 | 164 | if (defined(JSDOC.PluginManager)) { 165 | JSDOC.PluginManager.run("onPublishSrc", src); 166 | } 167 | 168 | if (src.hilited) { 169 | IO.saveFile(srcDir, name+publish.conf.ext, src.hilited); 170 | } 171 | } 172 | 173 | /** Build output for displaying function parameters. */ 174 | function makeSignature(params) { 175 | if (!params) return "()"; 176 | var signature = "(" 177 | + 178 | params.filter( 179 | function($) { 180 | return $.name.indexOf(".") == -1; // don't show config params in signature 181 | } 182 | ).map( 183 | function($) { 184 | return $.name; 185 | } 186 | ).join(", ") 187 | + 188 | ")"; 189 | return signature; 190 | } 191 | 192 | /** Find symbol {@link ...} strings in text and turn into html links */ 193 | function resolveLinks(str, from) { 194 | str = str.replace(/\{@link ([^} ]+) ?\}/gi, 195 | function(match, symbolName) { 196 | return new Link().toSymbol(symbolName); 197 | } 198 | ); 199 | 200 | return str; 201 | } 202 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/static/default.css: -------------------------------------------------------------------------------- 1 | /* default.css */ 2 | body 3 | { 4 | font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif; 5 | width: 800px; 6 | } 7 | 8 | .header 9 | { 10 | clear: both; 11 | background-color: #ccc; 12 | padding: 8px; 13 | } 14 | 15 | h1 16 | { 17 | font-size: 150%; 18 | font-weight: bold; 19 | padding: 0; 20 | margin: 1em 0 0 .3em; 21 | } 22 | 23 | hr 24 | { 25 | border: none 0; 26 | border-top: 1px solid #7F8FB1; 27 | height: 1px; 28 | } 29 | 30 | pre.code 31 | { 32 | display: block; 33 | padding: 8px; 34 | border: 1px dashed #ccc; 35 | } 36 | 37 | #index 38 | { 39 | margin-top: 24px; 40 | float: left; 41 | width: 160px; 42 | position: absolute; 43 | left: 8px; 44 | background-color: #F3F3F3; 45 | padding: 8px; 46 | } 47 | 48 | #content 49 | { 50 | margin-left: 190px; 51 | width: 600px; 52 | } 53 | 54 | .classList 55 | { 56 | list-style-type: none; 57 | padding: 0; 58 | margin: 0 0 0 8px; 59 | font-family: arial, sans-serif; 60 | font-size: 1em; 61 | overflow: auto; 62 | } 63 | 64 | .classList li 65 | { 66 | padding: 0; 67 | margin: 0 0 8px 0; 68 | } 69 | 70 | .summaryTable { width: 100%; } 71 | 72 | h1.classTitle 73 | { 74 | font-size:170%; 75 | line-height:130%; 76 | } 77 | 78 | h2 { font-size: 110%; } 79 | caption, div.sectionTitle 80 | { 81 | background-color: #7F8FB1; 82 | color: #fff; 83 | font-size:130%; 84 | text-align: left; 85 | padding: 2px 6px 2px 6px; 86 | border: 1px #7F8FB1 solid; 87 | } 88 | 89 | div.sectionTitle { margin-bottom: 8px; } 90 | .summaryTable thead { display: none; } 91 | 92 | .summaryTable td 93 | { 94 | vertical-align: top; 95 | padding: 4px; 96 | border-bottom: 1px #7F8FB1 solid; 97 | border-right: 1px #7F8FB1 solid; 98 | } 99 | 100 | /*col#summaryAttributes {}*/ 101 | .summaryTable td.attributes 102 | { 103 | border-left: 1px #7F8FB1 solid; 104 | width: 140px; 105 | text-align: right; 106 | } 107 | 108 | td.attributes, .fixedFont 109 | { 110 | line-height: 15px; 111 | color: #002EBE; 112 | font-family: "Courier New",Courier,monospace; 113 | font-size: 13px; 114 | } 115 | 116 | .summaryTable td.nameDescription 117 | { 118 | text-align: left; 119 | font-size: 13px; 120 | line-height: 15px; 121 | } 122 | 123 | .summaryTable td.nameDescription, .description 124 | { 125 | line-height: 15px; 126 | padding: 4px; 127 | padding-left: 4px; 128 | } 129 | 130 | .summaryTable { margin-bottom: 8px; } 131 | 132 | ul.inheritsList 133 | { 134 | list-style: square; 135 | margin-left: 20px; 136 | padding-left: 0; 137 | } 138 | 139 | .detailList { 140 | margin-left: 20px; 141 | line-height: 15px; 142 | } 143 | .detailList dt { margin-left: 20px; } 144 | 145 | .detailList .heading 146 | { 147 | font-weight: bold; 148 | padding-bottom: 6px; 149 | margin-left: 0; 150 | } 151 | 152 | .light, td.attributes, .light a:link, .light a:visited 153 | { 154 | color: #777; 155 | font-style: italic; 156 | } 157 | 158 | .fineprint 159 | { 160 | text-align: right; 161 | font-size: 10px; 162 | } -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/static/header.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/static/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Generated Javascript Documentation 7 | 8 | 9 | 10 | 11 | 12 | <body> 13 | <p> 14 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 15 | </p> 16 | </body> 17 | 18 | 19 | -------------------------------------------------------------------------------- /tools/jsdoc-toolkit/templates/jsdoc/symbol.tmpl: -------------------------------------------------------------------------------- 1 | 2 | {+data.name+} 3 | {+data.memberOf+} 4 | {+data.isStatic+} 5 | {+data.isa+} 6 | {+data.desc+} 7 | {+data.classDesc+} 8 | 9 | 10 | 11 | {+method.name+} 12 | {+method.memberOf+} 13 | {+method.isStatic+} 14 | {+method.desc+} 15 | 16 | 17 | {+param.type+} 18 | {+param.name+} 19 | {+param.desc+} 20 | {+param.defaultValue+} 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {+property.name+} 29 | {+property.memberOf+} 30 | {+property.isStatic+} 31 | {+property.desc+} 32 | {+property.type+} 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/LICENSE.TXT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/yuicompressor-2.4.6/LICENSE.TXT -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/ant.properties: -------------------------------------------------------------------------------- 1 | src.dir = src 2 | lib.dir = lib 3 | doc.dir = doc 4 | build.dir = build 5 | product.name = yuicompressor 6 | version.number = 2.4.6 7 | jar.name = ${product.name}-${version.number}.jar 8 | dist.package.name = ${product.name}-${version.number} 9 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/build/yuicompressor-2.4.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/yuicompressor-2.4.6/build/yuicompressor-2.4.6.jar -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/doc/README: -------------------------------------------------------------------------------- 1 | ============================================================================== 2 | YUI Compressor 3 | ============================================================================== 4 | 5 | NAME 6 | 7 | YUI Compressor - The Yahoo! JavaScript and CSS Compressor 8 | 9 | SYNOPSIS 10 | 11 | Usage: java -jar yuicompressor-x.y.z.jar [options] [input file] 12 | 13 | Global Options 14 | -h, --help Displays this information 15 | --type Specifies the type of the input file 16 | --charset Read the input file using 17 | --line-break Insert a line break after the specified column number 18 | -v, --verbose Display informational messages and warnings 19 | -o Place the output into or a file pattern. 20 | Defaults to stdout. 21 | 22 | JavaScript Options 23 | --nomunge Minify only, do not obfuscate 24 | --preserve-semi Preserve all semicolons 25 | --disable-optimizations Disable all micro optimizations 26 | 27 | DESCRIPTION 28 | 29 | The YUI Compressor is a JavaScript compressor which, in addition to removing 30 | comments and white-spaces, obfuscates local variables using the smallest 31 | possible variable name. This obfuscation is safe, even when using constructs 32 | such as 'eval' or 'with' (although the compression is not optimal is those 33 | cases) Compared to jsmin, the average savings is around 20%. 34 | 35 | The YUI Compressor is also able to safely compress CSS files. The decision 36 | on which compressor is being used is made on the file extension (js or css) 37 | 38 | GLOBAL OPTIONS 39 | 40 | -h, --help 41 | Prints help on how to use the YUI Compressor 42 | 43 | --line-break 44 | Some source control tools don't like files containing lines longer than, 45 | say 8000 characters. The linebreak option is used in that case to split 46 | long lines after a specific column. It can also be used to make the code 47 | more readable, easier to debug (especially with the MS Script Debugger) 48 | Specify 0 to get a line break after each semi-colon in JavaScript, and 49 | after each rule in CSS. 50 | 51 | --type js|css 52 | The type of compressor (JavaScript or CSS) is chosen based on the 53 | extension of the input file name (.js or .css) This option is required 54 | if no input file has been specified. Otherwise, this option is only 55 | required if the input file extension is neither 'js' nor 'css'. 56 | 57 | --charset character-set 58 | If a supported character set is specified, the YUI Compressor will use it 59 | to read the input file. Otherwise, it will assume that the platform's 60 | default character set is being used. The output file is encoded using 61 | the same character set. 62 | 63 | -o outfile 64 | 65 | Place output in file outfile. If not specified, the YUI Compressor will 66 | default to the standard output, which you can redirect to a file. 67 | Supports a filter syntax for expressing the output pattern when there are 68 | multiple input files. ex: 69 | java -jar yuicompressor.jar -o '.css$:-min.css' *.css 70 | ... will minify all .css files and save them as -min.css 71 | 72 | -v, --verbose 73 | Display informational messages and warnings. 74 | 75 | JAVASCRIPT ONLY OPTIONS 76 | 77 | --nomunge 78 | Minify only. Do not obfuscate local symbols. 79 | 80 | --preserve-semi 81 | Preserve unnecessary semicolons (such as right before a '}') This option 82 | is useful when compressed code has to be run through JSLint (which is the 83 | case of YUI for example) 84 | 85 | --disable-optimizations 86 | Disable all the built-in micro optimizations. 87 | 88 | NOTES 89 | 90 | + If no input file is specified, it defaults to stdin. 91 | 92 | + Supports wildcards for specifying multiple input files. 93 | 94 | + The YUI Compressor requires Java version >= 1.4. 95 | 96 | + It is possible to prevent a local variable, nested function or function 97 | argument from being obfuscated by using "hints". A hint is a string that 98 | is located at the very beginning of a function body like so: 99 | 100 | function fn (arg1, arg2, arg3) { 101 | "arg2:nomunge, localVar:nomunge, nestedFn:nomunge"; 102 | 103 | ... 104 | var localVar; 105 | ... 106 | 107 | function nestedFn () { 108 | .... 109 | } 110 | 111 | ... 112 | } 113 | 114 | The hint itself disappears from the compressed file. 115 | 116 | + C-style comments starting with /*! are preserved. This is useful with 117 | comments containing copyright/license information. For example: 118 | 119 | /*! 120 | * TERMS OF USE - EASING EQUATIONS 121 | * Open source under the BSD License. 122 | * Copyright 2001 Robert Penner All rights reserved. 123 | */ 124 | 125 | becomes: 126 | 127 | /* 128 | * TERMS OF USE - EASING EQUATIONS 129 | * Open source under the BSD License. 130 | * Copyright 2001 Robert Penner All rights reserved. 131 | */ 132 | 133 | MODIFIED RHINO FILES 134 | 135 | YUI Compressor uses a modified version of the Rhino library 136 | (http://www.mozilla.org/rhino/) The changes were made to support 137 | JScript conditional comments, preserved comments, unescaped slash 138 | characters in regular expressions, and to allow for the optimization 139 | of escaped quotes in string literals. 140 | 141 | COPYRIGHT AND LICENSE 142 | 143 | Copyright (c) 2011 Yahoo! Inc. All rights reserved. 144 | The copyrights embodied in the content of this file are licensed 145 | by Yahoo! Inc. under the BSD (revised) open source license. 146 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/lib/jargs-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/yuicompressor-2.4.6/lib/jargs-1.0.jar -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/lib/rhino-1.6R7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avk/jQuery-Chrono/e04acdaba0bdfb8a6c7f771ddf73f60387035447/tools/yuicompressor-2.4.6/lib/rhino-1.6R7.jar -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/src/com/yahoo/platform/yui/compressor/Bootstrap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * YUI Compressor 3 | * http://developer.yahoo.com/yui/compressor/ 4 | * Author: Julien Lecomte - http://www.julienlecomte.net/ 5 | * Copyright (c) 2011 Yahoo! Inc. All rights reserved. 6 | * The copyrights embodied in the content of this file are licensed 7 | * by Yahoo! Inc. under the BSD (revised) open source license. 8 | */ 9 | 10 | package com.yahoo.platform.yui.compressor; 11 | 12 | import java.lang.reflect.Method; 13 | 14 | public class Bootstrap { 15 | 16 | public static void main(String args[]) throws Exception { 17 | ClassLoader loader = new JarClassLoader(); 18 | Thread.currentThread().setContextClassLoader(loader); 19 | Class c = loader.loadClass(YUICompressor.class.getName()); 20 | Method main = c.getMethod("main", new Class[]{String[].class}); 21 | main.invoke(null, new Object[]{args}); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/src/com/yahoo/platform/yui/compressor/JarClassLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * YUI Compressor 3 | * http://developer.yahoo.com/yui/compressor/ 4 | * Author: Julien Lecomte - http://www.julienlecomte.net/ 5 | * Copyright (c) 2011 Yahoo! Inc. All rights reserved. 6 | * The copyrights embodied in the content of this file are licensed 7 | * by Yahoo! Inc. under the BSD (revised) open source license. 8 | */ 9 | package com.yahoo.platform.yui.compressor; 10 | 11 | import java.io.ByteArrayOutputStream; 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | import java.io.OutputStream; 15 | import java.util.Enumeration; 16 | import java.util.jar.JarEntry; 17 | import java.util.jar.JarFile; 18 | 19 | public class JarClassLoader extends ClassLoader { 20 | 21 | private static String jarPath; 22 | 23 | public Class loadClass(String name) throws ClassNotFoundException { 24 | 25 | // First check if the class is already loaded 26 | Class c = findLoadedClass(name); 27 | if (c == null) { 28 | c = findClass(name); 29 | } 30 | 31 | if (c == null) { 32 | c = ClassLoader.getSystemClassLoader().loadClass(name); 33 | } 34 | 35 | return c; 36 | } 37 | 38 | private static String getJarPath() { 39 | 40 | if (jarPath != null) { 41 | return jarPath; 42 | } 43 | 44 | String classname = JarClassLoader.class.getName().replace('.', '/') + ".class"; 45 | String classpath = System.getProperty("java.class.path"); 46 | String classpaths[] = classpath.split(System.getProperty("path.separator")); 47 | 48 | for (int i = 0; i < classpaths.length; i++) { 49 | 50 | String path = classpaths[i]; 51 | JarFile jarFile = null; 52 | JarEntry jarEntry = null; 53 | 54 | try { 55 | jarFile = new JarFile(path); 56 | jarEntry = findJarEntry(jarFile, classname); 57 | } catch (IOException ioe) { 58 | /* ignore */ 59 | } finally { 60 | if (jarFile != null) { 61 | try { 62 | jarFile.close(); 63 | } catch (IOException ioe) { 64 | /* ignore */ 65 | } 66 | } 67 | } 68 | 69 | if (jarEntry != null) { 70 | jarPath = path; 71 | break; 72 | } 73 | } 74 | 75 | return jarPath; 76 | } 77 | 78 | private static JarEntry findJarEntry(JarFile jarFile, String entryName) { 79 | 80 | Enumeration entries = jarFile.entries(); 81 | 82 | while (entries.hasMoreElements()) { 83 | JarEntry entry = (JarEntry) entries.nextElement(); 84 | if (entry.getName().equals(entryName)) { 85 | return entry; 86 | } 87 | } 88 | 89 | return null; 90 | } 91 | 92 | protected Class findClass(String name) { 93 | 94 | Class c = null; 95 | String jarPath = getJarPath(); 96 | 97 | if (jarPath != null) { 98 | JarFile jarFile = null; 99 | try { 100 | jarFile = new JarFile(jarPath); 101 | c = loadClassData(jarFile, name); 102 | } catch (IOException ioe) { 103 | /* ignore */ 104 | } finally { 105 | if (jarFile != null) { 106 | try { 107 | jarFile.close(); 108 | } catch (IOException ioe) { 109 | /* ignore */ 110 | } 111 | } 112 | } 113 | } 114 | 115 | return c; 116 | } 117 | 118 | private Class loadClassData(JarFile jarFile, String className) { 119 | 120 | String entryName = className.replace('.', '/') + ".class"; 121 | JarEntry jarEntry = findJarEntry(jarFile, entryName); 122 | if (jarEntry == null) { 123 | return null; 124 | } 125 | 126 | // Create the necessary package if needed... 127 | int index = className.lastIndexOf('.'); 128 | if (index >= 0) { 129 | String packageName = className.substring(0, index); 130 | if (getPackage(packageName) == null) { 131 | definePackage(packageName, "", "", "", "", "", "", null); 132 | } 133 | } 134 | 135 | // Read the Jar File entry and define the class... 136 | Class c = null; 137 | try { 138 | InputStream is = jarFile.getInputStream(jarEntry); 139 | ByteArrayOutputStream os = new ByteArrayOutputStream(); 140 | copy(is, os); 141 | byte[] bytes = os.toByteArray(); 142 | c = defineClass(className, bytes, 0, bytes.length); 143 | } catch (IOException ioe) { 144 | /* ignore */ 145 | } 146 | 147 | return c; 148 | } 149 | 150 | private void copy(InputStream in, OutputStream out) throws IOException { 151 | byte[] buf = new byte[1024]; 152 | while (true) { 153 | int len = in.read(buf); 154 | if (len < 0) break; 155 | out.write(buf, 0, len); 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/src/com/yahoo/platform/yui/compressor/JavaScriptIdentifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * YUI Compressor 3 | * http://developer.yahoo.com/yui/compressor/ 4 | * Author: Julien Lecomte - http://www.julienlecomte.net/ 5 | * Copyright (c) 2011 Yahoo! Inc. All rights reserved. 6 | * The copyrights embodied in the content of this file are licensed 7 | * by Yahoo! Inc. under the BSD (revised) open source license. 8 | */ 9 | package com.yahoo.platform.yui.compressor; 10 | 11 | import org.mozilla.javascript.Token; 12 | 13 | /** 14 | * JavaScriptIdentifier represents a variable/function identifier. 15 | */ 16 | class JavaScriptIdentifier extends JavaScriptToken { 17 | 18 | private int refcount = 0; 19 | private String mungedValue; 20 | private ScriptOrFnScope declaredScope; 21 | private boolean markedForMunging = true; 22 | 23 | JavaScriptIdentifier(String value, ScriptOrFnScope declaredScope) { 24 | super(Token.NAME, value); 25 | this.declaredScope = declaredScope; 26 | } 27 | 28 | ScriptOrFnScope getDeclaredScope() { 29 | return declaredScope; 30 | } 31 | 32 | void setMungedValue(String value) { 33 | mungedValue = value; 34 | } 35 | 36 | String getMungedValue() { 37 | return mungedValue; 38 | } 39 | 40 | void preventMunging() { 41 | markedForMunging = false; 42 | } 43 | 44 | boolean isMarkedForMunging() { 45 | return markedForMunging; 46 | } 47 | 48 | void incrementRefcount() { 49 | refcount++; 50 | } 51 | 52 | int getRefcount() { 53 | return refcount; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/src/com/yahoo/platform/yui/compressor/JavaScriptToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * YUI Compressor 3 | * http://developer.yahoo.com/yui/compressor/ 4 | * Author: Julien Lecomte - http://www.julienlecomte.net/ 5 | * Copyright (c) 2011 Yahoo! Inc. All rights reserved. 6 | * The copyrights embodied in the content of this file are licensed 7 | * by Yahoo! Inc. under the BSD (revised) open source license. 8 | */ 9 | package com.yahoo.platform.yui.compressor; 10 | 11 | public class JavaScriptToken { 12 | 13 | private int type; 14 | private String value; 15 | 16 | JavaScriptToken(int type, String value) { 17 | this.type = type; 18 | this.value = value; 19 | } 20 | 21 | int getType() { 22 | return type; 23 | } 24 | 25 | String getValue() { 26 | return value; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/src/com/yahoo/platform/yui/compressor/ScriptOrFnScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * YUI Compressor 3 | * http://developer.yahoo.com/yui/compressor/ 4 | * Author: Julien Lecomte - http://www.julienlecomte.net/ 5 | * Copyright (c) 2011 Yahoo! Inc. All rights reserved. 6 | * The copyrights embodied in the content of this file are licensed 7 | * by Yahoo! Inc. under the BSD (revised) open source license. 8 | */ 9 | package com.yahoo.platform.yui.compressor; 10 | 11 | import java.util.ArrayList; 12 | import java.util.Enumeration; 13 | import java.util.Hashtable; 14 | 15 | class ScriptOrFnScope { 16 | 17 | private int braceNesting; 18 | private ScriptOrFnScope parentScope; 19 | private ArrayList subScopes; 20 | private Hashtable identifiers = new Hashtable(); 21 | private Hashtable hints = new Hashtable(); 22 | private boolean markedForMunging = true; 23 | private int varcount = 0; 24 | 25 | ScriptOrFnScope(int braceNesting, ScriptOrFnScope parentScope) { 26 | this.braceNesting = braceNesting; 27 | this.parentScope = parentScope; 28 | this.subScopes = new ArrayList(); 29 | if (parentScope != null) { 30 | parentScope.subScopes.add(this); 31 | } 32 | } 33 | 34 | int getBraceNesting() { 35 | return braceNesting; 36 | } 37 | 38 | ScriptOrFnScope getParentScope() { 39 | return parentScope; 40 | } 41 | 42 | JavaScriptIdentifier declareIdentifier(String symbol) { 43 | JavaScriptIdentifier identifier = (JavaScriptIdentifier) identifiers.get(symbol); 44 | if (identifier == null) { 45 | identifier = new JavaScriptIdentifier(symbol, this); 46 | identifiers.put(symbol, identifier); 47 | } 48 | return identifier; 49 | } 50 | 51 | JavaScriptIdentifier getIdentifier(String symbol) { 52 | return (JavaScriptIdentifier) identifiers.get(symbol); 53 | } 54 | 55 | void addHint(String variableName, String variableType) { 56 | hints.put(variableName, variableType); 57 | } 58 | 59 | void preventMunging() { 60 | if (parentScope != null) { 61 | // The symbols in the global scope don't get munged, 62 | // but the sub-scopes it contains do get munged. 63 | markedForMunging = false; 64 | } 65 | } 66 | 67 | private ArrayList getUsedSymbols() { 68 | ArrayList result = new ArrayList(); 69 | Enumeration elements = identifiers.elements(); 70 | while (elements.hasMoreElements()) { 71 | JavaScriptIdentifier identifier = (JavaScriptIdentifier) elements.nextElement(); 72 | String mungedValue = identifier.getMungedValue(); 73 | if (mungedValue == null) { 74 | mungedValue = identifier.getValue(); 75 | } 76 | result.add(mungedValue); 77 | } 78 | return result; 79 | } 80 | 81 | private ArrayList getAllUsedSymbols() { 82 | ArrayList result = new ArrayList(); 83 | ScriptOrFnScope scope = this; 84 | while (scope != null) { 85 | result.addAll(scope.getUsedSymbols()); 86 | scope = scope.parentScope; 87 | } 88 | return result; 89 | } 90 | 91 | int incrementVarCount() { 92 | varcount++; 93 | return varcount; 94 | } 95 | 96 | void munge() { 97 | 98 | if (!markedForMunging) { 99 | // Stop right here if this scope was flagged as unsafe for munging. 100 | return; 101 | } 102 | 103 | int pickFromSet = 1; 104 | 105 | // Do not munge symbols in the global scope! 106 | if (parentScope != null) { 107 | 108 | ArrayList freeSymbols = new ArrayList(); 109 | 110 | freeSymbols.addAll(JavaScriptCompressor.ones); 111 | freeSymbols.removeAll(getAllUsedSymbols()); 112 | if (freeSymbols.size() == 0) { 113 | pickFromSet = 2; 114 | freeSymbols.addAll(JavaScriptCompressor.twos); 115 | freeSymbols.removeAll(getAllUsedSymbols()); 116 | } 117 | if (freeSymbols.size() == 0) { 118 | pickFromSet = 3; 119 | freeSymbols.addAll(JavaScriptCompressor.threes); 120 | freeSymbols.removeAll(getAllUsedSymbols()); 121 | } 122 | if (freeSymbols.size() == 0) { 123 | throw new IllegalStateException("The YUI Compressor ran out of symbols. Aborting..."); 124 | } 125 | 126 | Enumeration elements = identifiers.elements(); 127 | while (elements.hasMoreElements()) { 128 | if (freeSymbols.size() == 0) { 129 | pickFromSet++; 130 | if (pickFromSet == 2) { 131 | freeSymbols.addAll(JavaScriptCompressor.twos); 132 | } else if (pickFromSet == 3) { 133 | freeSymbols.addAll(JavaScriptCompressor.threes); 134 | } else { 135 | throw new IllegalStateException("The YUI Compressor ran out of symbols. Aborting..."); 136 | } 137 | // It is essential to remove the symbols already used in 138 | // the containing scopes, or some of the variables declared 139 | // in the containing scopes will be redeclared, which can 140 | // lead to errors. 141 | freeSymbols.removeAll(getAllUsedSymbols()); 142 | } 143 | 144 | String mungedValue; 145 | JavaScriptIdentifier identifier = (JavaScriptIdentifier) elements.nextElement(); 146 | if (identifier.isMarkedForMunging()) { 147 | mungedValue = (String) freeSymbols.remove(0); 148 | } else { 149 | mungedValue = identifier.getValue(); 150 | } 151 | identifier.setMungedValue(mungedValue); 152 | } 153 | } 154 | 155 | for (int i = 0; i < subScopes.size(); i++) { 156 | ScriptOrFnScope scope = (ScriptOrFnScope) subScopes.get(i); 157 | scope.munge(); 158 | } 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/README: -------------------------------------------------------------------------------- 1 | To add a test: 2 | 3 | 1. Create a "blah.css" or "blah.js" file. 4 | 2. Create a "blah.css.min" or "blah.js.min" file, containing the expected minified output. 5 | 6 | That's all! -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/_munge.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var w = window; 3 | 4 | w.hello = function(a, abc) { 5 | "a:nomunge"; 6 | w.alert("Hello, " + a); 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/_munge.js.min: -------------------------------------------------------------------------------- 1 | (function(){var a=window;a.hello=function(a,b){a.alert("Hello, "+a)}})(); -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/_string_combo.js: -------------------------------------------------------------------------------- 1 | function test(){ 2 | var a = "a" + 3 | "b" + 4 | "c"; 5 | } 6 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/_string_combo.js.min: -------------------------------------------------------------------------------- 1 | function test(){var b="abc"}; -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/_syntax_error.js: -------------------------------------------------------------------------------- 1 | 2 | window.$ = $telerik.$; 3 | $(document).ready(function() { 4 | movePageElements(); 5 | 6 | var text = $('textarea').val(); 7 | 8 | if (text != "") 9 | $('textarea').attr("style", "display: block;"); 10 | else 11 | $('textarea').attr("style", "display: none;"); 12 | 13 | //cleanup 14 | text = null; 15 | }); 16 | 17 | function movePageElements() { 18 | var num = null; 19 | var pagenum = $(".pagecontrolscontainer"); 20 | if (pagenum.length > 0) { 21 | var num = pagenum.attr("pagenumber"); 22 | if ((num > 5) && (num < 28)) { 23 | var x = $('div#commentbutton'); 24 | $("div.buttonContainer").prepend(x); 25 | } 26 | else { 27 | $('div#commentbutton').attr("style", "display: none;"); 28 | } 29 | } 30 | 31 | //Add in dropshadowing 32 | if ((num > 5) && (num < 28)) { 33 | var top = $('.dropshadow-top'); 34 | var middle = $('#dropshadow'); 35 | var bottom = $('.dropshadow-bottom'); 36 | $('#page').prepend(top); 37 | $('#topcontainer').after(middle); 38 | middle.append($('#topcontainer')); 39 | middle.after(bottom); 40 | } 41 | 42 | //cleanup 43 | num = null; 44 | pagenum = null; 45 | top = null; 46 | middle = null; 47 | bottom=null; 48 | } 49 | 50 | function expandCollapseDiv(id) { 51 | $telerik.$(id).slideToggle("slow"); 52 | } 53 | 54 | function expandCollapseHelp() { 55 | $('.helpitems').slideToggle("slow"); 56 | 57 | //Add in dropshadowing 58 | if ($('#helpcontainer').length) { 59 | $('#help-dropshadow-bot').insertAfter('#helpcontainer'); 60 | $('#help-dropshadow-bot').removeAttr("style"); 61 | } 62 | } 63 | 64 | function expandCollapseComments() { 65 | var style = $('textarea').attr("style"); 66 | if (style == "display: none;") 67 | $('textarea').fadeIn().focus(); 68 | else 69 | $('textarea').fadeOut(); 70 | 71 | //cleanup 72 | style = null; 73 | } 74 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/_syntax_error.js.min: -------------------------------------------------------------------------------- 1 | window.$=$telerik.$;$(document).ready(function(){movePageElements();var a=$("textarea").val();if(a!=""){$("textarea").attr("style","display: block;")}else{$("textarea").attr("style","display: none;")}a=null});function movePageElements(){var e=null;var b=$(".pagecontrolscontainer");if(b.length>0){var e=b.attr("pagenumber");if((e>5)&&(e<28)){var a=$("div#commentbutton");$("div.buttonContainer").prepend(a)}else{$("div#commentbutton").attr("style","display: none;")}}if((e>5)&&(e<28)){var f=$(".dropshadow-top");var d=$("#dropshadow");var c=$(".dropshadow-bottom");$("#page").prepend(f);$("#topcontainer").after(d);d.append($("#topcontainer"));d.after(c)}e=null;b=null;f=null;d=null;c=null}function expandCollapseDiv(a){$telerik.$(a).slideToggle("slow")}function expandCollapseHelp(){$(".helpitems").slideToggle("slow");if($("#helpcontainer").length){$("#help-dropshadow-bot").insertAfter("#helpcontainer");$("#help-dropshadow-bot").removeAttr("style")}}function expandCollapseComments(){var a=$("textarea").attr("style");if(a=="display: none;"){$("textarea").fadeIn().focus()}else{$("textarea").fadeOut()}a=null}; -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/background-position.css: -------------------------------------------------------------------------------- 1 | a {background-position: 0 0 0 0;} 2 | b {BACKGROUND-POSITION: 0 0;} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/background-position.css.min: -------------------------------------------------------------------------------- 1 | a{background-position:0 0}b{background-position:0 0} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/border-none.css: -------------------------------------------------------------------------------- 1 | a { 2 | border: none; 3 | } 4 | b {BACKGROUND:none} 5 | s {border-top: none;} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/border-none.css.min: -------------------------------------------------------------------------------- 1 | a{border:0}b{background:0}s{border-top:0} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/box-model-hack.css: -------------------------------------------------------------------------------- 1 | #elem { 2 | width: 100px; 3 | voice-family: "\"}\""; 4 | voice-family:inherit; 5 | width: 200px; 6 | } 7 | html>body #elem { 8 | width: 200px; 9 | } 10 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/box-model-hack.css.min: -------------------------------------------------------------------------------- 1 | #elem{width:100px;voice-family:"\"}\"";voice-family:inherit;width:200px}html>body #elem{width:200px} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2527974.css: -------------------------------------------------------------------------------- 1 | /* this file contains no css, it exists purely to put the revision number into the 2 | combined css before uploading it to SiteManager. The exclaimation at the start 3 | of the comment informs yuicompressor not to strip the comment out */ 4 | 5 | /*! $LastChangedRevision: 81 $ $LastChangedDate: 2009-05-27 17:41:02 +0100 (Wed, 27 May 2009) $ */ 6 | 7 | body { 8 | yo: cats; 9 | } 10 | ul[id$=foo] label:hover {yo: yo;} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2527974.css.min: -------------------------------------------------------------------------------- 1 | /*! $LastChangedRevision: 81 $ $LastChangedDate: 2009-05-27 17:41:02 +0100 (Wed, 27 May 2009) $ */body{yo:cats}ul[id$=foo] label:hover{yo:yo} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2527991.css: -------------------------------------------------------------------------------- 1 | @media screen and/*!YUI-Compresser */(-webkit-min-device-pixel-ratio:0) { 2 | a{ 3 | b: 1; 4 | } 5 | } 6 | 7 | 8 | @media screen and/*! */ /*! */(-webkit-min-device-pixel-ratio:0) { 9 | a{ 10 | b: 1; 11 | } 12 | } 13 | 14 | 15 | @media -webkit-min-device-pixel-ratio:0 { 16 | a{ 17 | b: 1; 18 | } 19 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2527991.css.min: -------------------------------------------------------------------------------- 1 | @media screen and/*!YUI-Compresser */(-webkit-min-device-pixel-ratio:0){a{b:1}}@media screen and/*! *//*! */(-webkit-min-device-pixel-ratio:0){a{b:1}}@media -webkit-min-device-pixel-ratio:0{a{b:1}} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2527998.css: -------------------------------------------------------------------------------- 1 | /*! special */ 2 | body { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2527998.css.min: -------------------------------------------------------------------------------- 1 | /*! special */ -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2528034.css: -------------------------------------------------------------------------------- 1 | a[href$="/test/"] span:first-child { b:1; } 2 | a[href$="/test/"] span:first-child { } 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/bug2528034.css.min: -------------------------------------------------------------------------------- 1 | a[href$="/test/"] span:first-child{b:1} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/charset-media.css: -------------------------------------------------------------------------------- 1 | /* re: 2495387 */ 2 | @charset 'utf-8'; 3 | @media all { 4 | body { 5 | } 6 | body { 7 | background-color: gold; 8 | } 9 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/charset-media.css.min: -------------------------------------------------------------------------------- 1 | @charset 'utf-8';@media all{body{background-color:gold}} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/color.css: -------------------------------------------------------------------------------- 1 | .color { 2 | me: rgb(123, 123, 123); 3 | impressed: #ffeedd; 4 | filter: chroma(color="#FFFFFF"); 5 | background: none repeat scroll 0 0 rgb(255, 0,0); 6 | alpha: rgba(1, 2, 3, 4); 7 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/color.css.min: -------------------------------------------------------------------------------- 1 | .color{me:#7b7b7b;impressed:#fed;filter:chroma(color="#FFFFFF");background:none repeat scroll 0 0 #f00;alpha:rgba(1,2,3,4)} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/comment.css: -------------------------------------------------------------------------------- 1 | html >/**/ body p { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/comment.css.min: -------------------------------------------------------------------------------- 1 | html>/**/body p{color:blue} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/concat-charset.css: -------------------------------------------------------------------------------- 1 | /* This is invalid CSS, but frequently happens as a result of concatenation. */ 2 | @charset "utf-8"; 3 | #foo { 4 | border-width:1px; 5 | } 6 | /* 7 | Note that this is erroneous! 8 | The actual CSS file can only have a single charset. 9 | However, this is the job of the author/application. 10 | The compressor should not get involved. 11 | */ 12 | @charset "another one"; 13 | #bar { 14 | border-width:10px; 15 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/concat-charset.css.min: -------------------------------------------------------------------------------- 1 | @charset "utf-8";#foo{border-width:1px}#bar{border-width:10px} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/decimals.css: -------------------------------------------------------------------------------- 1 | ::selection { 2 | margin: 0.6px 0.333pt 1.2em 8.8cm; 3 | } 4 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/decimals.css.min: -------------------------------------------------------------------------------- 1 | ::selection{margin:.6px .333pt 1.2em 8.8cm} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/dollar-header.css: -------------------------------------------------------------------------------- 1 | /*! 2 | $Header: /temp/dirname/filename.css 3 2/02/08 3:37p JSmith $ 3 | */ 4 | 5 | foo { 6 | bar: baz 7 | } 8 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/dollar-header.css.min: -------------------------------------------------------------------------------- 1 | /*! 2 | $Header: /temp/dirname/filename.css 3 2/02/08 3:37p JSmith $ 3 | */foo{bar:baz} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/float.js: -------------------------------------------------------------------------------- 1 | obj.css({"float": "left"}); 2 | obj.css({cssFloat:"left"}); -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/float.js.min: -------------------------------------------------------------------------------- 1 | obj.css({"float":"left"});obj.css({cssFloat:"left"}); -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/font-face.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'gzipper'; 3 | src: url(yanone.eot); 4 | src: local('gzipper'), 5 | url(yanone.ttf) format('truetype'); 6 | } 7 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/font-face.css.min: -------------------------------------------------------------------------------- 1 | @font-face{font-family:'gzipper';src:url(yanone.eot);src:local('gzipper'),url(yanone.ttf) format('truetype')} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/ie5mac.css: -------------------------------------------------------------------------------- 1 | /* Ignore the next rule in IE mac \*/ 2 | .selector { 3 | color: khaki; 4 | } 5 | /* Stop ignoring in IE mac */ 6 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/ie5mac.css.min: -------------------------------------------------------------------------------- 1 | /*\*/.selector{color:khaki}/**/ -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/media-empty-class.css: -------------------------------------------------------------------------------- 1 | /*! preserved */ 2 | emptiness {} 3 | 4 | @import "another.css"; 5 | /* I'm empty - delete me */ 6 | empty { ;} 7 | 8 | @media print { 9 | .noprint { display: none; } 10 | } 11 | 12 | @media screen { 13 | /* this rule should be removed, not simply minified.*/ 14 | .breakme {} 15 | .printonly { display: none; } 16 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/media-empty-class.css.min: -------------------------------------------------------------------------------- 1 | /*! preserved */@import "another.css";@media print{.noprint{display:none}}@media screen{.printonly{display:none}} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/media-multi.css: -------------------------------------------------------------------------------- 1 | @media only all and (max-width:50em), only all and (max-device-width:800px), only all and (max-width:780px) { 2 | some-css : here 3 | } 4 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/media-multi.css.min: -------------------------------------------------------------------------------- 1 | @media only all and (max-width:50em),only all and (max-device-width:800px),only all and (max-width:780px){some-css:here} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/media-test.css: -------------------------------------------------------------------------------- 1 | @media screen and (-webkit-min-device-pixel-ratio:0) { 2 | some-css : here 3 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/media-test.css.min: -------------------------------------------------------------------------------- 1 | @media screen and (-webkit-min-device-pixel-ratio:0){some-css:here} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/opacity-filter.css: -------------------------------------------------------------------------------- 1 | /* example from https://developer.mozilla.org/en/CSS/opacity */ 2 | pre { /* make the box translucent (80% opaque) */ 3 | border: solid red; 4 | opacity: 0.8; /* Firefox, Safari(WebKit), Opera */ 5 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; /* IE 8 */ 6 | filter: PROGID:DXImageTransform.Microsoft.Alpha(Opacity=80); /* IE 4-7 */ 7 | zoom: 1; /* set "zoom", "width" or "height" to trigger "hasLayout" in IE 7 and lower */ 8 | } 9 | 10 | /** and again */ 11 | code { 12 | -ms-filter: "PROGID:DXImageTransform.Microsoft.Alpha(Opacity=80)"; /* IE 8 */ 13 | filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); /* IE 4-7 */ 14 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/opacity-filter.css.min: -------------------------------------------------------------------------------- 1 | pre{border:solid red;opacity:.8;-ms-filter:"alpha(opacity=80)";filter:alpha(opacity=80);zoom:1}code{-ms-filter:"alpha(opacity=80)";filter:alpha(opacity=80)} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/preserve-new-line.css: -------------------------------------------------------------------------------- 1 | #sel-o { 2 | content: "on\"ce upon \ 3 | a time"; 4 | content: 'once upon \ 5 | a ti\'me'; 6 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/preserve-new-line.css.min: -------------------------------------------------------------------------------- 1 | #sel-o{content:"on\"ce upon \ 2 | a time";content:'once upon \ 3 | a ti\'me'} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/preserve-strings.css: -------------------------------------------------------------------------------- 1 | /* preserving strings */ 2 | .sele { 3 | content: "\"keep \" me"; 4 | something: '\\\' . . '; 5 | else: 'empty{}'; 6 | content: "/* test */"; /* <---- this is not a comment, should be be kept */ 7 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/preserve-strings.css.min: -------------------------------------------------------------------------------- 1 | .sele{content:"\"keep \" me";something:'\\\' . . ';else:'empty{}';content:"/* test */"} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/pseudo-first.css: -------------------------------------------------------------------------------- 1 | /* 2 | because of IE6 first-letter and first-line 3 | must be followed by a space 4 | http://reference.sitepoint.com/css/pseudoelement-firstletter 5 | Thanks: P.Sorokin comment at http://www.phpied.com/cssmin-js/ 6 | */ 7 | p:first-letter{ 8 | buh: hum; 9 | } 10 | p:first-line{ 11 | baa: 1; 12 | } 13 | 14 | p:first-line,a,p:first-letter,b{ 15 | color: red; 16 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/pseudo-first.css.min: -------------------------------------------------------------------------------- 1 | p:first-letter {buh:hum}p:first-line {baa:1}p:first-line ,a,p:first-letter ,b{color:red} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/pseudo.css: -------------------------------------------------------------------------------- 1 | p :link { 2 | ba:zinga;;; 3 | foo: bar;;; 4 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/pseudo.css.min: -------------------------------------------------------------------------------- 1 | p :link{ba:zinga;foo:bar} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/special-comments.css: -------------------------------------------------------------------------------- 1 | /*!************88**** 2 | Preserving comments 3 | as they are 4 | ******************** 5 | Keep the initial ! 6 | *******************/ 7 | #yo { 8 | ma: "ma"; 9 | } 10 | /*! 11 | I said 12 | pre- 13 | serve! */ -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/special-comments.css.min: -------------------------------------------------------------------------------- 1 | /*!************88**** 2 | Preserving comments 3 | as they are 4 | ******************** 5 | Keep the initial ! 6 | *******************/#yo{ma:"ma"}/*! 7 | I said 8 | pre- 9 | serve! */ -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/star-underscore-hacks.css: -------------------------------------------------------------------------------- 1 | #elementarr { 2 | width: 1px; 3 | *width: 3pt; 4 | _width: 2em; 5 | } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/star-underscore-hacks.css.min: -------------------------------------------------------------------------------- 1 | #elementarr{width:1px;*width:3pt;_width:2em} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/string-in-comment.css: -------------------------------------------------------------------------------- 1 | /* te " st */ 2 | a{a:1} 3 | /*!"preserve" me*/ 4 | b{content: "/**/"} 5 | /* quite " quote ' \' \" */ 6 | /* ie mac \*/ 7 | c {c : 3} 8 | /* end hiding */ -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/string-in-comment.css.min: -------------------------------------------------------------------------------- 1 | a{a:1}/*!"preserve" me*/b{content:"/**/"}/*\*/c{c:3}/**/ -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/suite.rhino: -------------------------------------------------------------------------------- 1 | input = readFile(arguments[0]); 2 | load("../ports/js/cssmin.js"); 3 | print(YAHOO.compressor.cssmin(input)); -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/suite.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd $(dirname $0) 4 | 5 | # Get the jar to use. 6 | jar="$(ls ../build/*.jar | sort | tail -n1)" 7 | echo "jar: $jar" 8 | 9 | runtest () { 10 | testfile="$1" 11 | expected=${testfile/\.FAIL/}.min 12 | expected="$( 13 | cat $expected 14 | )" 15 | filetype="$( 16 | echo $testfile | egrep -o '(cs|j)s' 17 | )" 18 | 19 | if [ "$2" == "cssminjs" ]; then 20 | actual="$( 21 | java -jar ../lib/rhino-1.6R7.jar suite.rhino $testfile 22 | )" 23 | 24 | else 25 | actual="$( 26 | java -jar $jar --type $filetype $testfile 27 | )" 28 | fi 29 | 30 | if [ "$expected" == "$actual" ]; then 31 | echo "Passed: $testfile" > /dev/stderr 32 | else 33 | ( 34 | echo "Test failed: $testfile" 35 | echo "" 36 | echo "Expected:" 37 | echo "$expected" 38 | echo "" 39 | echo "Actual:" 40 | echo "$actual" 41 | ) > /dev/stderr 42 | return 1 43 | fi 44 | } 45 | 46 | 47 | ls *.FAIL | while read failtest; do 48 | echo "Failing test: " $failtest > /dev/stderr 49 | runtest $failtest && echo "Test passed, please remove the '.FAIL' from the filename" 50 | done 51 | 52 | ls *.{css,js} | while read testfile; do 53 | runtest $testfile || exit 1 54 | done 55 | 56 | echo 57 | echo "now testing the JS port of CSSMIN..." 58 | ls *.css | while read testfile; do 59 | runtest $testfile "cssminjs" || exit 1 60 | done 61 | 62 | exit 0 63 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/webkit-transform.css: -------------------------------------------------------------------------------- 1 | c {-webkit-transform-origin: 0 0;} 2 | d {-MOZ-TRANSFORM-ORIGIN: 0 0 } -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/webkit-transform.css.min: -------------------------------------------------------------------------------- 1 | c{-webkit-transform-origin:0 0}d{-moz-transform-origin:0 0} -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/zeros.css: -------------------------------------------------------------------------------- 1 | a { 2 | margin: 0px 0pt 0em 0%; 3 | _padding-top: 0ex; 4 | background-position: 0 0; 5 | padding: 0in 0cm 0mm 0pc 6 | } 7 | -------------------------------------------------------------------------------- /tools/yuicompressor-2.4.6/tests/zeros.css.min: -------------------------------------------------------------------------------- 1 | a{margin:0;_padding-top:0;background-position:0 0;padding:0} --------------------------------------------------------------------------------