Skip to content

Instantly share code, notes, and snippets.

@phiggins42
Created March 5, 2010 13:23
Show Gist options
  • Save phiggins42/322715 to your computer and use it in GitHub Desktop.
Save phiggins42/322715 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>SuperBasic Dojo Page with `plugd`</title>
<!-- load dojo from a CDN -->
<script src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js"></script>
<!-- load plugd from google SVN server -->
<script src="http://plugd.googlecode.com/svn/trunk/base.js"></script>
<script>
// setup the 'bling' ($)
dojo.conflict();
// document is ready for DOM action
$(document).ready(function(){
// find the <pre> tag
$("#content")
// put a notice before that node
.addContent("<p>Here is the source of this page:</p>", "before")
// pull in window.location content and mangle response data
.grab(window.location, {
load: function(data){
// so html-entities will print properly:
return data.replace(/</g, "&lt;")
}
})
// make the <pre> tage prettier. should just do this in css though.
.style({
backgroundColor:"#ededed",
border:"1px solid #666",
color:"#101010",
padding:"18px"
})
; // end of chain
// replace the header content:
$("#header").addContent("Hello, Dojo", "only");
});
</script>
</head>
<body>
<h1 id="header">Hello, World.</h1>
<pre id="content"></pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment