summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/wp-backbone.min.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:56:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:56:49 +0000
commita415c29efee45520ae252d2aa28f1083a521cd7b (patch)
treef4ade4b6668ecc0765de7e1424f7c1427ad433ff /wp-includes/js/wp-backbone.min.js
parentInitial commit. (diff)
downloadwordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.tar.xz
wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.zip
Adding upstream version 6.4.3+dfsg1.upstream/6.4.3+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/js/wp-backbone.min.js')
-rw-r--r--wp-includes/js/wp-backbone.min.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/wp-includes/js/wp-backbone.min.js b/wp-includes/js/wp-backbone.min.js
new file mode 100644
index 0000000..71a8f04
--- /dev/null
+++ b/wp-includes/js/wp-backbone.min.js
@@ -0,0 +1,2 @@
+/*! This file is auto-generated */
+window.wp=window.wp||{},function(e){wp.Backbone={},wp.Backbone.Subviews=function(e,t){this.view=e,this._views=_.isArray(t)?{"":t}:t||{}},wp.Backbone.Subviews.extend=Backbone.Model.extend,_.extend(wp.Backbone.Subviews.prototype,{all:function(){return _.flatten(_.values(this._views))},get:function(e){return this._views[e=e||""]},first:function(e){e=this.get(e);return e&&e.length?e[0]:null},set:function(i,e,t){var n,s;return _.isString(i)||(t=e,e=i,i=""),t=t||{},s=e=_.isArray(e)?e:[e],(n=this.get(i))&&(t.add?_.isUndefined(t.at)?s=n.concat(e):(s=n).splice.apply(s,[t.at,0].concat(e)):(_.each(s,function(e){e.__detach=!0}),_.each(n,function(e){e.__detach?e.$el.detach():e.remove()}),_.each(s,function(e){delete e.__detach}))),this._views[i]=s,_.each(e,function(e){var t=e.Views||wp.Backbone.Subviews,t=e.views=e.views||new t(e);t.parent=this.view,t.selector=i},this),t.silent||this._attach(i,e,_.extend({ready:this._isReady()},t)),this},add:function(e,t,i){return _.isString(e)||(i=t,t=e,e=""),this.set(e,t,_.extend({add:!0},i))},unset:function(e,t,i){var n;return _.isString(e)||(i=t,t=e,e=""),t=t||[],(n=this.get(e))&&(t=_.isArray(t)?t:[t],this._views[e]=t.length?_.difference(n,t):[]),i&&i.silent||_.invoke(t,"remove"),this},detach:function(){return e(_.pluck(this.all(),"el")).detach(),this},render:function(){var i={ready:this._isReady()};return _.each(this._views,function(e,t){this._attach(t,e,i)},this),this.rendered=!0,this},remove:function(e){return e&&e.silent||(this.parent&&this.parent.views&&this.parent.views.unset(this.selector,this.view,{silent:!0}),delete this.parent,delete this.selector),_.invoke(this.all(),"remove"),this._views=[],this},replace:function(e,t){return e.html(t),this},insert:function(e,t,i){var n,i=i&&i.at;return _.isNumber(i)&&(n=e.children()).length>i?n.eq(i).before(t):e.append(t),this},ready:function(){this.view.trigger("ready"),_.chain(this.all()).map(function(e){return e.views}).flatten().where({attached:!0}).invoke("ready")},_attach:function(e,t,i){var n,e=e?this.view.$(e):this.view.$el;return e.length&&(n=_.chain(t).pluck("views").flatten().value(),_.each(n,function(e){e.rendered||(e.view.render(),e.rendered=!0)},this),this[i.add?"insert":"replace"](e,_.pluck(t,"el"),i),_.each(n,function(e){e.attached=!0,i.ready&&e.ready()},this)),this},_isReady:function(){for(var e=this.view.el;e;){if(e===document.body)return!0;e=e.parentNode}return!1}}),wp.Backbone.View=Backbone.View.extend({Subviews:wp.Backbone.Subviews,constructor:function(e){this.views=new this.Subviews(this,this.views),this.on("ready",this.ready,this),this.options=e||{},Backbone.View.apply(this,arguments)},remove:function(){var e=Backbone.View.prototype.remove.apply(this,arguments);return this.views&&this.views.remove(),e},render:function(){var e;return this.prepare&&(e=this.prepare()),this.views.detach(),this.template&&(this.trigger("prepare",e=e||{}),this.$el.html(this.template(e))),this.views.render(),this},prepare:function(){return this.options},ready:function(){}})}(jQuery); \ No newline at end of file