dialog.js.html 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: dialog.js</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Source: dialog.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>/**
  20. * A utility object for quickly and conveniently generating dialog boxes.
  21. * Unfortunately, this doesn't dynamically create new boxes; it reuses the same one
  22. * over and over again. It turns out dynamically generating new dialog boxes
  23. * is a pain! So we can't stack them.
  24. *
  25. * @constructor
  26. * @this {BlockPyDialog}
  27. * @param {Object} main - The main BlockPy instance
  28. * @param {HTMLElement} tag - The HTML object this is attached to.
  29. */
  30. function BlockPyDialog(main, tag) {
  31. this.main = main;
  32. this.tag = tag;
  33. this.titleTag = tag.find('.modal-title');
  34. this.bodyTag = tag.find('.modal-body');
  35. }
  36. /**
  37. * A simple externally available function for popping up a dialog
  38. * message. This menu will be draggable by its title.
  39. *
  40. * @param {String} title - The title of the message dialog. Can have HTML.
  41. * @param {String} body - The body of the message dialog. Can have HTML.
  42. * @param {function} onclose - A function to be run when the user closes the dialog.
  43. */
  44. BlockPyDialog.prototype.show = function(title, body, onclose) {
  45. this.titleTag.html(title);
  46. this.bodyTag.html(body);
  47. this.tag.modal('show');
  48. this.tag.draggable({
  49. 'handle': '.modal-title'
  50. });
  51. this.tag.on('hidden.bs.modal', function (e) {
  52. if (onclose !== undefined) {
  53. onclose();
  54. }
  55. });
  56. }</code></pre>
  57. </article>
  58. </section>
  59. </div>
  60. <nav>
  61. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BlockPy.html">BlockPy</a></li><li><a href="BlockPyCorgis.html">BlockPyCorgis</a></li><li><a href="BlockPyDialog.html">BlockPyDialog</a></li><li><a href="BlockPyEditor.html">BlockPyEditor</a></li><li><a href="BlockPyEngine.html">BlockPyEngine</a></li><li><a href="BlockPyEnglish.html">BlockPyEnglish</a></li><li><a href="BlockPyFeedback.html">BlockPyFeedback</a></li><li><a href="BlockPyHistory.html">BlockPyHistory</a></li><li><a href="BlockPyPresentation.html">BlockPyPresentation</a></li><li><a href="BlockPyPrinter.html">BlockPyPrinter</a></li><li><a href="BlockPyServer.html">BlockPyServer</a></li><li><a href="BlockPyToolbar.html">BlockPyToolbar</a></li><li><a href="LocalStorageWrapper.html">LocalStorageWrapper</a></li><li><a href="PythonToBlocks.html">PythonToBlocks</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BlockPyInterface">BlockPyInterface</a></li><li><a href="global.html#cloneNode">cloneNode</a></li><li><a href="global.html#encodeHTML">encodeHTML</a></li><li><a href="global.html#expandArray">expandArray</a></li><li><a href="global.html#EXTENDED_ERROR_EXPLANATION">EXTENDED_ERROR_EXPLANATION</a></li><li><a href="global.html#indent">indent</a></li><li><a href="global.html#instructor_module">instructor_module</a></li><li><a href="global.html#prettyPrintDateTime">prettyPrintDateTime</a></li><li><a href="global.html#randomInteger">randomInteger</a></li><li><a href="global.html#set_button_loaded">set_button_loaded</a></li><li><a href="global.html#timerGuard">timerGuard</a></li></ul>
  62. </nav>
  63. <br class="clear">
  64. <footer>
  65. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Mar 26 2017 09:45:03 GMT-0400 (Eastern Daylight Time)
  66. </footer>
  67. <script> prettyPrint(); </script>
  68. <script src="scripts/linenumber.js"> </script>
  69. </body>
  70. </html>