Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

'packages'

  • Loading branch information...
commit 2f14127121826330feba7d025b0dfc39c0ebad84 1 parent 3b21469
David Tudury authored
18 README.md
View
@@ -1,18 +0,0 @@
-# README for a newly created project.
-
-There are a couple of things you should do first, before you can use all of Git's power:
-
- * Add a remote to this project: in the Cloud9 IDE command line, you can execute the following commands
- `git remote add [remote name] [remote url (eg. 'git@github.com:/ajaxorg/node_chat')]` [Enter]
- * Create new files inside your project
- * Add them to to Git by executing the following command
- `git add [file1, file2, file3, ...]` [Enter]
- * Create a commit which can be pushed to the remote you just added
- `git commit -m 'added new files'` [Enter]
- * Push the commit the remote
- `git push [remote name] master` [Enter]
-
-That's it! If this doesn't work for you, please visit the excellent resources from [Github.com](http://help.github.com) and the [Pro Git](http://http://progit.org/book/) book.
-If you can't find your answers there, feel free to ask us via Twitter (@cloud9ide), [mailing list](groups.google.com/group/cloud9-ide) or IRC (#cloud9ide on freenode).
-
-Happy coding!
20 cryptopotamus.js
View
@@ -1,20 +0,0 @@
-
-if( !cryptopotamus) var cryptopotamus = { model:{}, view:{}, controller:{}};
-
-(function() {
-
- var view = IMPORT( "cryptopotamus.view");
-
- this.handle_onload = function() {
- var content = document.getElementById( "content");
- content.appendChild( view.new_top_nav());
- //content.appendChild( v.new_text_input());
- content.appendChild( view.new_text_input( "name here"));
- /*
- var announce_new_salt = function() {
- //window.alert( "new salt: " + m.get_salt());
- };
- m.publisher.subscribe( {}, announce_new_salt, m.NEW_SALT);
- */
- };
-}).call( cryptopotamus);
15 index.html
View
@@ -3,13 +3,16 @@
<head>
<meta charset=utf-8 />
<title>local cryptopotamus</title>
- <script language="javascript" src="utils.js"></script>
- <script language="javascript" src="cryptopotamus.js"></script>
- <script language="javascript" src="cryptopotamus.model.js"></script>
- <script language="javascript" src="cryptopotamus.view.js"></script>
- <script language="javascript" src="cryptopotamus.controller.js"></script>
+ <script language="javascript" src="js/CORE.js"></script>
+ <script language="javascript" src="js/utils/Closure.js"></script>
+ <script language="javascript" src="js/utils/PubSub.js"></script>
+ <script language="javascript" src="js/utils/configure.js"></script>
+ <script language="javascript" src="js/cryptopotamus/Model.js"></script>
+ <script language="javascript" src="js/cryptopotamus/View.js"></script>
+ <script language="javascript" src="js/cryptopotamus/Controller.js"></script>
+ <script language="javascript" src="js/cryptopotamus/handle_onload.js"></script>
</head>
- <body onload="cryptopotamus.handle_onload()">
+ <body onload="IMPORT( 'cryptopotamus.handle_onload')()">
<div id="content"></div>
</body>
</html>
57 js/CORE.js
View
@@ -0,0 +1,57 @@
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
+
+(function() {
+
+ var _name_space = {};
+ var _packaged_functions = {};
+
+ var global = ( function(){ return this;}).call();
+
+ /*****************************************************************************
+ *
+ *****************************************************************************/
+ global.PACKAGE_FUNCTION = function( qualified_name, in_function) {
+ _packaged_functions[ qualified_name] = in_function;
+ };
+
+ /*****************************************************************************
+ *
+ *****************************************************************************/
+ global.IMPORT = function( qualified_name) {
+ if( !_name_space[ qualified_name]) {
+ var _class = function() {
+ if( this.super_class) {
+ var constructor = this.constructor;
+ if( this.constructor == arguments.callee) constructor = this.super_class.constructor;
+ if( constructor) constructor.apply( this, [].slice.call( arguments));
+ } else if( _packaged_functions[ qualified_name]) {
+ return _packaged_functions[ qualified_name].apply( this, [].slice.call( arguments));
+ }
+ };
+ _class.define_instance = function( in_definition) { in_definition( this.prototype); return _class;};
+ _class.define_static = function( in_definition) { in_definition( this); return _class;};
+ _name_space[ qualified_name] = _class;
+ }
+ return _name_space[ qualified_name];
+ };
+
+ /*****************************************************************************
+ *
+ *****************************************************************************/
+ global.PACKAGE_CLASS = function( qualified_name, super_class, instance_definition, static_definition) {
+ if( !super_class) super_class = Object;
+
+ var _class = IMPORT( qualified_name);
+ _class.prototype = new super_class();
+ _class.prototype.super_class = super_class.prototype;
+ _class.prototype.constructor = _class;
+ if( instance_definition) _class.define_instance( instance_definition);
+ if( static_definition) _class.define_static( static_definition);
+ _name_space[ qualified_name] = _class;
+ return _class;
+ };
+
+})();
4 cryptopotamus.controller.js → js/cryptopotamus/Controller.js
View
@@ -1,7 +1,7 @@
-PACKAGE_CLASS( "cryptopotamus.controller").define_static( function( _) {
+PACKAGE_CLASS( "cryptopotamus.Controller").define_static( function( _) {
- var model = IMPORT( "cryptopotamus.model");
+ var model = IMPORT( "cryptopotamus.Model");
_.update_salt = function( in_event) {
var _event = window.event || in_event;
2  cryptopotamus.model.js → js/cryptopotamus/Model.js
View
@@ -1,5 +1,5 @@
-PACKAGE_CLASS( "cryptopotamus.model").define_static( function( _) {
+PACKAGE_CLASS( "cryptopotamus.Model").define_static( function( _) {
var PubSub = IMPORT( "utils.PubSub");
4 cryptopotamus.view.js → js/cryptopotamus/View.js
View
@@ -1,7 +1,7 @@
-PACKAGE_CLASS( "cryptopotamus.view").define_static( function( _) {
+PACKAGE_CLASS( "cryptopotamus.View").define_static( function( _) {
- var controller = IMPORT( "cryptopotamus.controller");
+ var controller = IMPORT( "cryptopotamus.Controller");
var configure = IMPORT( "utils.configure");
_.new_top_nav = function() {
19 js/cryptopotamus/handle_onload.js
View
@@ -0,0 +1,19 @@
+/*****************************************************************************
+ *
+ *****************************************************************************/
+
+PACKAGE_FUNCTION( "cryptopotamus.handle_onload", function() {
+
+ var view = IMPORT( "cryptopotamus.View");
+
+ var content = document.getElementById( "content");
+ content.appendChild( view.new_top_nav());
+ //content.appendChild( v.new_text_input());
+ content.appendChild( view.new_text_input( "name here"));
+ /*
+ var announce_new_salt = function() {
+ //window.alert( "new salt: " + m.get_salt());
+ };
+ m.publisher.subscribe( {}, announce_new_salt, m.NEW_SALT);
+ */
+});
26 js/utils/Closure.js
View
@@ -0,0 +1,26 @@
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
+
+PACKAGE_CLASS( "utils.Closure").define_static( function( _) {
+ _.constructor = function( target, executable) {
+ var args = [].slice.call( arguments, 2);
+ this.target = target;
+ this.executable = executable;
+ this.args = args;
+ this.execute = function() {
+ var _args = [].slice.call( arguments);
+ executable.apply( target, args.concat( _args));
+ };
+ this.compare = function( in_closure) {
+ if( this.target != in_closure.target) return false;
+ if( this.executable != in_closure.executable) return false;
+ if( this.args.length != in_closure.args.length) return false;
+ for( var i = 0; i < this.args.length; i++) {
+ if( this.args[ i] != in_closure.args[ i]) return false;
+ }
+ return true;
+ };
+ };
+});
36 js/utils/PubSub.js
View
@@ -0,0 +1,36 @@
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
+
+PACKAGE_CLASS( "utils.PubSub").define_instance( function( _) {
+
+ var Closure = IMPORT( "utils.Closure");
+
+ var _topics = {};
+
+ _.subscribe = function( target, executable, topic) {
+ if( !_topics[ topic]) _topics[ topic] = [];
+ _topics[ topic].push( new Closure( target, executable));
+ };
+
+ _.unsubscribe = function( target, executable, topic) {
+ if( !_topics[ topic]) _topics[ topic] = [];
+ var subscriptions = _topics[ topic];
+ _topics[ topic] = [];
+ var closure = new Closure( target, executable);
+ for( var i = 0; i < subscriptions.length; i++) {
+ if( !closure.compare( subscriptions[ i])) {
+ _topics[ topic].push( subscriptions[ i]);
+ }
+ }
+ };
+
+ _.sendMessage = function( topic) {
+ if( !_topics[ topic]) _topics[ topic] = [];
+ var _args = [].slice.call( arguments, 1);
+ for( var i = 0; i < _topics[ topic].length; i++) {
+ _topics[ topic][ i].execute.apply( null, _args);
+ }
+ };
+});
44 js/utils/configure.js
View
@@ -0,0 +1,44 @@
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
+
+PACKAGE_FUNCTION( "utils.configure", function( target, source, defaults) {
+
+ var configure = IMPORT( "utils.configure");
+
+ //helper function for configure
+ function _copy_value( target, source, attribute) {
+ var value = source[ attribute];
+ if( typeof value == "undefined") {
+ } else if( value === null) {
+ target[ attribute] = value;
+ } else if( typeof value == "boolean") {
+ target[ attribute] = value;
+ } else if( typeof value == "number") {
+ target[ attribute] = value;
+ } else if( typeof value == "string") {
+ target[ attribute] = value;
+ } else if( typeof value == "function") {
+ target[ attribute] = value;
+ } else if( value instanceof Array) {
+ if( !target[ attribute]) target[ attribute] = [];
+ configure( target[ attribute], value);
+ } else if( value instanceof Object) {
+ if( !target[ attribute]) target[ attribute] = {};
+ configure( target[ attribute], value);
+ }
+ }
+
+ var attribute;
+ if( source) for( attribute in source) {
+ _copy_value( target, source, attribute);
+ }
+ if( defaults) for( attribute in defaults) {
+ var test = target[ attribute];
+ if( typeof test == "undefined" || test === null) {
+ _copy_value( target, source, attribute);
+ }
+ }
+ return target;
+});
45 js/utils/deepPrint.js
View
@@ -0,0 +1,45 @@
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
+
+PACKAGE_FUNCTION( "utils.deepPrint", function( target, indent) {
+
+ var deepPrint = IMPORT( "utils.deepPrint");
+
+ indent = indent ? indent : "";
+ var new_indent = indent;
+ var br = "\n";
+ new_indent += " ";
+ var out_string = "";
+ if( typeof target == "undefined") {
+ } else if( target === null) {
+ out_string += "null";
+ } else if( typeof target == "boolean") {
+ out_string += target;
+ } else if( typeof target == "number") {
+ out_string += target;
+ } else if( typeof target == "string") {
+ out_string += "\"" + target + "\"";
+ } else if( typeof target == "function") {
+ out_string += target;
+ } else if( target instanceof Array) {
+ var temp_array = [];
+ for( var i = 0; i < target.length; i++) {
+ temp_array.push( deepPrint( target[ i], new_indent));
+ }
+ out_string += "[" + br +
+ new_indent + temp_array.join( "," + br + new_indent) + br +
+ indent + "]";
+ } else if( target instanceof Object) {
+ var temp_array = [];
+ for( var attribute in target) {
+ temp_array.push( attribute + ": " +
+ deepPrint( target[ attribute], new_indent));
+ }
+ out_string += "{" + br +
+ new_indent + temp_array.join( "," + br + new_indent) + br +
+ indent + "}";
+ }
+ return out_string;
+});
199 utils.js
View
@@ -1,199 +0,0 @@
-
-(function() {
- var global = ( function(){ return this;}).call();
- var _packaged_functions = {};
- var _name_space = {};
-
- /*****************************************************************************
- *
- *****************************************************************************/
- global.PACKAGE_FUNCTION = function( qualified_name, in_function) {
- if( !_name_space[ qualified_name]) {
- _name_space[ qualified_name] = function() {
- return _packaged_functions[ qualified_name].apply( this, [].slice.call( arguments));
- };
- }
- _packaged_functions[ qualified_name] = in_function;
- };
-
- /*****************************************************************************
- *
- *****************************************************************************/
- global.IMPORT = function( qualified_name) {
- if( !_name_space[ qualified_name]) {
- _name_space[ qualified_name] = function() {
- var constructor = this.constructor == arguments.callee ? this.super_class.constructor : this.constructor;
- if( constructor) constructor.apply( this, [].slice.call( arguments));
- };
- }
- return _name_space[ qualified_name];
- };
-
- /*****************************************************************************
- *
- *****************************************************************************/
- global.PACKAGE_CLASS = function( qualified_name, super_class, instance_definition, static_definition) {
- var _class = IMPORT( qualified_name);
- _class.set_super_class = function( in_class) {
- _class.prototype = new in_class();
- _class.prototype.super_class = in_class.prototype;
- _class.prototype.constructor = _class;
- };
- _class.set_super_class( super_class ? super_class : Object);
- _class.define_instance = function( in_definition) { in_definition( this.prototype); return _class;};
- _class.define_static = function( in_definition) { in_definition( this); return _class;};
- if( instance_definition) _class.define_instance( instance_definition);
- if( static_definition) _class.define_static( static_definition);
- PACKAGE_FUNCTION( qualified_name, _class);
- return _class;
- };
-
-})();
-
-/*****************************************************************************
- *
- *****************************************************************************/
-PACKAGE_CLASS( "utils.Closure").define_static( function( _) {
- _.constructor = function( target, executable) {
- var args = [].slice.call( arguments, 2);
- this.target = target;
- this.executable = executable;
- this.args = args;
- this.execute = function() {
- var _args = [].slice.call( arguments);
- executable.apply( target, args.concat( _args));
- };
- this.compare = function( in_closure) {
- if( this.target != in_closure.target) return false;
- if( this.executable != in_closure.executable) return false;
- if( this.args.length != in_closure.args.length) return false;
- for( var i = 0; i < this.args.length; i++) {
- if( this.args[ i] != in_closure.args[ i]) return false;
- }
- return true;
- };
- };
-});
-
-/*****************************************************************************
- *
- *****************************************************************************/
-PACKAGE_FUNCTION( "utils.configure", function( target, source, defaults) {
-
- var configure = IMPORT( "utils.configure");
-
- //helper function for configure
- function _copy_value( target, source, attribute) {
- var value = source[ attribute];
- if( typeof value == "undefined") {
- } else if( value === null) {
- target[ attribute] = value;
- } else if( typeof value == "boolean") {
- target[ attribute] = value;
- } else if( typeof value == "number") {
- target[ attribute] = value;
- } else if( typeof value == "string") {
- target[ attribute] = value;
- } else if( typeof value == "function") {
- target[ attribute] = value;
- } else if( value instanceof Array) {
- if( !target[ attribute]) target[ attribute] = [];
- configure( target[ attribute], value);
- } else if( value instanceof Object) {
- if( !target[ attribute]) target[ attribute] = {};
- configure( target[ attribute], value);
- }
- }
-
- var attribute;
- if( source) for( attribute in source) {
- _copy_value( target, source, attribute);
- }
- if( defaults) for( attribute in defaults) {
- var test = target[ attribute];
- if( typeof test == "undefined" || test === null) {
- _copy_value( target, source, attribute);
- }
- }
- return target;
-});
-
-/*****************************************************************************
- *
- *****************************************************************************/
-PACKAGE_FUNCTION( "utils.deepPrint", function( target, indent) {
-
- var deepPrint = IMPORT( "utils.deepPrint");
-
- indent = indent ? indent : "";
- var new_indent = indent;
- var br = "\n";
- new_indent += " ";
- var out_string = "";
- if( typeof target == "undefined") {
- } else if( target === null) {
- out_string += "null";
- } else if( typeof target == "boolean") {
- out_string += target;
- } else if( typeof target == "number") {
- out_string += target;
- } else if( typeof target == "string") {
- out_string += "\"" + target + "\"";
- } else if( typeof target == "function") {
- out_string += target;
- } else if( target instanceof Array) {
- var temp_array = [];
- for( var i = 0; i < target.length; i++) {
- temp_array.push( deepPrint( target[ i], new_indent));
- }
- out_string += "[" + br +
- new_indent + temp_array.join( "," + br + new_indent) + br +
- indent + "]";
- } else if( target instanceof Object) {
- var temp_array = [];
- for( var attribute in target) {
- temp_array.push( attribute + ": " +
- deepPrint( target[ attribute], new_indent));
- }
- out_string += "{" + br +
- new_indent + temp_array.join( "," + br + new_indent) + br +
- indent + "}";
- }
- return out_string;
-});
-
-
-/*****************************************************************************
- *
- *****************************************************************************/
-PACKAGE_CLASS( "utils.PubSub").define_instance( function( _) {
-
- var Closure = IMPORT( "utils.Closure");
-
- var _topics = {};
-
- _.subscribe = function( target, executable, topic) {
- if( !_topics[ topic]) _topics[ topic] = [];
- _topics[ topic].push( new Closure( target, executable));
- };
-
- _.unsubscribe = function( target, executable, topic) {
- if( !_topics[ topic]) _topics[ topic] = [];
- var subscriptions = _topics[ topic];
- _topics[ topic] = [];
- var closure = new Closure( target, executable);
- for( var i = 0; i < subscriptions.length; i++) {
- if( !closure.compare( subscriptions[ i])) {
- _topics[ topic].push( subscriptions[ i]);
- }
- }
- };
-
- _.sendMessage = function( topic) {
- if( !_topics[ topic]) _topics[ topic] = [];
- var _args = [].slice.call( arguments, 1);
- for( var i = 0; i < _topics[ topic].length; i++) {
- _topics[ topic][ i].execute.apply( null, _args);
- }
- };
-});
Please sign in to comment.
Something went wrong with that request. Please try again.