test_Loader.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <title>Dojo Visual Loader Test</title>
  6. <style type="text/css">
  7. @import "../../../dojo/resources/dojo.css";
  8. @import "../../../dijit/themes/tundra/tundra.css";
  9. @import "../../../dijit/themes/dijit.css";
  10. @import "../../../dijit/tests/css/dijitTests.css";
  11. @import "../Loader/Loader.css";
  12. </style>
  13. <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true"></script>
  14. <script type="text/javascript" src="../Loader.js"></script>
  15. <script type="text/javascript">
  16. // dojo.require("dojox.widget.Loader");
  17. dojo.require("dojo.parser"); // scan page for widgets and instantiate them
  18. function getHoney(){
  19. // simple xhrGet example
  20. var foo = dojo.xhrGet({
  21. url: '../Loader/honey.php?delay=0',
  22. handleAs: 'text',
  23. load: function(result){
  24. content.innerHTML = result;
  25. }
  26. });
  27. }
  28. function postHoney(){
  29. // simple xhrPost example
  30. var foo = dojo.xhrPost({
  31. url: '../Loader/honey.php?delay=0',
  32. handleAs: 'text',
  33. load: function(result){
  34. content.innerHTML = result;
  35. }
  36. });
  37. }
  38. function alertMe(){
  39. console.log('subscription fired',arguments);
  40. }
  41. var content = null;
  42. dojo.addOnLoad(function(){
  43. content = dojo.byId("dataholder");
  44. // FIXME: why aren't you working?
  45. // var foo = dojo.subscribe("Loader",null,"alertMe");
  46. // console.log(foo);
  47. });
  48. </script>
  49. </head>
  50. <body class="tundra">
  51. <div id="globalLoader" dojoType="dojox.widget.Loader"></div>
  52. <!-- Other examples:
  53. <div id="globalLoader" dojoType="dojox.widget.Loader" hasVisuals="false"></div>
  54. <div id="globalLoader" dojoType="dojox.widget.Loader" hasVisuals="true" attachToPointer="false"></div>
  55. -->
  56. <h1 class="testTitle">Dojox xhrListener test</h1>
  57. <a href="javascript:getHoney();">start xhrGet demo</a>
  58. <a href="javascript:postHoney();">start xhrPost demo</a>
  59. <p>No additional code is required except for the existance of a
  60. dojoType="dojox.widget.Loader" node. It will listen for the start
  61. and end of xhr* requests (via _ioSetArgs [ugh] and Deferred.prototype._fire ..
  62. </p>
  63. <br>
  64. <div id="dataholder" style="float:left; height:300px; overflow:auto; width:400px; border:1px solid #ccc; "></div>
  65. <!-- make me a scrollbar. a Taaaaaall scrollbar -->
  66. <div style="float:left; height:2000px; width:1px; overflow:hidden">spacer</div>
  67. </body>
  68. </html>