Skip to content

Instantly share code, notes, and snippets.

dojo.provide("plugd.layout");
(function(d){
var clsCache = {},
doit = function(part){
// do some mangling:
var dtype = part.type, kids = part.children;
if(!clsCache[dtype]){ clsCache[dtype] = d.getObject(dtype); }
if(part.id){ part.props.id = part.id; }
(function(bug){
buggyfunction = function(msg){
// summary: Alert some message.
// msg: String|Object
// If string, just show this message. If object,
// use obj.message for display, and hide
// obj.delay ms
var delay;
if(typeof msg == "string"){
(function(d){
// change to fit needs:
var acct = "UA-843203-1", page = "someIdentifier", delay = 300;
// won't need to change much (if any) below here:
var h = d.getElementsByTagName("head")[0], s = d.createElement("script");
s.src = ("https:" == d.location.protocol ? "https://ssl." : "http://www.")
+ "google-analytics.com/ga.js";
(function(d){
d.Timer = function(args){
// summary: The constructor function. Anytime we `new` up a Timer,
// this function is called, passing anything passed.
//
// example:
// | var x = new dojo.Timer({ a:b });
// | x.a == b // true
d.mixin(this, args);
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#baz {
border:8px solid #ededed;
padding:20px;
background:#ccc;
width:600px;
position:absolute;
(function(){
// normal ass object:
var obj = {
me:37
};
function mangler(arg, num){
// `arg` is literally `obj`
arg.me = num;
dojo.provide("dojotype._base.Number");
(function(d){
/*=====
dojo.Number = function(){
// summary: A series of prototype-extending Number functions.
// description:
// All the Math.* functions available in stock JavaScript
// applied to the Number prototype. Unfortunately, the
// syntax would be weird/bad/confusing:
<!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>
<!DOCTYPE html>
<html>
<head>
<title>SuperBasic Dojo Page</title>
<!-- load dojo from a CDN -->
<script src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js"></script>
<script>
// document is ready for DOM action
dojo.ready(function(){
<html>
<head>
<script>
var d = document, load = function(){
// sigh. IE && Opera fire case insensitive events. (ran == 2)
// FF && Safari are case sensitive. (ran == 1)
var ran = 0, runner = function(){
ran++;
}