Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed old terminal code.

  • Loading branch information...
commit f5eb255cca981c122c6a707cba6a5be87b1fb5ff 1 parent e047e70
@toddsundsted authored
View
1  files/public/css/moo-0.0.3.min.css
@@ -1 +0,0 @@
-.simple-object-panel .object-summary{padding:5px 0;background-color:#0a0605;background-color:#c5c0cd;background-color:#3d3d55;background:#3f4c6b;background:-moz-linear-gradient(top,#3f4c6b 0,#606c88 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#3f4c6b),color-stop(100%,#606c88));background:-webkit-linear-gradient(top,#3f4c6b 0,#606c88 100%);background:-o-linear-gradient(top,#3f4c6b 0,#606c88 100%);background:-ms-linear-gradient(top,#3f4c6b 0,#606c88 100%);background:linear-gradient(top,#3f4c6b 0,#606c88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#3f4c6b',endColorstr='#606c88',GradientType=0);background:#606c88;background:-moz-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#606c88),color-stop(100%,#3f4c6b));background:-webkit-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:-o-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:-ms-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:linear-gradient(top,#606c88 0,#3f4c6b 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#606c88',endColorstr='#3f4c6b',GradientType=0);border:1px solid #000;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;-moz-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.5);-webkit-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.5);box-shadow:inset 1px 1px 1px rgba(0,0,0,0.5)}.simple-object-panel .object-summary h1{font-size:48px;line-height:48px;color:#ff9b00;color:#1b1e21;color:#fff;text-shadow:1px 1px 2px #000;filter:dropshadow(color=#000,offx=1,offy=1)}.simple-object-panel .object-summary .flag,.simple-object-panel .object-summary .flag-container{font-size:16px;line-height:16px;color:#fff;text-align:right;margin:5px 0}.simple-object-panel .object-summary .flag .disabled,.simple-object-panel .object-summary .flag-container .disabled{color:#6d6d98}.simple-object-panel .object-summary .parents{font-size:20px;line-height:20px;color:#fff;margin:16px 0 5px 0}.simple-object-panel .object-summary .access-level{font-size:36px;line-height:24px;float:left;color:#fff;margin:10px 0 0 10px;text-shadow:1px 1px 2px #000;filter:dropshadow(color=#000,offx=1,offy=1)}.simple-object-panel .object-details td .owner{display:inline-block;width:50px}.simple-object-panel .object-details td .perms{display:inline-block;width:50px}.simple-object-panel table.table{table-layout:fixed}.simple-object-panel table.table tr.invalid{color:#aaa}.simple-object-panel .help-and-information .alert{margin:10px 0;background-color:#c5c0cd;border-color:#8786a7;color:#3f4c6b}.simple-object-panel .ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.simple-object-panel .modal{width:800px;margin:-250px 0 0 -400px}.simple-object-panel .modal .textarea{white-space:pre;word-break:normal;word-wrap:normal;overflow-x:auto}#JavascriptSocket{position:absolute;top:-1000px}.command-panel .top,.command-panel .bottom{font-family:monospace;line-height:1.25em;width:100%;clear:both}.command-panel .input,.command-panel .output{white-space:pre}.command-panel .input{background-color:#eee}.command-panel .output{background-color:#fff}.command-panel .bottom{height:2em;background-color:#ddd}.command-panel .bottom input{width:100%;height:100%;background-color:transparent;font-family:monospace;border:0;margin:0;padding:0}
View
76 files/public/css/moo-0.0.3.css → files/public/css/moo-0.0.4.css
@@ -3,29 +3,16 @@
.simple-object-panel .object-summary {
padding: 5px 0;
- background-color: #0a0605;
- background-color: #c5c0cd;
- background-color: #3d3d55;
-
-background: #3f4c6b;
-background: -moz-linear-gradient(top, #3f4c6b 0%, #606c88 100%);
-background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3f4c6b), color-stop(100%,#606c88));
-background: -webkit-linear-gradient(top, #3f4c6b 0%,#606c88 100%);
-background: -o-linear-gradient(top, #3f4c6b 0%,#606c88 100%);
-background: -ms-linear-gradient(top, #3f4c6b 0%,#606c88 100%);
-background: linear-gradient(top, #3f4c6b 0%,#606c88 100%);
-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3f4c6b', endColorstr='#606c88', GradientType=0);
-
-background: #606c88;
-background: -moz-linear-gradient(top, #606c88 0%, #3f4c6b 100%);
-background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#606c88), color-stop(100%,#3f4c6b));
-background: -webkit-linear-gradient(top, #606c88 0%,#3f4c6b 100%);
-background: -o-linear-gradient(top, #606c88 0%,#3f4c6b 100%);
-background: -ms-linear-gradient(top, #606c88 0%,#3f4c6b 100%);
-background: linear-gradient(top, #606c88 0%,#3f4c6b 100%);
-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#606c88', endColorstr='#3f4c6b', GradientType=0);
-
- border: 1px solid #000; /*rgba(0, 0, 0, 0.05);*/
+ background: #606c88;
+ background: -moz-linear-gradient(top, #606c88 0%, #3f4c6b 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#606c88), color-stop(100%,#3f4c6b));
+ background: -webkit-linear-gradient(top, #606c88 0%,#3f4c6b 100%);
+ background: -o-linear-gradient(top, #606c88 0%,#3f4c6b 100%);
+ background: -ms-linear-gradient(top, #606c88 0%,#3f4c6b 100%);
+ background: linear-gradient(top, #606c88 0%,#3f4c6b 100%);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#606c88', endColorstr='#3f4c6b', GradientType=0);
+
+ border: 1px solid #000;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
@@ -40,12 +27,10 @@ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#606c88', endC
font-size: 48px;
line-height: 48px;
- color: #ff9b00;
- color: #1b1e21;
color: #fff;
-text-shadow: 1px 1px 2px #000;
-filter: dropshadow(color=#000, offx=1, offy=1);
+ text-shadow: 1px 1px 2px #000;
+ filter: dropshadow(color=#000, offx=1, offy=1);
}
.simple-object-panel .object-summary .flag, .simple-object-panel .object-summary .flag-container {
@@ -130,40 +115,3 @@ filter: dropshadow(color=#000, offx=1, offy=1);
position: absolute;
top: -1000px;
}
-
-.command-panel {
-}
-
-.command-panel .top, .command-panel .bottom {
- font-family: monospace;
- line-height: 1.25em;
- width: 100%;
- clear: both;
-}
-
-.command-panel .input, .command-panel .output {
- white-space: pre;
-}
-
-.command-panel .input {
- background-color: #eee;
-}
-
-.command-panel .output {
- background-color: #fff;
-}
-
-.command-panel .bottom {
- height: 2em;
- background-color: #ddd;
-}
-
-.command-panel .bottom input {
- width: 100%;
- height: 100%;
- background-color: transparent;
- font-family: monospace;
- border: 0;
- margin: 0;
- padding: 0;
-}
View
1  files/public/css/moo-0.0.4.min.css
@@ -0,0 +1 @@
+.simple-object-panel .object-summary{padding:5px 0;background:#606c88;background:-moz-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#606c88),color-stop(100%,#3f4c6b));background:-webkit-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:-o-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:-ms-linear-gradient(top,#606c88 0,#3f4c6b 100%);background:linear-gradient(top,#606c88 0,#3f4c6b 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#606c88',endColorstr='#3f4c6b',GradientType=0);border:1px solid #000;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;-moz-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.5);-webkit-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.5);box-shadow:inset 1px 1px 1px rgba(0,0,0,0.5)}.simple-object-panel .object-summary h1{font-size:48px;line-height:48px;color:#fff;text-shadow:1px 1px 2px #000;filter:dropshadow(color=#000,offx=1,offy=1)}.simple-object-panel .object-summary .flag,.simple-object-panel .object-summary .flag-container{font-size:16px;line-height:16px;color:#fff;text-align:right;margin:5px 0}.simple-object-panel .object-summary .flag .disabled,.simple-object-panel .object-summary .flag-container .disabled{color:#6d6d98}.simple-object-panel .object-summary .parents{font-size:20px;line-height:20px;color:#fff;margin:16px 0 5px 0}.simple-object-panel .object-summary .access-level{font-size:36px;line-height:24px;float:left;color:#fff;margin:10px 0 0 10px;text-shadow:1px 1px 2px #000;filter:dropshadow(color=#000,offx=1,offy=1)}.simple-object-panel .object-details td .owner{display:inline-block;width:50px}.simple-object-panel .object-details td .perms{display:inline-block;width:50px}.simple-object-panel table.table{table-layout:fixed}.simple-object-panel table.table tr.invalid{color:#aaa}.simple-object-panel .help-and-information .alert{margin:10px 0;background-color:#c5c0cd;border-color:#8786a7;color:#3f4c6b}.simple-object-panel .ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.simple-object-panel .modal{width:800px;margin:-250px 0 0 -400px}.simple-object-panel .modal .textarea{white-space:pre;word-break:normal;word-wrap:normal;overflow-x:auto}#JavascriptSocket{position:absolute;top:-1000px}
View
80 files/public/js/moo-0.0.3.js → files/public/js/moo-0.0.4.js
@@ -569,84 +569,4 @@ if (!window.Moo && !document.Moo)
this.element.html('');
}
});
-
- $.widget('moo.commandPanel', {
-
- options: {
- host: 'localhost',
- port: 8888
- },
-
- _setOption: function(key, value) {
- },
-
- _create: function() {
- var widget = this;
-
- widget.output = $('<div class="top"></div>');
- widget.input = $('<div class="bottom"><input type="text"></div>');
- var panel = $('<div class="command-panel"></div>');
- panel.append(widget.output);
- panel.append(widget.input);
- widget.element.append(panel);
-
- var print = function(direction, text) {
- var $this = widget.output;
- var $last = $this.children(':last');
- if (!$last.hasClass(direction)) {
- $last = $("<div class='" + direction + "'></div>");
- $this.append($last);
- }
- $last.text($last.text() + text);
- widget.input.get(0).scrollIntoView(false);
- };
-
- var history = [];
- var position = -1;
-
- $('input', widget.input).keypress(function(event) {
- var text;
- if (event.which == 13) {
- if ((text = $(this).val())) {
- event.preventDefault();
- history.unshift(text);
- position = -1;
- text = text + '\n';
- print('input', text);
- interactive.send(text);
- $(this).val('');
- }
- }
- });
- $('input', widget.input).keyup(function(event) {
- var text;
- if (event.which == 38) {
- if ((text = history[position + 1])) {
- $(this).val(text);
- position++;
- }
- }
- else if (event.which == 40) {
- if ((text = history[position - 1])) {
- $(this).val(text);
- position--;
- }
- }
- });
-
- var interactive = new Moo.Interactive(widget.options.host, widget.options.port, {
- callback: function(text) {
- print('output', text);
- }
- });
- },
-
- _init: function() {
- },
-
- destroy: function() {
- this.element.html('');
- }
- });
-
})(Moo);
View
2  files/public/js/moo-0.0.3.min.js → files/public/js/moo-0.0.4.min.js
@@ -1 +1 @@
-if(!window.Moo&&!document.Moo){Moo={}}(function(a){function c(g,h){return g.indexOf(h,g.length-h.length)!==-1}a.formatHTML=function(i,h){if(_.isNumber(i)){return'<span class="moo-num">'+i+"</span>"}else{if(_.isString(i)){var j,g;if(c(i,"|err")){j=_.escape(i.slice(0,i.length-4));return'<span class="moo-err">'+j+"</span>"}else{if(c(i,"|obj")){j=_.escape(i.slice(0,i.length-4));g=_.escape(i.slice(0,i.length-4).slice(1));return'<a rel="object" data-object-number="'+g+'" class="moo-obj" href="/objects/'+g+'">'+j+"</a>"}else{if(c(i,"|int")){j=_.escape(i.slice(0,i.length-4));return'<span class="moo-num">'+j+"</span>"}else{if(c(i,"|float")){j=_.escape(i.slice(0,i.length-6));return'<span class="moo-num">'+j+"</span>"}else{if(c(i,"|str")){j=i.slice(0,i.length-4);return'<span class="moo-str">'+_.escape(h?'"'+j.replace(/"/gm,'\\"')+'"':j)+"</span>"}else{j=i;return'<span class="moo-str">'+_.escape(h?'"'+j.replace(/"/gm,'\\"')+'"':j)+"</span>"}}}}}}else{if(_.isArray(i)){return'<span class="moo-list">{ '+_.map(i,function(k){return a.formatHTML(k,true)}).join(", ")+" }</span>"}else{if(_.isObject(i)){return'<span class="moo-map">[ '+_.map(i,function(m,l){return a.formatHTML(l,true)+" -> "+a.formatHTML(m,true)}).join(", ")+" ]</span>"}}}}};_.extend(a,{isString:function(g){return typeof(g)=="string"&&!(c(g,"|obj")||c(g,"|err"))},isObjectNumber:function(g){return typeof(g)=="string"&&c(g,"|obj")},isError:function(g){return typeof(g)=="string"&&c(g,"|err")},isBinary:function(g){return g===0||g===1},isValidPerms:function(g,h){return typeof(g)=="string"&&g.match("^["+h+"]*$")},isValidObj:function(g){return _.include(["this","none","any"],g)},isValidPrep:function(h){var g=["with","using","at","to","in front of","in","inside","into","on top of","on","onto","upon","out of","from inside","from","over","through","under","underneath","beneath","behind","beside","for","about","is","as","off","off of","none","any"];return _.include(g,h)},isValidCode:function(g){return _.isArray(g)&&_.all(g,a.isString)},isValidObjectNumberArray:function(g){return _.isArray(g)&&_.all(g,a.isObjectNumber)}});a.NestedModel=Backbone.Model.extend({initialize:function(g){},has:function(h){var g=this.get(h);return !(g===null||g===undefined)},get:function(g,i){i=i||{};var k=g.split("."),h=k.shift();var j=Backbone.Model.prototype.get.call(this,h,i);_.each(k,function(l){j=j!=undefined&&(l in j)?j[l]:undefined});return j},set:function(i,k,j){var h;if(_.isObject(i)){h=i;j=k}else{h={};h[i]=k}j=j||{};var g=_.inject(this.attributes,function(l,n,m){l[m]=_.clone(n);return l},{});_.each(h,function(o,l){var q=l.split("."),m=q.shift();var p=g,n=m;_.each(q,function(r){if(!(n in p)){p[n]={}}p=p[n];n=r});p[n]=o});return Backbone.Model.prototype.set.call(this,g,j)}});a.Attribute=a.NestedModel.extend({validate:function(g){if(g&&"Value" in g&&(typeof(g.Value)!="object")){return"invalid attribute"}}});a.Value=a.NestedModel.extend({validate:function(g){if(g&&"Value" in g&&(typeof(g.Value)!="object")){return"invalid value"}if(g&&"Value" in g&&"clear" in g.Value&&!a.isBinary(g.Value.clear)){return"invalid value: `clear' must be 0 or 1"}},isReadable:function(){return this.get("Meta.status")=="readable"},isWritable:function(){return this.get("Meta.status")=="writable"},isDenied:function(){return this.get("Meta.status")=="denied"}});function f(g){return a.Value.generate(g)}function e(g){return function(h){var i=g+" ";return i+a.Value.generate(h,i)}}function d(h,g){return a.Value.generate(g)+" -> "+a.Value.generate(h)}function b(g){return function(i,h){var j=g+" ";return j+a.Value.generate(h,j)+" -> "+a.Value.generate(i,j)}}a.Value.generate=function(h,g){var i=g;if(g!=undefined){g=(g!==true)?g:"";i=g+" "}if(h!=undefined&&h!=null){if(typeof(h)=="string"){if(c(h,"|err")){return h.slice(0,h.length-4)}else{if(c(h,"|obj")){return h.slice(0,h.length-4)}else{if(c(h,"|int")){return h.slice(0,h.length-4)}else{if(c(h,"|float")){return h.slice(0,h.length-6)}else{if(c(h,"|str")){return JSON.stringify(h.slice(0,h.length-4))}else{return JSON.stringify(h)}}}}}}else{if(_.isArray(h)&&g!=undefined){return"{\n"+_.chain(h).map(e(g)).join(",\n").value()+"\n"+g+"}"}else{if(_.isArray(h)){return"{"+_.chain(h).map(f).join(", ").value()+"}"}else{if(_.isObject(h)&&g!=undefined){return"[\n"+_.chain(h).map(b(g)).join(",\n").value()+"\n"+g+"]"}else{if(_.isObject(h)){return"["+_.chain(h).map(d).join(", ").value()+"]"}}}}}return h.toString()}return undefined};a.Property=a.NestedModel.extend({validate:function(g){if(g&&"Property" in g&&(typeof(g.Property)!="object")){return"invalid property"}if(g&&"Property" in g&&"name" in g.Property&&!a.isString(g.Property.name)){return"invalid property: `name' must be a string"}if(g&&"Property" in g&&"owner" in g.Property&&!a.isObjectNumber(g.Property.owner)){return"invalid property: `owner' must be an object number"}if(g&&"Property" in g&&"perms" in g.Property&&!a.isValidPerms(g.Property.perms,"rwc")){return"invalid property: `perms' must be in the set 'rwc'"}},isReadable:function(){return this.get("Meta.status")=="readable"},isWritable:function(){return this.get("Meta.status")=="writable"},isDenied:function(){return this.get("Meta.status")=="denied"}});a.Verb=a.NestedModel.extend({validate:function(g){if(g&&"Verb" in g&&(typeof(g.Verb)!="object")){return"invalid verb"}if(g&&"Verb" in g&&"names" in g.Verb&&!a.isString(g.Verb.names)){return"invalid verb: `names' must be a string"}if(g&&"Verb" in g&&"owner" in g.Verb&&!a.isObjectNumber(g.Verb.owner)){return"invalid verb: `owner' must be an object number"}if(g&&"Verb" in g&&"perms" in g.Verb&&!a.isValidPerms(g.Verb.perms,"rwxd")){return"invalid verb: `perms' must be in the set 'rwxd'"}if(g&&"Verb" in g&&"dobj" in g.Verb&&!a.isValidObj(g.Verb.dobj)){return"invalid verb: `dobj' must be valid"}if(g&&"Verb" in g&&"prep" in g.Verb&&!a.isValidPrep(g.Verb.prep)){return"invalid verb: `prep' must be valid"}if(g&&"Verb" in g&&"iobj" in g.Verb&&!a.isValidObj(g.Verb.iobj)){return"invalid verb: `iobj' must be valid"}if(g&&"Verb" in g&&"code" in g.Verb&&!a.isValidCode(g.Verb.code)){return"invalid verb: `code' must be an array of strings"}},isReadable:function(){return this.get("Meta.status")=="readable"},isWritable:function(){return this.get("Meta.status")=="writable"},isDenied:function(){return this.get("Meta.status")=="denied"}});a.Collection=Backbone.Collection.extend({add:function(i,h){i=_.isArray(i)?i.slice():[i];var g=this instanceof a.Attributes||this instanceof a.Values;i=_.chain(i).map(function(j){if(!("id" in j)){if(g){return _.map(j,function(m,l){m.id=l;return m})}else{j.id=i.length;return j}}return j}).flatten().value();return Backbone.Collection.prototype.add.call(this,i,h)}});a.Attributes=a.Collection.extend({model:a.Attribute});a.Values=a.Collection.extend({model:a.Value});a.Properties=a.Collection.extend({model:a.Property});a.Verbs=a.Collection.extend({model:a.Verb});a.Object=Backbone.Model.extend({urlRoot:"///objects",initialize:function(){this.attributez=new a.Attributes;this.attributez.url=this.url()+"/attributes";this.values=new a.Values;this.values.url=this.url()+"/values";this.properties=new a.Properties;this.properties.url=this.url()+"/properties";this.verbs=new a.Verbs;this.verbs.url=this.url()+"/verbs";this.parse(this.attributes)},validate:function(g){var h,i;if((h=this.attributez.get("player"))&&!a.isBinary(h.get("Value.value"))){return"invalid attribute: `player' must be 0 or 1"}if((h=this.attributez.get("parents"))&&!a.isValidObjectNumberArray(h.get("Value.value"))){return"invalid attribute: `parents' must be an array of object numbers"}if((i=this.values.get("name"))&&!a.isString(i.get("Value.value"))){return"invalid value: `name' must be a string"}if((i=this.values.get("owner"))&&!a.isObjectNumber(i.get("Value.value"))){return"invalid value: `owner' must be an object number"}if((i=this.values.get("location"))&&!a.isObjectNumber(i.get("Value.value"))){return"invalid value: `location' must be an object number"}if((i=this.values.get("contents"))&&!a.isValidObjectNumberArray(i.get("Value.value"))){return"invalid value: `contents' must be an array of object numbers"}if((i=this.values.get("programmer"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `programmer' must be 0 or 1"}if((i=this.values.get("wizard"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `wizard' must be 0 or 1"}if((i=this.values.get("r"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `r' must be 0 or 1"}if((i=this.values.get("w"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `w' must be 0 or 1"}if((i=this.values.get("f"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `f' must be 0 or 1"}},parse:function(h){var l=function(m,o,n){o.id=n;m.push(o);return m};var j=h.Attributes;delete h.Attributes;this.attributez.reset(j);var g=h.Values;delete h.Values;this.values.reset(g);var i=h.Properties;delete h.Properties;this.properties.reset(_.chain(i).reduce(l,[]).value());var k=h.Verbs;delete h.Verbs;this.verbs.reset(_.chain(k).reduce(l,[]).value());if("Meta" in h&&"id" in h.Meta){this.id=h.Meta.id}return h},fetch:function(i){i=i?_.clone(i):{};var h=this;var g=i.error;i.error=function(j,k){j.httpResponseStatus=k.status;if(g){g(j,k)}};return Backbone.Model.prototype.fetch.call(this,i)},failed:function(){return this.httpResponseStatus>=300},isNotFound:function(){return this.httpResponseStatus==404},isDenied:function(){return this.httpResponseStatus==403},isReadable:function(){var g;return(g=this.get("Meta"))&&g.status=="readable"},isWritable:function(){var g;return(g=this.get("Meta"))&&g.status=="writable"},toJSON:function(){var g=function(h,j,i){h[j.id]=j;delete j.id;return h};return{Attributes:_.chain(this.attributez.toJSON()).reduce(g,{}).value(),Values:_.chain(this.values.toJSON()).reduce(g,{}).value(),Properties:this.properties.toJSON(),Verbs:this.verbs.toJSON()}}});a.Objects=Backbone.Collection.extend({model:a.Object,url:"///objects"});$.widget("moo.simpleObjectPanel",{options:{template:null,object:null},_setOption:function(g,h){switch(g){case"object":this.options.object=h;this._render();break;case"template":this.options.template=_.template(h);this._render();break}},_render:function(){if(this.options.object&&this.options.template){this.element.html(this.options.template({object:this.options.object}))}},_modal:{show:function(h,i,g){$("h3",h).text(i);$(".textarea",h).text(g);h.modal("show")},resetSelection:function(){if(window.getSelection){window.getSelection().removeAllRanges()}else{if(document.selection){document.selection.empty()}}}},_create:function(){var g=this;if(!this.options.template){$.get("/html/moo-0.0.3.html",function(h){g.options.template=_.template(h);g._render()})}this.element.on("dblclick","tr.value.readable, tr.value.writable",function(m){var k=g.options.object,j=$(".modal",g.element),h=$(m.target).parents("tr"),i=h.data("id"),l=a.Value.generate(k.values.get(i).get("Value.value"),true);g._modal.show(j,i,l);g._modal.resetSelection()});this.element.on("dblclick","tr.property.readable, tr.property.writable",function(l){var j=g.options.object,i=$(".modal",g.element),h=$(l.target).parents("tr"),n=h.data("id"),k=a.Value.generate(j.properties.get(n).get("Property.value"),true),m=j.properties.get(n).get("Property.name");g._modal.show(i,m,k);g._modal.resetSelection()});this.element.on("dblclick","tr.verb.readable, tr.verb.writable",function(l){var j=g.options.object,i=$(".modal",g.element),h=$(l.target).parents("tr"),n=h.data("id"),k=j.verbs.get(n).get("Verb.code").join("\n"),m=j.verbs.get(n).get("Verb.names");g._modal.show(i,m,k);g._modal.resetSelection()})},_init:function(){this._render()},destroy:function(){this.element.html("")}});$.widget("moo.commandPanel",{options:{host:"localhost",port:8888},_setOption:function(g,h){},_create:function(){var k=this;k.output=$('<div class="top"></div>');k.input=$('<div class="bottom"><input type="text"></div>');var h=$('<div class="command-panel"></div>');h.append(k.output);h.append(k.input);k.element.append(h);var j=function(o,p){var n=k.output;var m=n.children(":last");if(!m.hasClass(o)){m=$("<div class='"+o+"'></div>");n.append(m)}m.text(m.text()+p);k.input.get(0).scrollIntoView(false)};var l=[];var g=-1;$("input",k.input).keypress(function(m){var n;if(m.which==13){if((n=$(this).val())){m.preventDefault();l.unshift(n);g=-1;n=n+"\n";j("input",n);i.send(n);$(this).val("")}}});$("input",k.input).keyup(function(m){var n;if(m.which==38){if((n=l[g+1])){$(this).val(n);g++}}else{if(m.which==40){if((n=l[g-1])){$(this).val(n);g--}}}});var i=new a.Interactive(k.options.host,k.options.port,{callback:function(m){j("output",m)}})},_init:function(){},destroy:function(){this.element.html("")}})})(Moo);
+if(!window.Moo&&!document.Moo){Moo={}}(function(a){function c(g,h){return g.indexOf(h,g.length-h.length)!==-1}a.formatHTML=function(i,h){if(_.isNumber(i)){return'<span class="moo-num">'+i+"</span>"}else{if(_.isString(i)){var j,g;if(c(i,"|err")){j=_.escape(i.slice(0,i.length-4));return'<span class="moo-err">'+j+"</span>"}else{if(c(i,"|obj")){j=_.escape(i.slice(0,i.length-4));g=_.escape(i.slice(0,i.length-4).slice(1));return'<a rel="object" data-object-number="'+g+'" class="moo-obj" href="/objects/'+g+'">'+j+"</a>"}else{if(c(i,"|int")){j=_.escape(i.slice(0,i.length-4));return'<span class="moo-num">'+j+"</span>"}else{if(c(i,"|float")){j=_.escape(i.slice(0,i.length-6));return'<span class="moo-num">'+j+"</span>"}else{if(c(i,"|str")){j=i.slice(0,i.length-4);return'<span class="moo-str">'+_.escape(h?'"'+j.replace(/"/gm,'\\"')+'"':j)+"</span>"}else{j=i;return'<span class="moo-str">'+_.escape(h?'"'+j.replace(/"/gm,'\\"')+'"':j)+"</span>"}}}}}}else{if(_.isArray(i)){return'<span class="moo-list">{ '+_.map(i,function(k){return a.formatHTML(k,true)}).join(", ")+" }</span>"}else{if(_.isObject(i)){return'<span class="moo-map">[ '+_.map(i,function(m,l){return a.formatHTML(l,true)+" -> "+a.formatHTML(m,true)}).join(", ")+" ]</span>"}}}}};_.extend(a,{isString:function(g){return typeof(g)=="string"&&!(c(g,"|obj")||c(g,"|err"))},isObjectNumber:function(g){return typeof(g)=="string"&&c(g,"|obj")},isError:function(g){return typeof(g)=="string"&&c(g,"|err")},isBinary:function(g){return g===0||g===1},isValidPerms:function(g,h){return typeof(g)=="string"&&g.match("^["+h+"]*$")},isValidObj:function(g){return _.include(["this","none","any"],g)},isValidPrep:function(h){var g=["with","using","at","to","in front of","in","inside","into","on top of","on","onto","upon","out of","from inside","from","over","through","under","underneath","beneath","behind","beside","for","about","is","as","off","off of","none","any"];return _.include(g,h)},isValidCode:function(g){return _.isArray(g)&&_.all(g,a.isString)},isValidObjectNumberArray:function(g){return _.isArray(g)&&_.all(g,a.isObjectNumber)}});a.NestedModel=Backbone.Model.extend({initialize:function(g){},has:function(h){var g=this.get(h);return !(g===null||g===undefined)},get:function(g,i){i=i||{};var k=g.split("."),h=k.shift();var j=Backbone.Model.prototype.get.call(this,h,i);_.each(k,function(l){j=j!=undefined&&(l in j)?j[l]:undefined});return j},set:function(i,k,j){var h;if(_.isObject(i)){h=i;j=k}else{h={};h[i]=k}j=j||{};var g=_.inject(this.attributes,function(l,n,m){l[m]=_.clone(n);return l},{});_.each(h,function(o,l){var q=l.split("."),m=q.shift();var p=g,n=m;_.each(q,function(r){if(!(n in p)){p[n]={}}p=p[n];n=r});p[n]=o});return Backbone.Model.prototype.set.call(this,g,j)}});a.Attribute=a.NestedModel.extend({validate:function(g){if(g&&"Value" in g&&(typeof(g.Value)!="object")){return"invalid attribute"}}});a.Value=a.NestedModel.extend({validate:function(g){if(g&&"Value" in g&&(typeof(g.Value)!="object")){return"invalid value"}if(g&&"Value" in g&&"clear" in g.Value&&!a.isBinary(g.Value.clear)){return"invalid value: `clear' must be 0 or 1"}},isReadable:function(){return this.get("Meta.status")=="readable"},isWritable:function(){return this.get("Meta.status")=="writable"},isDenied:function(){return this.get("Meta.status")=="denied"}});function f(g){return a.Value.generate(g)}function e(g){return function(h){var i=g+" ";return i+a.Value.generate(h,i)}}function d(h,g){return a.Value.generate(g)+" -> "+a.Value.generate(h)}function b(g){return function(i,h){var j=g+" ";return j+a.Value.generate(h,j)+" -> "+a.Value.generate(i,j)}}a.Value.generate=function(h,g){var i=g;if(g!=undefined){g=(g!==true)?g:"";i=g+" "}if(h!=undefined&&h!=null){if(typeof(h)=="string"){if(c(h,"|err")){return h.slice(0,h.length-4)}else{if(c(h,"|obj")){return h.slice(0,h.length-4)}else{if(c(h,"|int")){return h.slice(0,h.length-4)}else{if(c(h,"|float")){return h.slice(0,h.length-6)}else{if(c(h,"|str")){return JSON.stringify(h.slice(0,h.length-4))}else{return JSON.stringify(h)}}}}}}else{if(_.isArray(h)&&g!=undefined){return"{\n"+_.chain(h).map(e(g)).join(",\n").value()+"\n"+g+"}"}else{if(_.isArray(h)){return"{"+_.chain(h).map(f).join(", ").value()+"}"}else{if(_.isObject(h)&&g!=undefined){return"[\n"+_.chain(h).map(b(g)).join(",\n").value()+"\n"+g+"]"}else{if(_.isObject(h)){return"["+_.chain(h).map(d).join(", ").value()+"]"}}}}}return h.toString()}return undefined};a.Property=a.NestedModel.extend({validate:function(g){if(g&&"Property" in g&&(typeof(g.Property)!="object")){return"invalid property"}if(g&&"Property" in g&&"name" in g.Property&&!a.isString(g.Property.name)){return"invalid property: `name' must be a string"}if(g&&"Property" in g&&"owner" in g.Property&&!a.isObjectNumber(g.Property.owner)){return"invalid property: `owner' must be an object number"}if(g&&"Property" in g&&"perms" in g.Property&&!a.isValidPerms(g.Property.perms,"rwc")){return"invalid property: `perms' must be in the set 'rwc'"}},isReadable:function(){return this.get("Meta.status")=="readable"},isWritable:function(){return this.get("Meta.status")=="writable"},isDenied:function(){return this.get("Meta.status")=="denied"}});a.Verb=a.NestedModel.extend({validate:function(g){if(g&&"Verb" in g&&(typeof(g.Verb)!="object")){return"invalid verb"}if(g&&"Verb" in g&&"names" in g.Verb&&!a.isString(g.Verb.names)){return"invalid verb: `names' must be a string"}if(g&&"Verb" in g&&"owner" in g.Verb&&!a.isObjectNumber(g.Verb.owner)){return"invalid verb: `owner' must be an object number"}if(g&&"Verb" in g&&"perms" in g.Verb&&!a.isValidPerms(g.Verb.perms,"rwxd")){return"invalid verb: `perms' must be in the set 'rwxd'"}if(g&&"Verb" in g&&"dobj" in g.Verb&&!a.isValidObj(g.Verb.dobj)){return"invalid verb: `dobj' must be valid"}if(g&&"Verb" in g&&"prep" in g.Verb&&!a.isValidPrep(g.Verb.prep)){return"invalid verb: `prep' must be valid"}if(g&&"Verb" in g&&"iobj" in g.Verb&&!a.isValidObj(g.Verb.iobj)){return"invalid verb: `iobj' must be valid"}if(g&&"Verb" in g&&"code" in g.Verb&&!a.isValidCode(g.Verb.code)){return"invalid verb: `code' must be an array of strings"}},isReadable:function(){return this.get("Meta.status")=="readable"},isWritable:function(){return this.get("Meta.status")=="writable"},isDenied:function(){return this.get("Meta.status")=="denied"}});a.Collection=Backbone.Collection.extend({add:function(i,h){i=_.isArray(i)?i.slice():[i];var g=this instanceof a.Attributes||this instanceof a.Values;i=_.chain(i).map(function(j){if(!("id" in j)){if(g){return _.map(j,function(m,l){m.id=l;return m})}else{j.id=i.length;return j}}return j}).flatten().value();return Backbone.Collection.prototype.add.call(this,i,h)}});a.Attributes=a.Collection.extend({model:a.Attribute});a.Values=a.Collection.extend({model:a.Value});a.Properties=a.Collection.extend({model:a.Property});a.Verbs=a.Collection.extend({model:a.Verb});a.Object=Backbone.Model.extend({urlRoot:"///objects",initialize:function(){this.attributez=new a.Attributes;this.attributez.url=this.url()+"/attributes";this.values=new a.Values;this.values.url=this.url()+"/values";this.properties=new a.Properties;this.properties.url=this.url()+"/properties";this.verbs=new a.Verbs;this.verbs.url=this.url()+"/verbs";this.parse(this.attributes)},validate:function(g){var h,i;if((h=this.attributez.get("player"))&&!a.isBinary(h.get("Value.value"))){return"invalid attribute: `player' must be 0 or 1"}if((h=this.attributez.get("parents"))&&!a.isValidObjectNumberArray(h.get("Value.value"))){return"invalid attribute: `parents' must be an array of object numbers"}if((i=this.values.get("name"))&&!a.isString(i.get("Value.value"))){return"invalid value: `name' must be a string"}if((i=this.values.get("owner"))&&!a.isObjectNumber(i.get("Value.value"))){return"invalid value: `owner' must be an object number"}if((i=this.values.get("location"))&&!a.isObjectNumber(i.get("Value.value"))){return"invalid value: `location' must be an object number"}if((i=this.values.get("contents"))&&!a.isValidObjectNumberArray(i.get("Value.value"))){return"invalid value: `contents' must be an array of object numbers"}if((i=this.values.get("programmer"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `programmer' must be 0 or 1"}if((i=this.values.get("wizard"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `wizard' must be 0 or 1"}if((i=this.values.get("r"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `r' must be 0 or 1"}if((i=this.values.get("w"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `w' must be 0 or 1"}if((i=this.values.get("f"))&&!a.isBinary(i.get("Value.value"))){return"invalid value: `f' must be 0 or 1"}},parse:function(h){var l=function(m,o,n){o.id=n;m.push(o);return m};var j=h.Attributes;delete h.Attributes;this.attributez.reset(j);var g=h.Values;delete h.Values;this.values.reset(g);var i=h.Properties;delete h.Properties;this.properties.reset(_.chain(i).reduce(l,[]).value());var k=h.Verbs;delete h.Verbs;this.verbs.reset(_.chain(k).reduce(l,[]).value());if("Meta" in h&&"id" in h.Meta){this.id=h.Meta.id}return h},fetch:function(i){i=i?_.clone(i):{};var h=this;var g=i.error;i.error=function(j,k){j.httpResponseStatus=k.status;if(g){g(j,k)}};return Backbone.Model.prototype.fetch.call(this,i)},failed:function(){return this.httpResponseStatus>=300},isNotFound:function(){return this.httpResponseStatus==404},isDenied:function(){return this.httpResponseStatus==403},isReadable:function(){var g;return(g=this.get("Meta"))&&g.status=="readable"},isWritable:function(){var g;return(g=this.get("Meta"))&&g.status=="writable"},toJSON:function(){var g=function(h,j,i){h[j.id]=j;delete j.id;return h};return{Attributes:_.chain(this.attributez.toJSON()).reduce(g,{}).value(),Values:_.chain(this.values.toJSON()).reduce(g,{}).value(),Properties:this.properties.toJSON(),Verbs:this.verbs.toJSON()}}});a.Objects=Backbone.Collection.extend({model:a.Object,url:"///objects"});$.widget("moo.simpleObjectPanel",{options:{template:null,object:null},_setOption:function(g,h){switch(g){case"object":this.options.object=h;this._render();break;case"template":this.options.template=_.template(h);this._render();break}},_render:function(){if(this.options.object&&this.options.template){this.element.html(this.options.template({object:this.options.object}))}},_modal:{show:function(h,i,g){$("h3",h).text(i);$(".textarea",h).text(g);h.modal("show")},resetSelection:function(){if(window.getSelection){window.getSelection().removeAllRanges()}else{if(document.selection){document.selection.empty()}}}},_create:function(){var g=this;if(!this.options.template){$.get("/html/moo-0.0.3.html",function(h){g.options.template=_.template(h);g._render()})}this.element.on("dblclick","tr.value.readable, tr.value.writable",function(m){var k=g.options.object,j=$(".modal",g.element),h=$(m.target).parents("tr"),i=h.data("id"),l=a.Value.generate(k.values.get(i).get("Value.value"),true);g._modal.show(j,i,l);g._modal.resetSelection()});this.element.on("dblclick","tr.property.readable, tr.property.writable",function(l){var j=g.options.object,i=$(".modal",g.element),h=$(l.target).parents("tr"),n=h.data("id"),k=a.Value.generate(j.properties.get(n).get("Property.value"),true),m=j.properties.get(n).get("Property.name");g._modal.show(i,m,k);g._modal.resetSelection()});this.element.on("dblclick","tr.verb.readable, tr.verb.writable",function(l){var j=g.options.object,i=$(".modal",g.element),h=$(l.target).parents("tr"),n=h.data("id"),k=j.verbs.get(n).get("Verb.code").join("\n"),m=j.verbs.get(n).get("Verb.names");g._modal.show(i,m,k);g._modal.resetSelection()})},_init:function(){this._render()},destroy:function(){this.element.html("")}})})(Moo);
Please sign in to comment.
Something went wrong with that request. Please try again.