diff --git a/ajax/libs/hydra.js/3.1.1/README.md b/ajax/libs/hydra.js/3.1.1/README.md deleted file mode 100644 index 43fe9c896..000000000 --- a/ajax/libs/hydra.js/3.1.1/README.md +++ /dev/null @@ -1,179 +0,0 @@ -# Hydra.js -Hidra.js is a module manager oriented system. - -## Updated to version 3.1.1 - -[Changelog](https://raw.github.com/tcorral/Hydra.js/master/changelog.txt) - -## Description - -Hydra.js is the library that will help you to scale your app. -Hydra.js is a framework that gives you the tools to write your application using modules or widgets and make easy to work with them. - -Hydra.js uses a decoupled architecture that: - -* Allows you to change your base framework without change the modules or widget code. -* Allow the modules communicate with each other without knowing which modules are loaded. -* Can be easily extended with new features. - -### Some benefits: - -* No known module to other modules - * If something is wrong in one module, the other modules will continue working. -* Notifying an action will be called on all the modules that will be listening this action. -* A module can be extended - * If you have a module that is working well you can extend it to change his behavior without losing is original behavior. -* Allows multi-instance modules -* Allows set private variables to be used inside of modules. -* Can be used in url threaded application as in an Ajax threaded application. -* You can test your modules with any Unit Testing Framework. -* Only 2.37KB when [Gzipped](https://github.com/tcorral/Hydra.js/raw/master/versions/hydra.min.js.gz) 2.83KB if you add BasicErrorHandler and Deferred plugins. - -[Project Web](http://tcorral.github.com/Hydra.js) - -[API documentation](http://tcorral.github.com/Hydra.js/apis/Hydra.js_API_v3.1.0/index.html) - -[Examples](http://tcorral.github.com/Hydra.js/examples/index.html) to see for yourself! - -## Usage - -### Before using it: -Insert in your code: - - - -### Setting variables - Hydra.module.setVars({ - gaq: _gaq, - list: document.getElementById( "list" ) - }); -Setting the variables in this way this variables will be accessible as the last argument in init module method if needed you can access -to this variables object using getVars (See 'Getting variables') -*Tip. This method not only set variables, if the object has been set before the new variables will be merged with the previous object. * - -### Getting variables - var oVars = Hydra.module.getVars(); -Returns the object with the private variables set using setVars (See 'Setting variables') - -### Create a module - Hydra.module.register( 'moduleId', function( bus ) - { - return { - init: function ( oData ) {} - }; - }); - -### Extend a module overriding the base module -To extend a module you will need to register the base module before extends it. - - Hydra.module.extend( 'moduleId', function( bus ) - { - return { - init: function ( oData ) {} - }; - }); - -### Extend a module creating a new module -To extend a module you will need to register the base module before extends it. - - Hydra.module.extend( 'moduleId', 'newModuleId', function( bus ) - { - return { - init: function ( oData ) {} - }; - }); - -This extension allows access the parent methods as classical inheritance. - -### Access parent methods - -Register base module: - - Hydra.module.register( 'moduleId', function( bus ) - { - return { - init: function ( oData ) {}, - changeTitle: function( sTitle ){ - document.title = sTitle; - } - }; - }); - -Create the new module using "extend": - - Hydra.module.extend( 'moduleId', 'newModuleId', function( bus ) - { - return { - init: function ( oData ) {}, - changeTitle: function( sTitle ){ - sTitle += " " + new Date().getTime(); - // This is the way of access parent methods. - this.__super__.call( "changeTitle", [sTitle] ); - } - }; - }); - - -#### When listening events - Hydra.module.register( 'moduleId', function( bus ) - { - return { - events : { - 'channel: { - 'item:action1': function ( oData ) {} - } - }, - init: function ( oData ) { - - /* The subscribing of events is done by Hydra inside the core. - * bus.subscribe( this ); - */ - } - }; - }); - -### Publishing actions -To use the action manager you have accessible using "bus". - -The publish method expect three arguments, but only the first two are mandatory, the channel name and the event name - - Hydra.bus.publish( 'channel_name', 'event_name', data ); - -*Tip: 'global' channel is created by default to use it if you want to communicate with other modules that are not related with a specific channel. * - - Hydra.module.register( 'moduleId', function( bus ) - { - return { - events : { - 'channel: { - 'item:action1': function ( oData ) {} - } - }, - init: function ( oData ) { - $( "#button" ).click( function(){ - bus.publish( 'channel', 'item:action1', {} ); - }); - } - }; - }); - -If you need compatibility with the previous event manager called Action, you can add it in your code to maintain compatibility with previous version's code. You can download it from: [Action](https://github.com/tcorral/Hydra_Extensions/tree/master/Sandbox) - - -## Documentation - -[Project Web](http://tcorral.github.com/Hydra.js) - -[API documentation](http://tcorral.github.com/Hydra.js/apis/Hydra.js_API_v2.5.0/index.html) - -[Examples](http://tcorral.github.com/Hydra.js/examples/index.html) to see for yourself! - -## License - -Hydra.js is licensed under the MIT license. - -## Agreements - -Hydra was inspired by Nicholas Zakas presentation. - -* [Scalable Javascript Application](http://www.slideshare.net/nzakas/scalable-javascript-application-architecture) diff --git a/ajax/libs/hydra.js/3.1.1/hydra.min.js b/ajax/libs/hydra.js/3.1.1/hydra.min.js deleted file mode 100644 index 8535bdb5e..000000000 --- a/ajax/libs/hydra.js/3.1.1/hydra.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var w,o,l,g,j,s,y,c,r,z,E,G,C,n,A,B;function k(){var H=+new Date()+"",I=Math.floor(Math.random()*(999999-1+1))+1;return H+"_"+I}function m(H){var J,I;if(Object.keys){J=Object.keys(H).length}else{J=0;for(I in H){if(x(H,I)){J++}}}return J}if(typeof Object.create!=="function"){Object.create=function(H){function I(){}I.prototype=H;return new I()}}A=typeof exports==="object"&&typeof module==="object"&&typeof module.exports==="object"&&typeof require==="function";o="undefined";B=Object.prototype;w=this;j=null;y=false;l={};c="3.1.1";z=y;s=y;function v(H){return B.toString.call(H)}function b(H){return v(H)==="[object Function]"}function q(H){return v(H)==="[object Array]"}function a(H){z=H}function t(H){s=H}function u(I,H){return[].slice.call(I,H||0)}function x(H,I){return H.hasOwnProperty(I)}function F(N,J,I,M,L){var K,H;K=l[J];if(L&&N.isModuleStarted(J,I)){N.stop(J,I)}if(typeof K!==o){H=p(J);K.instances[I]=H;H.__instance_id__=I;if(typeof M!==o){H.init(M)}else{H.init()}}return H}function d(I,H){var J;for(J in H){if(x(H,J)){I[J]=H[J]}}return I}function f(I,K,J,H){I[K]=(function(M,L){return function(){var O=u(arguments,0);try{return L.apply(this,O)}catch(N){E.log(J,M,N);return false}}}(K,H))}n={global:{}};function i(I,J){var H=[],K;if(typeof I!=="undefined"){for(K in I){if(x(I,K)&&K===J){H=I[K]}}}return H}C={subscribers:function(H,I){return i(n[H],I)},_getChannelEvents:function(H,I){if(typeof n[H]==="undefined"){n[H]={}}if(typeof n[H][I]==="undefined"){n[H][I]=[]}return n[H][I]},_addSubscribers:function(I,H,J){var K;for(K in I){if(x(I,K)){this.subscribeTo(H,K,I[K],J)}}},unsubscribeFrom:function(J,N,L){var H=this._getChannelEvents(J,N),M,I,K=H.length;for(I=0;I0},_avoidBlockUI:function(J,N,I,M){var L,H=J.concat();setTimeout(function K(){var O=+new Date();do{L=H.shift();L.handler.call(L.subscriber,N);if(z){E.log(I,M,L)}}while(H.length>0&&(+new Date()-O<50));if(H.length>0){setTimeout(K,25)}},25)},publish:function(J,M,N){var I=this.subscribers(J,M),L=I.length,H,K;if(L===0){return false}if(s){this._avoidBlockUI(I,N,J,M)}else{for(H=0;H0)}else{I=(typeof l[J]!==o&&typeof l[J].instances[H]!==o)}return I},startAll:function(){var H,I;for(H in l){if(x(l,H)){I=l[H];if(typeof I!==o){this.start(H,k())}}}},_multiModuleStop:function(J){var I,K=J.instances,H;for(I in K){if(x(K,I)){H=K[I];if(typeof J!==o&&typeof H!==o){H.destroy()}}}},_singleModuleStop:function(K,J,H){var I=K.instances[H];if(typeof K!==o&&typeof I!==o){I.destroy()}},stop:function(I,H){var J;J=l[I];if(typeof J===o){return false}if(typeof H!==o){this._singleModuleStop(J,I,H)}else{this._multiModuleStop(J)}return true},_stopOneByOne:function(J,I){var H;for(H in J){if(x(J,H)){this.stop(I,H)}}},stopAll:function(){var H;for(H in l){if(x(l,H)&&typeof l[H]!==o){this._stopOneByOne(l[H].instances,H)}}},_delete:function(H){if(typeof l[H]!==o){delete l[H]}},remove:function(H){var I=l[H];if(typeof I===o){return null}if(typeof I!==o){try{return I}finally{this._delete(H)}}return null}};function e(){return E}function D(H){E=H}r=function(){};r.version=c;r.bus=C;r.errorHandler=e;r.setErrorHandler=D;r.module=new G();r.setUnblockUI=t;r.setDebug=a;r.getDebug=function(){return z};r.extend=function(I,H){if(typeof this[I]===o){this[I]=H}else{this[I]=d(this[I],H)}};r.noConflict=function(I,H,J){if(typeof this[I]!==o){H[J]=this[I];return true}return false};w.Hydra=r;if(A){module.exports=r}else{if(typeof define!=="undefined"){define(function(){return r})}}}.call(this)); \ No newline at end of file diff --git a/ajax/libs/hydra.js/3.1.1/hydra.js b/ajax/libs/hydra.js/3.1.2/hydra.js similarity index 95% rename from ajax/libs/hydra.js/3.1.1/hydra.js rename to ajax/libs/hydra.js/3.1.2/hydra.js index acbff549c..56dd2463b 100644 --- a/ajax/libs/hydra.js/3.1.1/hydra.js +++ b/ajax/libs/hydra.js/3.1.2/hydra.js @@ -1,7 +1,7 @@ /*global exports, module, require, define, setTimeout*/ (function () { 'use strict'; - var root, sNotDefined, oModules, oVars, _null_, bUnblockUI, _false_, sVersion, Hydra, bDebug, ErrorHandler, Module, Bus, oChannels, isNodeEnvironment, oObjProto; + var root, sNotDefined, oModules, oVars, _null_, bUnblockUI, _false_, sVersion, FakeModule, Hydra, bDebug, ErrorHandler, Module, Bus, oChannels, isNodeEnvironment, oObjProto; /** * Used to generate an unique key for instance ids that are not supplied by the user. @@ -91,7 +91,7 @@ * @private * @type {String} */ - sVersion = '3.1.1'; + sVersion = '3.1.2'; /** * Used to activate the debug mode @@ -279,6 +279,7 @@ return aSubscribers; } + /** * Bus is the object that must be used to manage the notifications by channels * @constructor @@ -609,10 +610,8 @@ * @return {Module} */ register:function (sModuleId, fpCreator) { - oModules[sModuleId] = { - creator:fpCreator, - instances:{} - }; + var self = this; + oModules[sModuleId] = new FakeModule(sModuleId, fpCreator); return oModules[sModuleId]; }, /** @@ -722,17 +721,15 @@ oExtendedModule = fpCreator(Bus); oBaseModule = oModule.creator(Bus); - oModules[sFinalModuleId] = { - creator:function (Bus) { - // If we extend the module with the different name, we - // create proxy class for the original methods. - oFinalModule = self._merge(oBaseModule, oExtendedModule); - // This gives access to the Action instance used to listen and notify. - oFinalModule.__action__ = Bus; - return oFinalModule; - }, - instances:{} - }; + oModules[sFinalModuleId] = new FakeModule(sFinalModuleId, function (Bus) { + // If we extend the module with the different name, we + // create proxy class for the original methods. + oFinalModule = self._merge(oBaseModule, oExtendedModule); + // This gives access to the Action instance used to listen and notify. + oFinalModule.__action__ = Bus; + return oFinalModule; + }); + return oModules[sFinalModuleId]; }, /** * Method to set an instance of a module @@ -970,6 +967,39 @@ } }; + /** + * Module to be stored, adds two methods to start and extend modules. + * @private + * @param {String} sModuleId + * @param {Function} fpCreator + * @constructor + */ + FakeModule = function(sModuleId, fpCreator) + { + if(typeof fpCreator === sNotDefined) + { + console.log('test'); + } + this.creator = fpCreator; + this.instances = {}; + this.sModuleId = sModuleId; + }; + + FakeModule.prototype = { + start: function(oData) + { + return Module.prototype.start(this.sModuleId, undefined, oData); + }, + extend: function(oSecondParameter, oThirdParameter) + { + return Module.prototype.extend(this.sModuleId, oSecondParameter, oThirdParameter); + }, + stop: function() + { + Module.prototype.stop(this.sModuleId); + } + }; + /** * getErrorHandler is a method to gain access to the private ErrorHandler constructor. * @private diff --git a/ajax/libs/hydra.js/3.1.2/hydra.min.js b/ajax/libs/hydra.js/3.1.2/hydra.min.js new file mode 100644 index 000000000..74c5f8954 --- /dev/null +++ b/ajax/libs/hydra.js/3.1.2/hydra.min.js @@ -0,0 +1 @@ +(function(){var x,p,m,h,k,t,z,c,e,s,A,F,H,D,o,B,C;function l(){var I=+new Date()+"",J=Math.floor(Math.random()*(999999-1+1))+1;return I+"_"+J}function n(I){var K,J;if(Object.keys){K=Object.keys(I).length}else{K=0;for(J in I){if(y(I,J)){K++}}}return K}if(typeof Object.create!=="function"){Object.create=function(I){function J(){}J.prototype=I;return new J()}}B=typeof exports==="object"&&typeof module==="object"&&typeof module.exports==="object"&&typeof require==="function";p="undefined";C=Object.prototype;x=this;k=null;z=false;m={};c="3.1.2";A=z;t=z;function w(I){return C.toString.call(I)}function b(I){return w(I)==="[object Function]"}function r(I){return w(I)==="[object Array]"}function a(I){A=I}function u(I){t=I}function v(J,I){return[].slice.call(J,I||0)}function y(I,J){return I.hasOwnProperty(J)}function G(O,K,J,N,M){var L,I;L=m[K];if(M&&O.isModuleStarted(K,J)){O.stop(K,J)}if(typeof L!==p){I=q(K);L.instances[J]=I;I.__instance_id__=J;if(typeof N!==p){I.init(N)}else{I.init()}}return I}function d(J,I){var K;for(K in I){if(y(I,K)){J[K]=I[K]}}return J}function g(J,L,K,I){J[L]=(function(N,M){return function(){var P=v(arguments,0);try{return M.apply(this,P)}catch(O){F.log(K,N,O);return false}}}(L,I))}o={global:{}};function j(J,K){var I=[],L;if(typeof J!=="undefined"){for(L in J){if(y(J,L)&&L===K){I=J[L]}}}return I}D={subscribers:function(I,J){return j(o[I],J)},_getChannelEvents:function(I,J){if(typeof o[I]==="undefined"){o[I]={}}if(typeof o[I][J]==="undefined"){o[I][J]=[]}return o[I][J]},_addSubscribers:function(J,I,K){var L;for(L in J){if(y(J,L)){this.subscribeTo(I,L,J[L],K)}}},unsubscribeFrom:function(K,O,M){var I=this._getChannelEvents(K,O),N,J,L=I.length;for(J=0;J0},_avoidBlockUI:function(K,O,J,N){var M,I=K.concat();setTimeout(function L(){var P=+new Date();do{M=I.shift();M.handler.call(M.subscriber,O);if(A){F.log(J,N,M)}}while(I.length>0&&(+new Date()-P<50));if(I.length>0){setTimeout(L,25)}},25)},publish:function(K,N,O){var J=this.subscribers(K,N),M=J.length,I,L;if(M===0){return false}if(t){this._avoidBlockUI(J,O,K,N)}else{for(I=0;I0)}else{J=(typeof m[K]!==p&&typeof m[K].instances[I]!==p)}return J},startAll:function(){var I,J;for(I in m){if(y(m,I)){J=m[I];if(typeof J!==p){this.start(I,l())}}}},_multiModuleStop:function(K){var J,L=K.instances,I;for(J in L){if(y(L,J)){I=L[J];if(typeof K!==p&&typeof I!==p){I.destroy()}}}},_singleModuleStop:function(L,K,I){var J=L.instances[I];if(typeof L!==p&&typeof J!==p){J.destroy()}},stop:function(J,I){var K;K=m[J];if(typeof K===p){return false}if(typeof I!==p){this._singleModuleStop(K,J,I)}else{this._multiModuleStop(K)}return true},_stopOneByOne:function(K,J){var I;for(I in K){if(y(K,I)){this.stop(J,I)}}},stopAll:function(){var I;for(I in m){if(y(m,I)&&typeof m[I]!==p){this._stopOneByOne(m[I].instances,I)}}},_delete:function(I){if(typeof m[I]!==p){delete m[I]}},remove:function(I){var J=m[I];if(typeof J===p){return null}if(typeof J!==p){try{return J}finally{this._delete(I)}}return null}};e=function(J,I){if(typeof I===p){console.log("test")}this.creator=I;this.instances={};this.sModuleId=J};e.prototype={start:function(I){return H.prototype.start(this.sModuleId,undefined,I)},extend:function(I,J){return H.prototype.extend(this.sModuleId,I,J)},stop:function(){H.prototype.stop(this.sModuleId)}};function f(){return F}function E(I){F=I}s=function(){};s.version=c;s.bus=D;s.errorHandler=f;s.setErrorHandler=E;s.module=new H();s.setUnblockUI=u;s.setDebug=a;s.getDebug=function(){return A};s.extend=function(J,I){if(typeof this[J]===p){this[J]=I}else{this[J]=d(this[J],I)}};s.noConflict=function(J,I,K){if(typeof this[J]!==p){I[K]=this[J];return true}return false};x.Hydra=s;if(B){module.exports=s}else{if(typeof define!=="undefined"){define(function(){return s})}}}.call(this)); \ No newline at end of file diff --git a/ajax/libs/hydra.js/README.md b/ajax/libs/hydra.js/README.md deleted file mode 100644 index 43fe9c896..000000000 --- a/ajax/libs/hydra.js/README.md +++ /dev/null @@ -1,179 +0,0 @@ -# Hydra.js -Hidra.js is a module manager oriented system. - -## Updated to version 3.1.1 - -[Changelog](https://raw.github.com/tcorral/Hydra.js/master/changelog.txt) - -## Description - -Hydra.js is the library that will help you to scale your app. -Hydra.js is a framework that gives you the tools to write your application using modules or widgets and make easy to work with them. - -Hydra.js uses a decoupled architecture that: - -* Allows you to change your base framework without change the modules or widget code. -* Allow the modules communicate with each other without knowing which modules are loaded. -* Can be easily extended with new features. - -### Some benefits: - -* No known module to other modules - * If something is wrong in one module, the other modules will continue working. -* Notifying an action will be called on all the modules that will be listening this action. -* A module can be extended - * If you have a module that is working well you can extend it to change his behavior without losing is original behavior. -* Allows multi-instance modules -* Allows set private variables to be used inside of modules. -* Can be used in url threaded application as in an Ajax threaded application. -* You can test your modules with any Unit Testing Framework. -* Only 2.37KB when [Gzipped](https://github.com/tcorral/Hydra.js/raw/master/versions/hydra.min.js.gz) 2.83KB if you add BasicErrorHandler and Deferred plugins. - -[Project Web](http://tcorral.github.com/Hydra.js) - -[API documentation](http://tcorral.github.com/Hydra.js/apis/Hydra.js_API_v3.1.0/index.html) - -[Examples](http://tcorral.github.com/Hydra.js/examples/index.html) to see for yourself! - -## Usage - -### Before using it: -Insert in your code: - - - -### Setting variables - Hydra.module.setVars({ - gaq: _gaq, - list: document.getElementById( "list" ) - }); -Setting the variables in this way this variables will be accessible as the last argument in init module method if needed you can access -to this variables object using getVars (See 'Getting variables') -*Tip. This method not only set variables, if the object has been set before the new variables will be merged with the previous object. * - -### Getting variables - var oVars = Hydra.module.getVars(); -Returns the object with the private variables set using setVars (See 'Setting variables') - -### Create a module - Hydra.module.register( 'moduleId', function( bus ) - { - return { - init: function ( oData ) {} - }; - }); - -### Extend a module overriding the base module -To extend a module you will need to register the base module before extends it. - - Hydra.module.extend( 'moduleId', function( bus ) - { - return { - init: function ( oData ) {} - }; - }); - -### Extend a module creating a new module -To extend a module you will need to register the base module before extends it. - - Hydra.module.extend( 'moduleId', 'newModuleId', function( bus ) - { - return { - init: function ( oData ) {} - }; - }); - -This extension allows access the parent methods as classical inheritance. - -### Access parent methods - -Register base module: - - Hydra.module.register( 'moduleId', function( bus ) - { - return { - init: function ( oData ) {}, - changeTitle: function( sTitle ){ - document.title = sTitle; - } - }; - }); - -Create the new module using "extend": - - Hydra.module.extend( 'moduleId', 'newModuleId', function( bus ) - { - return { - init: function ( oData ) {}, - changeTitle: function( sTitle ){ - sTitle += " " + new Date().getTime(); - // This is the way of access parent methods. - this.__super__.call( "changeTitle", [sTitle] ); - } - }; - }); - - -#### When listening events - Hydra.module.register( 'moduleId', function( bus ) - { - return { - events : { - 'channel: { - 'item:action1': function ( oData ) {} - } - }, - init: function ( oData ) { - - /* The subscribing of events is done by Hydra inside the core. - * bus.subscribe( this ); - */ - } - }; - }); - -### Publishing actions -To use the action manager you have accessible using "bus". - -The publish method expect three arguments, but only the first two are mandatory, the channel name and the event name - - Hydra.bus.publish( 'channel_name', 'event_name', data ); - -*Tip: 'global' channel is created by default to use it if you want to communicate with other modules that are not related with a specific channel. * - - Hydra.module.register( 'moduleId', function( bus ) - { - return { - events : { - 'channel: { - 'item:action1': function ( oData ) {} - } - }, - init: function ( oData ) { - $( "#button" ).click( function(){ - bus.publish( 'channel', 'item:action1', {} ); - }); - } - }; - }); - -If you need compatibility with the previous event manager called Action, you can add it in your code to maintain compatibility with previous version's code. You can download it from: [Action](https://github.com/tcorral/Hydra_Extensions/tree/master/Sandbox) - - -## Documentation - -[Project Web](http://tcorral.github.com/Hydra.js) - -[API documentation](http://tcorral.github.com/Hydra.js/apis/Hydra.js_API_v2.5.0/index.html) - -[Examples](http://tcorral.github.com/Hydra.js/examples/index.html) to see for yourself! - -## License - -Hydra.js is licensed under the MIT license. - -## Agreements - -Hydra was inspired by Nicholas Zakas presentation. - -* [Scalable Javascript Application](http://www.slideshare.net/nzakas/scalable-javascript-application-architecture) diff --git a/ajax/libs/hydra.js/package.json b/ajax/libs/hydra.js/package.json index 7c903756b..0dea1eeb8 100644 --- a/ajax/libs/hydra.js/package.json +++ b/ajax/libs/hydra.js/package.json @@ -1,7 +1,7 @@ { "name": "hydra.js", "filename": "hydra.min.js", - "version": "3.1.1", + "version": "3.1.2", "description": "Framework that gives you the tools to write your application using modules or widgets and make easy to work with them.", "homepage": "http://tcorral.github.com/Hydra.js/", "keywords": [