From a8414936352ae1db6d28331ec68489b899beeefc Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 21 Sep 2014 14:14:57 +0800 Subject: [PATCH] add backbone.babysitter v0.0.5/0.0.6/0.1.0/0.1.1 --- .../0.0.5/backbone.babysitter.js | 198 ++++++++++++++++++ .../0.0.5/backbone.babysitter.map | 1 + .../0.0.5/backbone.babysitter.min.js | 11 + .../0.0.6/backbone.babysitter.js | 157 ++++++++++++++ .../0.0.6/backbone.babysitter.map | 1 + .../0.0.6/backbone.babysitter.min.js | 11 + .../0.1.0/backbone.babysitter.js | 159 ++++++++++++++ .../0.1.0/backbone.babysitter.map | 1 + .../0.1.0/backbone.babysitter.min.js | 11 + .../0.1.1/backbone.babysitter.js | 159 ++++++++++++++ .../0.1.1/backbone.babysitter.map | 1 + .../0.1.1/backbone.babysitter.min.js | 11 + 12 files changed, 721 insertions(+) create mode 100644 ajax/libs/backbone.babysitter/0.0.5/backbone.babysitter.js create mode 100644 ajax/libs/backbone.babysitter/0.0.5/backbone.babysitter.map create mode 100644 ajax/libs/backbone.babysitter/0.0.5/backbone.babysitter.min.js create mode 100644 ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.js create mode 100644 ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.map create mode 100644 ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.min.js create mode 100644 ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.js create mode 100644 ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.map create mode 100644 ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.min.js create mode 100644 ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.js create mode 100644 ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.map create mode 100644 ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.min.js diff --git a/ajax/libs/backbone.babysitter/0.0.5/backbone.babysitter.js b/ajax/libs/backbone.babysitter/0.0.5/backbone.babysitter.js new file mode 100644 index 000000000..303bbc59a --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.0.5/backbone.babysitter.js @@ -0,0 +1,198 @@ +// Backbone.BabySitter +// ------------------- +// v0.0.5 +// +// Copyright (c)2013 Derick Bailey, Muted Solutions, LLC. +// Distributed under MIT license +// +// http://github.com/babysitterjs/backbone.babysitter + +// Backbone.ChildViewContainer +// --------------------------- +// +// Provide a container to store, retrieve and +// shut down child views. + +Backbone.ChildViewContainer = (function(Backbone, _){ + + // Container Constructor + // --------------------- + + var Container = function(initialViews){ + this._views = {}; + this._indexByModel = {}; + this._indexByCollection = {}; + this._indexByCustom = {}; + this._updateLength(); + + this._addInitialViews(initialViews); + }; + + // Container Methods + // ----------------- + + _.extend(Container.prototype, { + + // Add a view to this container. Stores the view + // by `cid` and makes it searchable by the model + // and/or collection of the view. Optionally specify + // a custom key to store an retrieve the view. + add: function(view, customIndex){ + var viewCid = view.cid; + + // store the view + this._views[viewCid] = view; + + // index it by model + if (view.model){ + this._indexByModel[view.model.cid] = viewCid; + } + + // index it by collection + if (view.collection){ + this._indexByCollection[view.collection.cid] = viewCid; + } + + // index by custom + if (customIndex){ + this._indexByCustom[customIndex] = viewCid; + } + + this._updateLength(); + }, + + // Find a view by the model that was attached to + // it. Uses the model's `cid` to find it, and + // retrieves the view by it's `cid` from the result + findByModel: function(model){ + var viewCid = this._indexByModel[model.cid]; + return this.findByCid(viewCid); + }, + + // Find a view by the collection that was attached to + // it. Uses the collection's `cid` to find it, and + // retrieves the view by it's `cid` from the result + findByCollection: function(col){ + var viewCid = this._indexByCollection[col.cid]; + return this.findByCid(viewCid); + }, + + // Find a view by a custom indexer. + findByCustom: function(index){ + var viewCid = this._indexByCustom[index]; + return this.findByCid(viewCid); + }, + + // Find by index. This is not guaranteed to be a + // stable index. + findByIndex: function(index){ + return _.values(this._views)[index]; + }, + + // retrieve a view by it's `cid` directly + findByCid: function(cid){ + return this._views[cid]; + }, + + // Remove a view + remove: function(view){ + var viewCid = view.cid; + + // delete model index + if (view.model){ + delete this._indexByModel[view.model.cid]; + } + + // delete collection index + if (view.collection){ + delete this._indexByCollection[view.collection.cid]; + } + + // delete custom index + var cust; + + for (var key in this._indexByCustom){ + if (this._indexByCustom.hasOwnProperty(key)){ + if (this._indexByCustom[key] === viewCid){ + cust = key; + break; + } + } + } + + if (cust){ + delete this._indexByCustom[cust]; + } + + // remove the view from the container + delete this._views[viewCid]; + + // update the length + this._updateLength(); + }, + + // Call a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.call`. + call: function(method, args){ + args = Array.prototype.slice.call(arguments, 1); + this.apply(method, args); + }, + + // Apply a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.apply`. + apply: function(method, args){ + var view; + + // fix for IE < 9 + args = args || []; + + _.each(this._views, function(view, key){ + if (_.isFunction(view[method])){ + view[method].apply(view, args); + } + }); + + }, + + // Update the `.length` attribute on this container + _updateLength: function(){ + this.length = _.size(this._views); + }, + + // set up an initial list of views + _addInitialViews: function(views){ + if (!views){ return; } + + var view, i, + length = views.length; + + for (i=0; ie;e++)t=i[e],this.add(t)}}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(n,function(i){e.prototype[i]=function(){var e=t.values(this._views),n=[e].concat(t.toArray(arguments));return t[i].apply(t,n)}}),e}(Backbone,_); +//@ sourceMappingURL=backbone.babysitter.map \ No newline at end of file diff --git a/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.js b/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.js new file mode 100644 index 000000000..8190ad367 --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.js @@ -0,0 +1,157 @@ +// Backbone.BabySitter +// ------------------- +// v0.0.6 +// +// Copyright (c)2013 Derick Bailey, Muted Solutions, LLC. +// Distributed under MIT license +// +// http://github.com/babysitterjs/backbone.babysitter + +// Backbone.ChildViewContainer +// --------------------------- +// +// Provide a container to store, retrieve and +// shut down child views. + +Backbone.ChildViewContainer = (function(Backbone, _){ + + // Container Constructor + // --------------------- + + var Container = function(views){ + this._views = {}; + this._indexByModel = {}; + this._indexByCustom = {}; + this._updateLength(); + + _.each(views, this.add, this); + }; + + // Container Methods + // ----------------- + + _.extend(Container.prototype, { + + // Add a view to this container. Stores the view + // by `cid` and makes it searchable by the model + // cid (and model itself). Optionally specify + // a custom key to store an retrieve the view. + add: function(view, customIndex){ + var viewCid = view.cid; + + // store the view + this._views[viewCid] = view; + + // index it by model + if (view.model){ + this._indexByModel[view.model.cid] = viewCid; + } + + // index by custom + if (customIndex){ + this._indexByCustom[customIndex] = viewCid; + } + + this._updateLength(); + }, + + // Find a view by the model that was attached to + // it. Uses the model's `cid` to find it. + findByModel: function(model){ + return this.findByModelCid(model.cid); + }, + + // Find a view by the `cid` of the model that was attached to + // it. Uses the model's `cid` to find the view `cid` and + // retrieve the view using it. + findByModelCid: function(modelCid){ + var viewCid = this._indexByModel[modelCid]; + return this.findByCid(viewCid); + }, + + // Find a view by a custom indexer. + findByCustom: function(index){ + var viewCid = this._indexByCustom[index]; + return this.findByCid(viewCid); + }, + + // Find by index. This is not guaranteed to be a + // stable index. + findByIndex: function(index){ + return _.values(this._views)[index]; + }, + + // retrieve a view by it's `cid` directly + findByCid: function(cid){ + return this._views[cid]; + }, + + // Remove a view + remove: function(view){ + var viewCid = view.cid; + + // delete model index + if (view.model){ + delete this._indexByModel[view.model.cid]; + } + + // delete custom index + _.any(this._indexByCustom, function(cid, key) { + if (cid === viewCid) { + delete this._indexByCustom[key]; + return true; + } + }, this); + + // remove the view from the container + delete this._views[viewCid]; + + // update the length + this._updateLength(); + }, + + // Call a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.call`. + call: function(method){ + this.apply(method, _.tail(arguments)); + }, + + // Apply a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.apply`. + apply: function(method, args){ + _.each(this._views, function(view){ + if (_.isFunction(view[method])){ + view[method].apply(view, args || []); + } + }); + }, + + // Update the `.length` attribute on this container + _updateLength: function(){ + this.length = _.size(this._views); + } + }); + + // Borrowing this code from Backbone.Collection: + // http://backbonejs.org/docs/backbone.html#section-106 + // + // Mix in methods from Underscore, for iteration, and other + // collection related features. + var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter', + 'select', 'reject', 'every', 'all', 'some', 'any', 'include', + 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest', + 'last', 'without', 'isEmpty', 'pluck']; + + _.each(methods, function(method) { + Container.prototype[method] = function() { + var views = _.values(this._views); + var args = [views].concat(_.toArray(arguments)); + return _[method].apply(_, args); + }; + }); + + // return the public API + return Container; +})(Backbone, _); diff --git a/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.map b/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.map new file mode 100644 index 000000000..7f0380178 --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.map @@ -0,0 +1 @@ +{"version":3,"file":"lib/backbone.babysitter.min.js","sources":["?"],"names":["Backbone","ChildViewContainer","_","Container","views","this","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray"],"mappings":"AAeAA,SAASC,mBAAqB,SAAUD,EAAUE,GAKhD,GAAIC,GAAY,SAASC,GACvBC,KAAKC,UACLD,KAAKE,iBACLF,KAAKG,kBACLH,KAAKI,gBAELP,EAAEQ,KAAKN,EAAOC,KAAKM,IAAKN,MAM1BH,GAAEU,OAAOT,EAAUU,WAMjBF,IAAK,SAASG,EAAMC,GAClB,GAAIC,GAAUF,EAAKG,GAGnBZ,MAAKC,OAAOU,GAAWF,EAGnBA,EAAKI,QACPb,KAAKE,cAAcO,EAAKI,MAAMD,KAAOD,GAInCD,IACFV,KAAKG,eAAeO,GAAeC,GAGrCX,KAAKI,iBAKP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9B,EAAGiC,MAKvBhC,GACNH,SAAUE"} \ No newline at end of file diff --git a/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.min.js b/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.min.js new file mode 100644 index 000000000..e930c0fff --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.0.6/backbone.babysitter.min.js @@ -0,0 +1,11 @@ +// Backbone.BabySitter +// ------------------- +// v0.0.6 +// +// Copyright (c)2013 Derick Bailey, Muted Solutions, LLC. +// Distributed under MIT license +// +// http://github.com/babysitterjs/backbone.babysitter + +Backbone.ChildViewContainer=function(i,t){var e=function(i){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(i,this.add,this)};t.extend(e.prototype,{add:function(i,t){var e=i.cid;this._views[e]=i,i.model&&(this._indexByModel[i.model.cid]=e),t&&(this._indexByCustom[t]=e),this._updateLength()},findByModel:function(i){return this.findByModelCid(i.cid)},findByModelCid:function(i){var t=this._indexByModel[i];return this.findByCid(t)},findByCustom:function(i){var t=this._indexByCustom[i];return this.findByCid(t)},findByIndex:function(i){return t.values(this._views)[i]},findByCid:function(i){return this._views[i]},remove:function(i){var e=i.cid;i.model&&delete this._indexByModel[i.model.cid],t.any(this._indexByCustom,function(i,t){return i===e?(delete this._indexByCustom[t],!0):void 0},this),delete this._views[e],this._updateLength()},call:function(i){this.apply(i,t.tail(arguments))},apply:function(i,e){t.each(this._views,function(n){t.isFunction(n[i])&&n[i].apply(n,e||[])})},_updateLength:function(){this.length=t.size(this._views)}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(n,function(i){e.prototype[i]=function(){var e=t.values(this._views),n=[e].concat(t.toArray(arguments));return t[i].apply(t,n)}}),e}(Backbone,_); +//@ sourceMappingURL=backbone.babysitter.map \ No newline at end of file diff --git a/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.js b/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.js new file mode 100644 index 000000000..6079697a3 --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.js @@ -0,0 +1,159 @@ +// Backbone.BabySitter +// ------------------- +// v0.1.0 +// +// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC. +// Distributed under MIT license +// +// http://github.com/marionettejs/backbone.babysitter + +// Backbone.ChildViewContainer +// --------------------------- +// +// Provide a container to store, retrieve and +// shut down child views. + +Backbone.ChildViewContainer = (function(Backbone, _){ + + // Container Constructor + // --------------------- + + var Container = function(views){ + this._views = {}; + this._indexByModel = {}; + this._indexByCustom = {}; + this._updateLength(); + + _.each(views, this.add, this); + }; + + // Container Methods + // ----------------- + + _.extend(Container.prototype, { + + // Add a view to this container. Stores the view + // by `cid` and makes it searchable by the model + // cid (and model itself). Optionally specify + // a custom key to store an retrieve the view. + add: function(view, customIndex){ + var viewCid = view.cid; + + // store the view + this._views[viewCid] = view; + + // index it by model + if (view.model){ + this._indexByModel[view.model.cid] = viewCid; + } + + // index by custom + if (customIndex){ + this._indexByCustom[customIndex] = viewCid; + } + + this._updateLength(); + return this; + }, + + // Find a view by the model that was attached to + // it. Uses the model's `cid` to find it. + findByModel: function(model){ + return this.findByModelCid(model.cid); + }, + + // Find a view by the `cid` of the model that was attached to + // it. Uses the model's `cid` to find the view `cid` and + // retrieve the view using it. + findByModelCid: function(modelCid){ + var viewCid = this._indexByModel[modelCid]; + return this.findByCid(viewCid); + }, + + // Find a view by a custom indexer. + findByCustom: function(index){ + var viewCid = this._indexByCustom[index]; + return this.findByCid(viewCid); + }, + + // Find by index. This is not guaranteed to be a + // stable index. + findByIndex: function(index){ + return _.values(this._views)[index]; + }, + + // retrieve a view by its `cid` directly + findByCid: function(cid){ + return this._views[cid]; + }, + + // Remove a view + remove: function(view){ + var viewCid = view.cid; + + // delete model index + if (view.model){ + delete this._indexByModel[view.model.cid]; + } + + // delete custom index + _.any(this._indexByCustom, function(cid, key) { + if (cid === viewCid) { + delete this._indexByCustom[key]; + return true; + } + }, this); + + // remove the view from the container + delete this._views[viewCid]; + + // update the length + this._updateLength(); + return this; + }, + + // Call a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.call`. + call: function(method){ + this.apply(method, _.tail(arguments)); + }, + + // Apply a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.apply`. + apply: function(method, args){ + _.each(this._views, function(view){ + if (_.isFunction(view[method])){ + view[method].apply(view, args || []); + } + }); + }, + + // Update the `.length` attribute on this container + _updateLength: function(){ + this.length = _.size(this._views); + } + }); + + // Borrowing this code from Backbone.Collection: + // http://backbonejs.org/docs/backbone.html#section-106 + // + // Mix in methods from Underscore, for iteration, and other + // collection related features. + var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter', + 'select', 'reject', 'every', 'all', 'some', 'any', 'include', + 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest', + 'last', 'without', 'isEmpty', 'pluck']; + + _.each(methods, function(method) { + Container.prototype[method] = function() { + var views = _.values(this._views); + var args = [views].concat(_.toArray(arguments)); + return _[method].apply(_, args); + }; + }); + + // return the public API + return Container; +})(Backbone, _); diff --git a/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.map b/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.map new file mode 100644 index 000000000..8e5c1ce15 --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.map @@ -0,0 +1 @@ +{"version":3,"file":"lib/backbone.babysitter.min.js","sources":["?"],"names":["Backbone","ChildViewContainer","_","Container","views","this","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray"],"mappings":"AAeAA,SAASC,mBAAqB,SAAUD,EAAUE,GAKhD,GAAIC,GAAY,SAASC,GACvBC,KAAKC,UACLD,KAAKE,iBACLF,KAAKG,k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AQ,SAAU,SACzD,SAAU,SAAU,QAAS,MAAO,OAAQ,MAAO,UACnD,WAAY,SAAU,UAAW,QAAS,UAAW,OACrD,OAAQ,UAAW,UAAW,QAWhC,OATArC,GAAEQ,KAAK6B,EAAS,SAASR,GACvB5B,EAAUU,UAAUkB,GAAU,WAC5B,GAAI3B,GAAQF,EAAEwB,OAAOrB,KAAKC,QACtB6B,GAAQ/B,GAAOoC,OAAOtC,EAAEuC,QAAQP,WACpC,OAAOhC,GAAE6B,GAAQC,MAAM9B,EAAGiC,MAKvBhC,GACNH,SAAUE"} \ No newline at end of file diff --git a/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.min.js b/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.min.js new file mode 100644 index 000000000..4b625587d --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.1.0/backbone.babysitter.min.js @@ -0,0 +1,11 @@ +// Backbone.BabySitter +// ------------------- +// v0.1.0 +// +// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC. +// Distributed under MIT license +// +// http://github.com/marionettejs/backbone.babysitter + +Backbone.ChildViewContainer=function(i,t){var e=function(i){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(i,this.add,this)};t.extend(e.prototype,{add:function(i,t){var e=i.cid;return this._views[e]=i,i.model&&(this._indexByModel[i.model.cid]=e),t&&(this._indexByCustom[t]=e),this._updateLength(),this},findByModel:function(i){return this.findByModelCid(i.cid)},findByModelCid:function(i){var t=this._indexByModel[i];return this.findByCid(t)},findByCustom:function(i){var t=this._indexByCustom[i];return this.findByCid(t)},findByIndex:function(i){return t.values(this._views)[i]},findByCid:function(i){return this._views[i]},remove:function(i){var e=i.cid;return i.model&&delete this._indexByModel[i.model.cid],t.any(this._indexByCustom,function(i,t){return i===e?(delete this._indexByCustom[t],!0):void 0},this),delete this._views[e],this._updateLength(),this},call:function(i){this.apply(i,t.tail(arguments))},apply:function(i,e){t.each(this._views,function(n){t.isFunction(n[i])&&n[i].apply(n,e||[])})},_updateLength:function(){this.length=t.size(this._views)}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(n,function(i){e.prototype[i]=function(){var e=t.values(this._views),n=[e].concat(t.toArray(arguments));return t[i].apply(t,n)}}),e}(Backbone,_); +//@ sourceMappingURL=backbone.babysitter.map \ No newline at end of file diff --git a/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.js b/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.js new file mode 100644 index 000000000..6079697a3 --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.js @@ -0,0 +1,159 @@ +// Backbone.BabySitter +// ------------------- +// v0.1.0 +// +// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC. +// Distributed under MIT license +// +// http://github.com/marionettejs/backbone.babysitter + +// Backbone.ChildViewContainer +// --------------------------- +// +// Provide a container to store, retrieve and +// shut down child views. + +Backbone.ChildViewContainer = (function(Backbone, _){ + + // Container Constructor + // --------------------- + + var Container = function(views){ + this._views = {}; + this._indexByModel = {}; + this._indexByCustom = {}; + this._updateLength(); + + _.each(views, this.add, this); + }; + + // Container Methods + // ----------------- + + _.extend(Container.prototype, { + + // Add a view to this container. Stores the view + // by `cid` and makes it searchable by the model + // cid (and model itself). Optionally specify + // a custom key to store an retrieve the view. + add: function(view, customIndex){ + var viewCid = view.cid; + + // store the view + this._views[viewCid] = view; + + // index it by model + if (view.model){ + this._indexByModel[view.model.cid] = viewCid; + } + + // index by custom + if (customIndex){ + this._indexByCustom[customIndex] = viewCid; + } + + this._updateLength(); + return this; + }, + + // Find a view by the model that was attached to + // it. Uses the model's `cid` to find it. + findByModel: function(model){ + return this.findByModelCid(model.cid); + }, + + // Find a view by the `cid` of the model that was attached to + // it. Uses the model's `cid` to find the view `cid` and + // retrieve the view using it. + findByModelCid: function(modelCid){ + var viewCid = this._indexByModel[modelCid]; + return this.findByCid(viewCid); + }, + + // Find a view by a custom indexer. + findByCustom: function(index){ + var viewCid = this._indexByCustom[index]; + return this.findByCid(viewCid); + }, + + // Find by index. This is not guaranteed to be a + // stable index. + findByIndex: function(index){ + return _.values(this._views)[index]; + }, + + // retrieve a view by its `cid` directly + findByCid: function(cid){ + return this._views[cid]; + }, + + // Remove a view + remove: function(view){ + var viewCid = view.cid; + + // delete model index + if (view.model){ + delete this._indexByModel[view.model.cid]; + } + + // delete custom index + _.any(this._indexByCustom, function(cid, key) { + if (cid === viewCid) { + delete this._indexByCustom[key]; + return true; + } + }, this); + + // remove the view from the container + delete this._views[viewCid]; + + // update the length + this._updateLength(); + return this; + }, + + // Call a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.call`. + call: function(method){ + this.apply(method, _.tail(arguments)); + }, + + // Apply a method on every view in the container, + // passing parameters to the call method one at a + // time, like `function.apply`. + apply: function(method, args){ + _.each(this._views, function(view){ + if (_.isFunction(view[method])){ + view[method].apply(view, args || []); + } + }); + }, + + // Update the `.length` attribute on this container + _updateLength: function(){ + this.length = _.size(this._views); + } + }); + + // Borrowing this code from Backbone.Collection: + // http://backbonejs.org/docs/backbone.html#section-106 + // + // Mix in methods from Underscore, for iteration, and other + // collection related features. + var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter', + 'select', 'reject', 'every', 'all', 'some', 'any', 'include', + 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest', + 'last', 'without', 'isEmpty', 'pluck']; + + _.each(methods, function(method) { + Container.prototype[method] = function() { + var views = _.values(this._views); + var args = [views].concat(_.toArray(arguments)); + return _[method].apply(_, args); + }; + }); + + // return the public API + return Container; +})(Backbone, _); diff --git a/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.map b/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.map new file mode 100644 index 000000000..8e5c1ce15 --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.map @@ -0,0 +1 @@ +{"version":3,"file":"lib/backbone.babysitter.min.js","sources":["?"],"names":["Backbone","ChildViewContainer","_","Container","views","this","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray"],"mappings":"AAeAA,SAASC,mBAAqB,SAAUD,EAAUE,GAKhD,GAAIC,GAAY,SAASC,GACvBC,KAAKC,UACLD,KAAKE,iBACLF,KAAKG,kBACLH,KAAKI,gBAELP,EAAEQ,KAAKN,EAAOC,KAAKM,IAAKN,MAM1BH,GAAEU,OAAOT,EAAUU,WAMjBF,IAAK,SAASG,EAAMC,GAClB,GAAIC,GAAUF,EAAKG,GAgBnB,OAbAZ,MAAKC,OAAOU,GAAWF,EAGnBA,EAAKI,QACPb,KAAKE,cAAcO,EAAKI,MAAMD,KAAOD,GAInCD,IACFV,KAAKG,eAAeO,GAAeC,GAGrCX,KAAKI,gBACEJ,MAKTc,YAAa,SAASD,GACpB,MAAOb,MAAKe,eAAeF,EAAMD,MAMnCG,eAAgB,SAASC,GACvB,GAAIL,GAAUX,KAAKE,cAAcc,EACjC,OAAOhB,MAAKiB,UAAUN,IAIxBO,aAAc,SAASC,GACrB,GAAIR,GAAUX,KAAKG,eAAegB,EAClC,OAAOnB,MAAKiB,UAAUN,IAKxBS,YAAa,SAASD,GACpB,MAAOtB,GAAEwB,OAAOrB,KAAKC,QAAQkB,IAI/BF,UAAW,SAASL,GAClB,MAAOZ,MAAKC,OAAOW,IAIrBU,OAAQ,SAASb,GACf,GAAIE,GAAUF,EAAKG,GAoBnB,OAjBIH,GAAKI,aACAb,MAAKE,cAAcO,EAAKI,MAAMD,KAIvCf,EAAE0B,IAAIvB,KAAKG,eAAgB,SAASS,EAAKY,GACvC,MAAIZ,KAAQD,SACHX,MAAKG,eAAeqB,IACpB,GAFT,QAICxB,YAGIA,MAAKC,OAAOU,GAGnBX,KAAKI,gBACEJ,MAMTyB,KAAM,SAASC,GACb1B,KAAK2B,MAAMD,EAAQ7B,EAAE+B,KAAKC,aAM5BF,MAAO,SAASD,EAAQI,GACtBjC,EAAEQ,KAAKL,KAAKC,OAAQ,SAASQ,GACvBZ,EAAEkC,WAAWtB,EAAKiB,KACpBjB,EAAKiB,GAAQC,MAAMlB,EAAMqB,UAM/B1B,cAAe,WACbJ,KAAKgC,OAASnC,EAAEoC,KAAKjC,KAAKC,UAS9B,IAAIiC,IAAW,UAAW,OAAQ,MAAO,OAAQ,SAAU,SACzD,SAAU,SAAU,QAAS,MAAO,OAAQ,MAAO,UACnD,WAAY,SAAU,UAAW,QAAS,UAAW,OACrD,OAAQ,UAAW,UAAW,QAWhC,OATArC,GAAEQ,KAAK6B,EAAS,SAASR,GACvB5B,EAAUU,UAAUkB,GAAU,WAC5B,GAAI3B,GAAQF,EAAEwB,OAAOrB,KAAKC,QACtB6B,GAAQ/B,GAAOoC,OAAOtC,EAAEuC,QAAQP,WACpC,OAAOhC,GAAE6B,GAAQC,MAAM9B,EAAGiC,MAKvBhC,GACNH,SAAUE"} \ No newline at end of file diff --git a/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.min.js b/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.min.js new file mode 100644 index 000000000..4b625587d --- /dev/null +++ b/ajax/libs/backbone.babysitter/0.1.1/backbone.babysitter.min.js @@ -0,0 +1,11 @@ +// Backbone.BabySitter +// ------------------- +// v0.1.0 +// +// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC. +// Distributed under MIT license +// +// http://github.com/marionettejs/backbone.babysitter + +Backbone.ChildViewContainer=function(i,t){var e=function(i){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(i,this.add,this)};t.extend(e.prototype,{add:function(i,t){var e=i.cid;return this._views[e]=i,i.model&&(this._indexByModel[i.model.cid]=e),t&&(this._indexByCustom[t]=e),this._updateLength(),this},findByModel:function(i){return this.findByModelCid(i.cid)},findByModelCid:function(i){var t=this._indexByModel[i];return this.findByCid(t)},findByCustom:function(i){var t=this._indexByCustom[i];return this.findByCid(t)},findByIndex:function(i){return t.values(this._views)[i]},findByCid:function(i){return this._views[i]},remove:function(i){var e=i.cid;return i.model&&delete this._indexByModel[i.model.cid],t.any(this._indexByCustom,function(i,t){return i===e?(delete this._indexByCustom[t],!0):void 0},this),delete this._views[e],this._updateLength(),this},call:function(i){this.apply(i,t.tail(arguments))},apply:function(i,e){t.each(this._views,function(n){t.isFunction(n[i])&&n[i].apply(n,e||[])})},_updateLength:function(){this.length=t.size(this._views)}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(n,function(i){e.prototype[i]=function(){var e=t.values(this._views),n=[e].concat(t.toArray(arguments));return t[i].apply(t,n)}}),e}(Backbone,_); +//@ sourceMappingURL=backbone.babysitter.map \ No newline at end of file