File a bug | Instructions | Multiple Gadgets
Enter HTML into the textarea. Contents of <style>
and
<script>
elements are extracted. The rest is treated
as HTML and emitted normally.
Any Cajoler warnings are displayed in the top section.
The script and styles are rewritten and the rewritten gadget is displayed in pretty printed form in the middle section to the right.
The last expression in the program is logged in the bottom section, and emitted HTML is displayed below that.
Example:
<!-- Styles are displayed --> <style> p { color: purple } </style> <!-- Scripts are executed --> <script> 2 + 2 // You should see a missing semicolon warning too! </script> <!-- Regular HTML is emitted --> <p>Hello World</p>
A module can export a public API by attaching fields to the
exports
object.
<p id=message>Hello World</p> <script> exports.sayBye = function () { document.getElementById('message').innerHTML = 'Bye'; }; </script>
So that other modules can load and call them.
<script>loadModule('gadget.1').sayBye();</script>
You can log messages to the Firebug console by using
cajita.log
:
<script>cajita.log('Hello World');</script>
You can have all URLs passed through a proxy server if you like.
This is necessary for images in HTML to work. Start the proxy
server running, and load this page with
?backend=http://<your-machine>:<port>
appended to the URL.
<img src="http://www.google.com/intl/en_ALL/images/logo.gif">