Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed Jul 3, 2009
0 parents commit bae98ca
Show file tree
Hide file tree
Showing 140 changed files with 2,674 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bzr/README
@@ -0,0 +1,3 @@
This is a Bazaar control directory.
Do not change any files in this directory.
See http://bazaar-vcs.org/ for more information about Bazaar.
1 change: 1 addition & 0 deletions .bzr/branch-format
@@ -0,0 +1 @@
Bazaar-NG meta directory, format 1
2 changes: 2 additions & 0 deletions .bzr/branch/branch.conf
@@ -0,0 +1,2 @@
bound_location = bzr+ssh://creationix/home/tim/code/haml_js/
bound = True
1 change: 1 addition & 0 deletions .bzr/branch/format
@@ -0,0 +1 @@
Bazaar Branch Format 6 (bzr 0.15)
1 change: 1 addition & 0 deletions .bzr/branch/last-revision
@@ -0,0 +1 @@
10 tim@beast-20090703042640-572k1iqdqz6ipyy5
Empty file added .bzr/branch/tags
Empty file.
1 change: 1 addition & 0 deletions .bzr/checkout/conflicts
@@ -0,0 +1 @@
BZR conflict list format 1
Binary file added .bzr/checkout/dirstate
Binary file not shown.
1 change: 1 addition & 0 deletions .bzr/checkout/format
@@ -0,0 +1 @@
Bazaar Working Tree Format 4 (bzr 0.15)
1 change: 1 addition & 0 deletions .bzr/repository/format
@@ -0,0 +1 @@
Bazaar pack repository format 1 (needs bzr 0.92)
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions .bzr/repository/indices/515e2e3f98f53846bbed4deb90737934.six
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=2
key_elements=2
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Bazaar Graph Index 1
node_ref_lists=0
key_elements=1
len=0

Binary file not shown.
Binary file added .bzr/repository/pack-names
Binary file not shown.
Binary file not shown.
Empty file added README
Empty file.
11 changes: 11 additions & 0 deletions app.js
@@ -0,0 +1,11 @@
function getparam(key, d) {
var value = window.location.href.match(new RegExp("[?&]"+key+"=([^&#]*)"));
return value ? value[1] : d;
}

$(function(){
$('head').append($(
'<link type="text/css" href="css/' + getparam("skin", "ui-darkness") +'/jquery-ui-1.7.2.custom.css" rel="stylesheet" />' +
'<script type="text/javascript" src="pages/' + getparam("page", "index") +'.js"></script>'
));
});
2 changes: 2 additions & 0 deletions config.ru
@@ -0,0 +1,2 @@

run File.new('.')
Binary file added css/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-bg_loop_25_000000_21x21.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-icons_222222_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-icons_4b8e0b_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-icons_a83300_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-icons_cccccc_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/dark-hive/images/ui-icons_ffffff_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
406 changes: 406 additions & 0 deletions css/dark-hive/jquery-ui-1.7.2.custom.css

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/sunny/images/ui-bg_flat_30_cccccc_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/sunny/images/ui-bg_flat_50_5c5c5c_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/sunny/images/ui-icons_3d3d3d_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/sunny/images/ui-icons_bd7b00_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/sunny/images/ui-icons_d19405_256x240.png
Binary file added css/sunny/images/ui-icons_eb990f_256x240.png
Binary file added css/sunny/images/ui-icons_ed9f26_256x240.png
Binary file added css/sunny/images/ui-icons_fadc7a_256x240.png
Binary file added css/sunny/images/ui-icons_ffe180_256x240.png
406 changes: 406 additions & 0 deletions css/sunny/jquery-ui-1.7.2.custom.css

Large diffs are not rendered by default.

406 changes: 406 additions & 0 deletions css/ui-darkness/jquery-ui-1.7.2.custom.css

Large diffs are not rendered by default.

406 changes: 406 additions & 0 deletions css/ui-lightness/jquery-ui-1.7.2.custom.css

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions jquery/jquery-1.3.2.min.js

Large diffs are not rendered by default.

298 changes: 298 additions & 0 deletions jquery/jquery-ui-1.7.2.custom.min.js

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions jquery/jquery.json-1.3.min.js
@@ -0,0 +1,37 @@

(function($){function toIntegersAtLease(n)
{return n<10?'0'+n:n;}
Date.prototype.toJSON=function(date)
{return this.getUTCFullYear()+'-'+
toIntegersAtLease(this.getUTCMonth())+'-'+
toIntegersAtLease(this.getUTCDate());};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};$.quoteString=function(string)
{if(escapeable.test(string))
{return'"'+string.replace(escapeable,function(a)
{var c=meta[a];if(typeof c==='string'){return c;}
c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};$.toJSON=function(o,compact)
{var type=typeof(o);if(type=="undefined")
return"undefined";else if(type=="number"||type=="boolean")
return o+"";else if(o===null)
return"null";if(type=="string")
{return $.quoteString(o);}
if(type=="object"&&typeof o.toJSON=="function")
return o.toJSON(compact);if(type!="function"&&typeof(o.length)=="number")
{var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i],compact));}
if(compact)
return"["+ret.join(",")+"]";else
return"["+ret.join(", ")+"]";}
if(type=="function"){throw new TypeError("Unable to convert object of type 'function' to json.");}
var ret=[];for(var k in o){var name;type=typeof(k);if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;var val=$.toJSON(o[k],compact);if(typeof(val)!="string"){continue;}
if(compact)
ret.push(name+":"+val);else
ret.push(name+": "+val);}
return"{"+ret.join(", ")+"}";};$.compactJSON=function(o)
{return $.toJSON(o,true);};$.evalJSON=function(src)
{return eval("("+src+")");};$.secureEvalJSON=function(src)
{var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};})(jQuery);
214 changes: 214 additions & 0 deletions js/common_widgets.js
@@ -0,0 +1,214 @@
// requires jquery-ui

// Test an object for it's constructor type. Sort of a reverse, discriminatory instanceof
function isTypeOf(t, c){ if (t === undefined) {return 'undefined';} return t.constructor.toString().match(new RegExp(c, 'i')) !== null; }


function each(obj, fn)
{
if (isTypeOf(obj, "Array"))
{
for (i in obj) {
fn(i, obj[i]);
}
}
else {
for (var k in obj) {
if (obj.hasOwnProperty(k)) {
fn(k, obj[k]);
}
}
}
return obj;
}

function trace(message, obj)
{
console.log(message, obj);
return obj;
}

function collect(obj, fn)
{
var accum = [];
each(obj, function(i,v){ accum.push(fn(i,v)); });
return accum;
}

function inspect(data, limit) {
if (limit === undefined) {
limit = 5;
}
if (limit <= 0) {return "...";}
if (isTypeOf(data, "Array")) {
var accum = ["ul"];
each(data, function(k,v){ accum.push(["li", inspect(v, limit-1)]); });
return accum;
}
else if (isTypeOf(data, "String")) {
return '"'+data.replace(/\"/g,'\\"').replace(/\t/g,'\\t').replace(/\n/g,'\\n')+'"';
}
else if (isTypeOf(data, "Object")) {
var accum = ["dl"];
each(data, function(k,v){
accum.push(["dt", k+":"]);
accum.push(["dd", inspect(v, limit-1)]);
});
return accum;
}
else {
return data+"";
}
}


function small_header(options, content)
{
return ["p.ui-state-default ui-corner-all", {
style: "padding:4px;margin: 10px 0"
},
["span.ui-icon.ui-icon-" + options.icon, {style: "float:left; margin:-2px 5px 0 0;" }],
content
];
}

function button(options, content)
{
return ["button.ui-state-default ui-button ui-corner-all", {
style:"float: left; margin: 0 5px; line-height:13px;",
$:{bind:["click", options.callback]}
},
["span.ui-icon.ui-icon-" + options.icon, {style: "float:left; margin:-2px 3px -2px -2px;" }],
content
];
}

// Options:
//
// title - the title of the dialoc
// callback - a function called with true or false
//
function confirmation_dialog(options, content)
{
return ["div", {
title: options.title,
$:{dialog: [{
bgiframe: true,
resizable: false,
modal: true,
buttons: {
Ok: function() {
jQuery(this).dialog('close');
options.callback(true);
},
Cancel: function() {
jQuery(this).dialog('close');
options.callback(false);
}
},
close: function() {
$(this).remove();
}
}]}
}, ["p",
["span.ui-icon ui-icon-alert", {style:"float:left; margin:0 7px 20px 0;"}],
content
]
];
}


// Options:
//
// title - dialog title
// w - dialog width
// h - dialog content height
function inline_dialog(options, content)
{
return ["div", {
title: options.title,
$:{dialog: [{
bgiframe: true,
height: 29+options.h,
width: options.w,
modal: true,
resizable: true,
close: function(e){
$(this).remove();
if (options.close) {
options.close(e);
}
}
}]}
},
content
];
}

// Meta example:
// {
// name: {type:"text"},
// description: {type:"textarea",title:"Long Description"}
// }
// Data is reference to actual data store.
function form_builder(meta, data, notify)
{
var disabled;
if (notify === undefined)
{
disabled = true;
notify = function(){};
}
return collect(meta, function(name, options) {
if (!options.label) {
options.label = name.charAt(0).toUpperCase() + name.substr(1).toLowerCase();
}
var content;
switch (options.type) {
case "textarea":
content = ["textarea.ui-widget-content ui-corner-all", {
style:"width:250px;padding:5px;margin:2px 15px;height:100px",
name:name,
$:{
bind:["keyup", function(e){data[name]=this.value;notify(name);}],
$: function() { if (disabled){this.attr("disabled", "disabled").addClass('ui-state-disabled');} }
}
}, data[name]];
break;
case "slider":
content = ["div", {style: "width:260px; margin:15px;", $:{
slider: [{
value: data[name],
change: function(event, ui) { data[name] = ui.value;notify(name); },
}],
$: function() { if (disabled){this.slider('disable');} }
}}];
break;
case "eq":
content = [".clearfix", collect(data[name], function(i,v){
return ["div", {_: {height: "120px", "float": "left", margin: "15px"}, $:{
slider: [{
value: v,
range:"min",
orientation:"vertical",
change: function(event, ui) { data[name][i] = ui.value;notify(name); }
}],
$: function() { if (disabled){this.slider('disable');} }
}}
];
})];
break;
default:
content = ["input.ui-widget-content ui-corner-all", {
style:"padding:5px;width:250px;margin:2px 15px",
name:name,
value:data[name],
$:{
bind:["keyup", function(e){data[name] = this.value;notify(name);}],
$: function() { if (disabled){this.attr("disabled", "disabled").addClass('ui-state-disabled');} }
}}];
break;
}
return [["p", {style:"font-weight:bold;"}, options.label], content];
});
}

0 comments on commit bae98ca

Please sign in to comment.