| 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 | <html><head> |
| 3 | <script src="../src/prettify.js"></script> |
| 4 | <script src="../src/lang-css.js"></script> |
| 5 | <style> |
| 6 | body { margin: 0; padding: 0 } |
| 7 | pre { margin: 0 } |
| 8 | </style> |
| 9 | </head> |
| 10 | <script> |
| 11 | // This page displays some code styled using a theme named in the |
| 12 | // query part of the URL. |
| 13 | var themeName = decodeURIComponent(document.location.search.replace(/^\?/, '')); |
| 14 | |
| 15 | // Call out to the parent so that it can resize the iframe once this |
| 16 | // document's body is loaded. |
| 17 | function adjustHeightInParent() { |
| 18 | if (parent !== window) { |
| 19 | try { |
| 20 | var div = document.body.getElementsByTagName('div')[0]; |
| 21 | parent.adjustChildIframeSize( |
| 22 | themeName, div.offsetWidth, div.offsetHeight); |
| 23 | } catch (ex) { |
| 24 | // Can happen when this page is opened in its own tab. |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // Load the necessary CSS |
| 30 | (function () { |
| 31 | document.title = 'Theme ' + themeName; |
| 32 | // Load the stylesheet that we're demoing. |
| 33 | var link = document.createElement('link'); |
| 34 | link.rel = 'stylesheet'; |
| 35 | link.type = 'text/css'; |
| 36 | link.href = themeName === 'default' |
| 37 | ? '../src/prettify.css' : themeName + '.css'; |
| 38 | document.getElementsByTagName('head')[0].appendChild(link); |
| 39 | })(); |
| 40 | </script> |
| 41 | |
| 42 | <body onload="prettyPrint(); adjustHeightInParent()"> |
| 43 | <div style="width: 40em; display: inline-block"> |
| 44 | <pre class="prettyprint lang-html linenums"> |
| 45 | <script type="text/javascript"> |
| 46 | // Say hello world until the user starts questioning |
| 47 | // the meaningfulness of their existence. |
| 48 | function helloWorld(world) { |
| 49 | for (var i = 42; --i >= 0;) { |
| 50 | alert('Hello ' + String(world)); |
| 51 | } |
| 52 | } |
| 53 | </script> |
| 54 | <style> |
| 55 | p { color: pink } |
| 56 | b { color: blue } |
| 57 | u { color: "umber" } |
| 58 | </style> |
| 59 | </pre> |
| 60 | </div> |
| 61 | </body></html> |