[483] | 1 | <?php |
---|
| 2 | |
---|
| 3 | // for this to work, the file api.html needs to be writable locally. pass a "?build" to |
---|
| 4 | // this url to trigger the generation. otherwise, work live from here. No JS ends up |
---|
| 5 | // in the output. api.css gets inlined in the output, making cheat.html standalone. |
---|
| 6 | |
---|
| 7 | $head = '<!DOCTYPE html> |
---|
| 8 | <html> |
---|
| 9 | <head> |
---|
| 10 | <title>API Overview - Dojo Toolkit</title> |
---|
| 11 | |
---|
| 12 | '; |
---|
| 13 | |
---|
| 14 | $foot = '</body></html>'; |
---|
| 15 | |
---|
| 16 | if(!empty($_POST['body'])){ |
---|
| 17 | |
---|
| 18 | $head .= "<style type='text/css'>" . file_get_contents("cheat/cheat.css") ."</style></head><body>"; |
---|
| 19 | $page = $head . $_POST['body'] . $foot; |
---|
| 20 | |
---|
| 21 | if(is_writable("./cheat.html")){ |
---|
| 22 | file_put_contents("./cheat.html", stripslashes($page)); |
---|
| 23 | }else{ |
---|
| 24 | header("HTTP", true, 500); |
---|
| 25 | print "Unwritable File: cheat.html"; |
---|
| 26 | } |
---|
| 27 | die; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | print $head; |
---|
| 31 | |
---|
| 32 | ?> |
---|
| 33 | |
---|
| 34 | <link rel="stylesheet" href="cheat/cheat.css"> |
---|
| 35 | |
---|
| 36 | <script type="text/javascript" src="../../dojo/dojo.js"></script> |
---|
| 37 | |
---|
| 38 | <script type="text/javascript"> |
---|
| 39 | dojo.require("util.docscripts.cheat.lib"); |
---|
| 40 | dojo.ready(function(){ |
---|
| 41 | |
---|
| 42 | // a list of things to ignore in the dojo namespace (either useless, or handled specially) |
---|
| 43 | var ap = util.docscripts.cheat.lib; |
---|
| 44 | |
---|
| 45 | if(ap.hasTag("excludePlugd")){ |
---|
| 46 | ap.ignore.push( |
---|
| 47 | // skip plugd api's for Dojo Base |
---|
| 48 | "pub", "sub", "unique", "first", "last", "end", "show", "hide", "toggle", |
---|
| 49 | "conflict", "animate", "wrap", "appendTo", "append", "hoverClass", "hover", |
---|
| 50 | "qw","generateId" |
---|
| 51 | ); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | // core Dojo stuff: |
---|
| 55 | if(!ap.hasTag("excludeDojo")){ |
---|
| 56 | ap.addIn("dojo"); |
---|
| 57 | ap.addIn("dojo.NodeList.prototype"); |
---|
| 58 | ap.addIn("dojo.fx", ap.getUl("Effects")); |
---|
| 59 | ap.addIn("dojo.Animation.prototype", ap.getUl("Effects")); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | if(!ap.hasTag("excludeKeys")){ |
---|
| 63 | var ul = ap.getUl("Key-Constants"); |
---|
| 64 | dojo.place("<li class='dblspan'>(dojo.keys.*)</li>", ul, "first"); |
---|
| 65 | ap.addIn("dojo.keys", ul); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | ap.addIn({ |
---|
| 69 | "djConfig": dojo.mixin({},{ |
---|
| 70 | parseOnLoad:false, |
---|
| 71 | requires:[] |
---|
| 72 | },dojo.config), |
---|
| 73 | "toString":function(){ return "djConfig" } |
---|
| 74 | }, ap.getUl("djConfig")); |
---|
| 75 | |
---|
| 76 | // fun quick way to pseudo-doc a tag |
---|
| 77 | // ap.addIn({ |
---|
| 78 | // "args":{ |
---|
| 79 | // "load":function(data, ioArgs){}, |
---|
| 80 | // "error":function(error){}, |
---|
| 81 | // "handle":function(dataOrError){}, |
---|
| 82 | // url:"", timeout: "" |
---|
| 83 | // }, |
---|
| 84 | // "toString":function(){ |
---|
| 85 | // // this is to trick the thing into introversion |
---|
| 86 | // return "args" |
---|
| 87 | // } |
---|
| 88 | // }, ap.getUl("Ajax")) |
---|
| 89 | |
---|
| 90 | if(ap.hasTag("includeColor")){ |
---|
| 91 | ap.addIn("dojo.Color.prototype", ap.getUl("Colors")); |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | var finish = function(){ |
---|
| 95 | ap.sortFields("container"); |
---|
| 96 | ap.buildNav(); |
---|
| 97 | ap.hasTag("build") && ap.save(); |
---|
| 98 | |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | if(ap.hasTag("includeDijit")){ |
---|
| 102 | dojo.require("dijit.dijit"); |
---|
| 103 | dojo.addOnLoad(function(){ |
---|
| 104 | |
---|
| 105 | ap.addIn("dijit._Widget.prototype", null, "dijit"); |
---|
| 106 | ap.addIn("dijit", null, "dijit"); |
---|
| 107 | ap.addIn("dijit._Templated.prototype", null, "dijit"); |
---|
| 108 | ap.addIn("dijit.WidgetSet.prototype", ap.getUl("Widget-Access")); |
---|
| 109 | ap.addIn("dijit.popup", ap.getUl("Widget-Control")); |
---|
| 110 | finish(); |
---|
| 111 | }); |
---|
| 112 | |
---|
| 113 | }else{ |
---|
| 114 | finish(); |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | dojo.connect(dojo.global, "onkeypress", function(e){ |
---|
| 118 | if(e.keyCode == dojo.keys.ESCAPE && e.ctrlKey){ |
---|
| 119 | ap.save(); |
---|
| 120 | } |
---|
| 121 | }); |
---|
| 122 | |
---|
| 123 | dojo.byId("version").innerHTML = dojo.version; |
---|
| 124 | |
---|
| 125 | }); |
---|
| 126 | </script> |
---|
| 127 | |
---|
| 128 | <body> |
---|
| 129 | <fieldset id="top"><div> |
---|
| 130 | <legend>Dojo API CheatSheet</legend> |
---|
| 131 | <ul id="nav"> |
---|
| 132 | <li><a href="#top">Top</a></li> |
---|
| 133 | </ul> |
---|
| 134 | <div id="key"> |
---|
| 135 | <fieldset> |
---|
| 136 | <legend>var</legend> |
---|
| 137 | <ul> |
---|
| 138 | <li>d = dojo,</li> |
---|
| 139 | <li>$ = d.query,</li> |
---|
| 140 | <li>dk = d.keys</li> |
---|
| 141 | </ul> |
---|
| 142 | </fieldset> |
---|
| 143 | </div> |
---|
| 144 | </div> |
---|
| 145 | </fieldset> |
---|
| 146 | <div id="container"></div> |
---|
| 147 | <span id="version"></span> |
---|
| 148 | </body> |
---|
| 149 | </html> |
---|