����C %# , #&')*)-0-(0%()(��C (((((((((((((((((((((((((((((((((((((((((((((((((((����"�������@�@�hC��}!���Ѱ��<"� 9iׂIIIHk�+?�c?��*Y�����!�du)b�T�9вU�$8G��I.�澬��D���Sq� q�}.<��Z�l�V!X� *x�-�\����t3i�Ũ�sNv71�ƛ\��z|t�L���$�����*f��kʮ��7�H;���~F%�'3�@�H�q�` 9mOL����/x@ @��G
d�8F�ه��Ka�Kdr�Fh.�]y4 JЛ��]�K�B�E$��$ $ �PR�����G�]��u�i$�$���'! "#031���C/Td=S�Q?���62Ccj{ ����̏d�چ/c�V�`��Wz͈�{Y`�d�h�L �]OB���l���o���mr���n��s-ڗEZ��N�_��1%b���H�ϣ������V�7):�ӷ)�}�~�(�;�!�b1�5K��[E�vϻ>��q.%� ���O���(�c�#x�$�'+��`٥v��v(�����M�"�v��B��.�a ���T�~�ϕ�hy(6nݱl��1yNɓx�������AR�8�rqv1.cS�+��_���&@�� �u�M�5Ĉ�Xm���eL�X�q��y#�9]�c�}ɄL��d�eJ몓���I1T�d��CaM�$��T�,�X �bʭ�!�%F5��X1x#���!�q��\��F��2��&Rq���C�ol~�̱�.0ϦL�d�`.������ ���m{�Y~k{C��}bv�;U��c<�r�~ɜs�1�j��]W�l��*նCr��Q�N9�-������d��E؛��nF��eړ�8(q��5UgRȱGTA��*������̆��V�珰����ezN��h�U]�T�FG�^���<��ay�,!���5.� �u�bΚ�V�J%��m�Dxn'�����6�@BPa�`��Hts� �ɮ���Ŏ�Zɬ��%B�X��d5Z���hC}�䅸�p+ k=��ʒ(�aՏFG&�%@/�{+�Yu+�ȣGѩ"O%�|vȲxF>�N(��ou�h6 &Y5��8�7�E$-��']n,@TD\��+���Ry�U��U^�Q,f>��1�����q��f��U��� ����F���ڥ��>I�����fNUw�u��#OMMQ6� N�*��_�� k� ����rS��`���1�:��!�F'<+� � b?O��2 !Q12A��� "3a������#$��?�,�7�!`yǮ(�1�6w��a���� �F�#��?*"s���v>��Ⱥ����f�v��͑���s����������]Gn��S ���ȥpG ы�E�g�)Z���x�rY�q�]�@f�_܃�pչEڎّC ����Ŝ*/ �h�O�Sv�و\��5��U��y��|o�Hm2C�S�BW����)��5��{T��W���=o*RA��<����L0g4{��쁢�ep�rw�8��7��U���t<Ԍѻ7�fGf�k}���Ê�㛆Gռz�Q@��{C��'G��8�!�S$�j��x���|���צV<��,����u�k�uu�rM�f�_dϣi ߫�ԟn�!K����mxu�=�槻�'j�X�����������%!A "1QR#Br��?�R:��R�n�b[�II?#��6<:�$gN����lGNlrr��dעMMn`ɿy�,�%B�e�W��dVS��r���� %�tT��(�ɷ��S�]�O]#�_LEMHN�M���kv���~X���O6�U�V_�����b���J�t�774����D!1AQa"2q�#3BRb����0���� 4CSr����cst�����?��^q���7�dG�U�"p��moz��'��n_x���唹e������<6��O�t���R>k��s=�Cr���e�?�i��� ����/��ں$be���o`ޮ�GHy�;fNAl�8��.�\�S������"���a�úF�YvNk�-*`v�k�ʈ2f�EE��Wa�,� �fF^#�;��[9��^~������Y$:0#W3������Z*���I�Z�ڹ�k�n--9=��G��;7F)m{T�Ɇ��=�����Ȭ5�5�B�aڞ5M����#m�5Ʀ��m�8��+Hh���$�}�:&�e�Q�[;i]С�:�:��o����$<~��5RB�?�s3�5�r��O��ֿ�w�P/��̅���(�Z6�R>)��N��4�!ʊ�wz�-�r�w+�yk���q�1�bKhƸ�4N�Ӑ�X����Q��_��})�+e1�5��n��q?��[�^�9�<�z3Fsi�8�'�)9p)�{��RP�Z+�*��p(aY��V����6l�g�9��;���d�u���Nt@�3�sTwzaŇ�GT�b�H��(#��*zc�������9K�b1�����t����Ê��
�Z?g�iD���H�R���B���^M����v���O���L�D,'d�q�C�P�����$Δ��U�֟֊=�s��F�$��J�ދZ?�N��������A�N�WP��,�� �¦�&;�x��dup�����i���Ipd���;�Dž!��ֿѮAb%�u��}j��-p��>I�[�N�bi����G�'�;4w�m]H�]����#LӘNN��R��������s�.]��en��-�8e��Ps����Q��;���ț�E�ݫ���7��g�_L��W��EZ:/��I���a�g�n�ܤ��iٹ���ŷ�T���H~i�a�����֎�~KV������ A-2m]�F"�m�9-Zbǰ�״ @����~�4�N�[�Uxč�tl>������u#r�gѐ�3���;M9�<�J�����1�vfL8����1�P�HgP�Xv��������{����O�}�n��KQ؋����7<�l�fey<�}�>�bX���4<`Y7���si��V)�s�:�{�rO�h�z �@4VW�B���&�������ɡob܋�F��4>y�s�fXWS�N�O$�,.u:�ԫ��g�yao4��$h��D#��ٸf^kh�7�#1Z�֥&���*�v-��;bޭ����Q�����h�ow�y]�ه.+�7�M�ⴻ �JY��g�f�i3q��KC��3�¹�?5�Z.N��^Z w���KF͂���7��ރ۞��wj��T�J.�q��\Sv1U����R��욽&�N����pЖ`�`у��m`v�n#z��4��>e��V�`'���h�����'�j�AҔ�-�4:H���n]9�h<��n����U�6m��2c�E�1/�Y�%���I��~ʏ�|VBƟ@����;�������%�M9M���}��1�D��d����%g���O��]��у&�r��f�7�uܲ���(!1AQaq�������0� ���?!��*��@)�Je�G��j��{�['��v+���������)���(�/����д%젍Z��kk�Lu�Rm���j.c���@Z� V�J��d��j���h6���2AO�� a;oBu���H�=���nK�W8�B�ɰ�u?��бأm,�sr����|����8˨i��qI2tZ�ۄJP��XE��������zޔj~]UMu����zv!����N�&�1�Y��zJ�ՠ��\p��o'ሸ�C؊Y��TD"HM5�Ъ��i߯a���F����A)�����ڮ����z�E���@�hg�֝8�1jk��\�M�3�8ܢ�� ������s�7����N}�ޭ������GN�Bc���L pk�;�J�δ3�e�iU�gAYW]\�>�GyگQ=��f�KA;T�a`eM+Q �� �Ln���̌]GM�����<Ħ�j���H��N�M�x�}aX{̣S� ��ԅ��n�MA�S�r�(����(�L��zo9���.�;
�ӳf������`Ӕ٢3�� IW��\9~_���saa�\ԊW�ܭX:���ӆ�38�ty*����N�qP����BI�Y��jE��>DP�!�R%-��4��'�皺;��~J�!�7m���X��h�P!曭���$�\�AYj�.lC��4��+�jD�dgC0-*���|��`ZD�+л�C"��)��s��8Kq�pq���Ms��4� ��7\U`�.��[Ey8��AH!/��,���(:M -�T䓥�~O�4-���Ԓn��}HDN7���K���$�_Ԕ䚞`�R�hB�_aX?4V��ŗ�@ه�u�a�;�{PcT+�������7YBo�?��r-ͩ{�ĎA�� ����˼n��M286��G���1���V�˜Jв"l��V5���5�C]h���̊�A���%� �'p���Ԃ���Ր��9=�d�=�e�{�'<3�_ �:^�~��4�(�n�-C�s��5m![�jmIqU�~�Tw8��`���p�H8�u�Д l m�aP�0�������9y����CM��F1G糞�.�U~�������FC�{�!e(Y�:���P����7~;�L�N^{�1r�\���ԬG(���0d�ÏO�qK�Z�⑼�T�{ 2��s��Kd�Տ?mMQ��=���6�7�i�����H+����9��d��=��;�QؤH8n�Lb�D��yS%�(�{b���Cu���p�t#C���$A"�H{���jqᶯ�:�n=E����hH�`�!�m��MA������?�v6���+MԿ⟚qK�i�D�*Q5��CZ���2�|]�:Xd+�t�:o@��M��� :�32��b����[\5=�ֵ7])�|t��Ϻ����w�B�ń�e���!`�:��I,��9:����j@/a 8����+<�u�(T^ۺ~��2oE�B�%b)��z��ݳځ�)��i�j��&��Fi`qr��w���7�@��P�� �3Z&<�m�S�C����7t�T����ƴ�q~J�e�r6�Z]�rL���ه�E17'�x���+[�ܜTc6�/�����W�`�qpMJ���N5^����x�}{l�Fm������1�oZ\�����/d�/6� �uӸ�0elXuX;M��$M�}mB��������Z%e���3f�js����O�J~2�z�86�*PB��v�Ν��e-��.�/��L�O����2����9���4}|��T5M���hÐ7�F*��l+y0����:|��=k[�d�;|�ԉe�=w�<��õ�<��'!1AQaq����� ������?��5����)�(���+>v����6&{���Ǹ@����M�����v��iA 6T'�w��h�s �E}�x��G&'g�� J~1q�f�f���&��q˘���-���vYm
�/i1 �I��6��u,)�#�,����l}*&`�$�ͬe�%�w3�x�Ѥ�Xc�D��执g�峕�5B/�|$��=���%8 a��2.l� c�@G� �\�/x[өq�]�v5?�����N|�!���\��,>��{�"r�/��?��&!1QAa�� ��ᑱ����?ĊD�肭�� nv@�yޝ (�����I ����U - ���b�m�E>,��1v!�d�&�� ���&�檔�5D�&0P��Ԕ�͒@Z��:E"� Q��`>PH:~�O�����P�3W��@hM��k�U��\�O��R�������5ʄ�,��f�|��r���}јxo)�"+h�QK���/��0�`�5�{M~�� ���'!1AQaq���0 �������?�?�k��#^�~�G��#V,������#Z�1'ܤ����������~p�O%O�O�\�q�`�~��}��E�Ű5 �輸�du����x\�$���s[�{T2t`B��gq�4Z]b� 㛪�3,(@����bAp�r)9:@|b�!r�g:N�^�Ʌ��� �x_�\��pm7I��0?>^k��������w���|.K�[sF@�]Gn*L �yO� le�P�.p��֍�j�S�=�ʨ�ןQF�"��5zʼn���k�*8�u" ����Fg��� �cSy�V������Ƈ��N��ؐ(�����48hV�A�ӎ^��^ ���jyB� ��p"�����y]�ļlU�(�7�U`3�pCGF'&yg������o��z������X��ν:�P"@�G@x[��o&MJ�$F.����hi w;}�/^͇q���n�mN�/�TQ���އ��O1\,}��bQ #¯^S!)��X���#GPȏ�t�� c^\��' }iIZ���a�)��������z��4͊�Ξy��48,��f���#�����KP!Jx�|w�ʆ�������������#��Z�������< �~K��r�p&qH/;�R���沽�+�E�R���~0v���V#ʀ�T��S(-ڝ��B�y�b�C�D������b��������8��~�= �Y�ͧ]��@n����M�k2�%�;�%,�r6�LR腻?^��;KŇ=�ք ���=`�ɥ��/����z�&�I{���#J��M���C��}�H9^UJ�,P ��pS����G�d69Ϭu���%"��ˢP��K�"k)��=��9� ����㇌,��Oli��Xzh� " � ������R��^�s����N�k��Q>�63(���� ��PQ�Py�����3����$f+W՛=4�ǁ`*��^��Eb�K�t�6��^��!�籷��ȭ��K{/;�L���p�x�����;a���Oلz�[�.NP4�]Gc�T�v����~sg'LED��]j��'�G�]�6rY����UPw�*O�İՋi�'8�۴�#g�Xx+=�eU6�R��c�"�u2��~�?n�y�;�u��3�'��6�f������b��߬M�$*��k&?6���*^1n����ێz)<��Gz� �����7����Y� ��ۃ)$A��2�L6� ե�H�<�r��#ʽ2��O��R���z�A��XW��@���������<�G� Ϥ�^�˓i�M�W���6 ��0��m){c�;ݧ�>R�a����}1�ٯ%�EY2�Q��Ep���$ ��E��qS��t#+x� *�h�UI��XM?�'//��a'�G�����q@���<��z��؟����cd��z�ˬT_u�Ѯ����&�z�k ��n ]�a%�py»�`Qd�xc������n�� ��*��oTd�;'j�<�!j���'�(~�ʹW�M� P�mȘ��@֨V+��R�`�$��`�+@��_[�kG����P���Zh9�R����&5b�v���Z���#p�&�Ա+��8�etZ7G���;��@"�e0���v7����?��z�?_���_�q1�T�"�p�ˎ/U 6_�B�>��0( ��}G#������Ȣ�p�� �9��;/& `�B&$�y��t(�*z�x���Ӕ������S�?Kȏ3���{p� b � ۍ-�z܈֦��6?<���ǬP�N�G �更� �6�/h�����0Z���������i�ua��e�*M'A� �x��v�q.>�F� oN{��Q���{gD��L��u��=|���O xN���d���q�8(��E�Uu��,��O� t�DJ ����;��G����e���C��VYZ�� ���T4{����(�Ӳ'c�t�f��w�c�jr�e�m �#7,�6��B�E4Q�P�.P�(&��^{9H-�m�o ��q�g1���=��>p�)/"p0!4�mS6ú�FN���h��D �)��XdT �FؤZ⸚�k���H�c8v� <���u�P�Հ���:��_�EN��|�ӛ��u?-�/�o�Lhk�ܸ�S�;�Rī�����T"�N����M��px7<�� j�$��`�Y)Pjh 5` K�Qf�4�C�bX"�D���;HD�Z�9R b�F)�UA����v�#��HD�!{������>I� �`�ԁ i�4�)t*�ç�Le�_���>ru�GEQg��ǔct��ō0��l6v���d�� ��GG8���v^�|�#JyZPSO�� Y�CuAߐ�"�x���OfHF@�K�V�!少Eҕ]h� ��[���)��.q����*0I<8��^�6�}p��^tho���ig�i����DK���p,��2�3�I��5����쓄OY�6s7Qs�Ow^�w�J/�A➰������0������g(Մ��y��Kԇ����QS��?H���w�X�=��ҞX�~���Q=�'���p?7�@g�~�G�}�r��g�T?���
One Hat Cyber Team
One Hat Cyber Team
Your IP :
3.144.119.207
Server IP :
172.67.155.96
Server :
Linux server3.shared.spaceship.host 4.18.0-372.9.1.1.lve.el8.x86_64 #1 SMP Tue May 24 07:49:22 EDT 2022 x86_64
Server Software :
LiteSpeed
PHP Version :
5.6.40
Buat File
|
Buat Folder
Dir :
~
/
home
/
rlcugxuggt
/
lutsstore.com
/
wp-admin
/
js
/
View File Name :
theme-plugin-editor.js
/** * @output wp-admin/js/theme-plugin-editor.js */ /* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1] }] */ if ( ! window.wp ) { window.wp = {}; } wp.themePluginEditor = (function( $ ) { 'use strict'; var component, TreeLinks, __ = wp.i18n.__, _n = wp.i18n._n, sprintf = wp.i18n.sprintf; component = { codeEditor: {}, instance: null, noticeElements: {}, dirty: false, lintErrors: [] }; /** * Initialize component. * * @since 4.9.0 * * @param {jQuery} form - Form element. * @param {Object} settings - Settings. * @param {Object|boolean} settings.codeEditor - Code editor settings (or `false` if syntax highlighting is disabled). * @return {void} */ component.init = function init( form, settings ) { component.form = form; if ( settings ) { $.extend( component, settings ); } component.noticeTemplate = wp.template( 'wp-file-editor-notice' ); component.noticesContainer = component.form.find( '.editor-notices' ); component.submitButton = component.form.find( ':input[name=submit]' ); component.spinner = component.form.find( '.submit .spinner' ); component.form.on( 'submit', component.submit ); component.textarea = component.form.find( '#newcontent' ); component.textarea.on( 'change', component.onChange ); component.warning = $( '.file-editor-warning' ); component.docsLookUpButton = component.form.find( '#docs-lookup' ); component.docsLookUpList = component.form.find( '#docs-list' ); if ( component.warning.length > 0 ) { component.showWarning(); } if ( false !== component.codeEditor ) { /* * Defer adding notices until after DOM ready as workaround for WP Admin injecting * its own managed dismiss buttons and also to prevent the editor from showing a notice * when the file had linting errors to begin with. */ _.defer( function() { component.initCodeEditor(); } ); } $( component.initFileBrowser ); $( window ).on( 'beforeunload', function() { if ( component.dirty ) { return __( 'The changes you made will be lost if you navigate away from this page.' ); } return undefined; } ); component.docsLookUpList.on( 'change', function() { var option = $( this ).val(); if ( '' === option ) { component.docsLookUpButton.prop( 'disabled', true ); } else { component.docsLookUpButton.prop( 'disabled', false ); } } ); }; /** * Set up and display the warning modal. * * @since 4.9.0 * @return {void} */ component.showWarning = function() { // Get the text within the modal. var rawMessage = component.warning.find( '.file-editor-warning-message' ).text(); // Hide all the #wpwrap content from assistive technologies. $( '#wpwrap' ).attr( 'aria-hidden', 'true' ); // Detach the warning modal from its position and append it to the body. $( document.body ) .addClass( 'modal-open' ) .append( component.warning.detach() ); // Reveal the modal and set focus on the go back button. component.warning .removeClass( 'hidden' ) .find( '.file-editor-warning-go-back' ).trigger( 'focus' ); // Get the links and buttons within the modal. component.warningTabbables = component.warning.find( 'a, button' ); // Attach event handlers. component.warningTabbables.on( 'keydown', component.constrainTabbing ); component.warning.on( 'click', '.file-editor-warning-dismiss', component.dismissWarning ); // Make screen readers announce the warning message after a short delay (necessary for some screen readers). setTimeout( function() { wp.a11y.speak( wp.sanitize.stripTags( rawMessage.replace( /\s+/g, ' ' ) ), 'assertive' ); }, 1000 ); }; /** * Constrain tabbing within the warning modal. * * @since 4.9.0 * @param {Object} event jQuery event object. * @return {void} */ component.constrainTabbing = function( event ) { var firstTabbable, lastTabbable; if ( 9 !== event.which ) { return; } firstTabbable = component.warningTabbables.first()[0]; lastTabbable = component.warningTabbables.last()[0]; if ( lastTabbable === event.target && ! event.shiftKey ) { firstTabbable.focus(); event.preventDefault(); } else if ( firstTabbable === event.target && event.shiftKey ) { lastTabbable.focus(); event.preventDefault(); } }; /** * Dismiss the warning modal. * * @since 4.9.0 * @return {void} */ component.dismissWarning = function() { wp.ajax.post( 'dismiss-wp-pointer', { pointer: component.themeOrPlugin + '_editor_notice' }); // Hide modal. component.warning.remove(); $( '#wpwrap' ).removeAttr( 'aria-hidden' ); $( 'body' ).removeClass( 'modal-open' ); }; /** * Callback for when a change happens. * * @since 4.9.0 * @return {void} */ component.onChange = function() { component.dirty = true; component.removeNotice( 'file_saved' ); }; /** * Submit file via Ajax. * * @since 4.9.0 * @param {jQuery.Event} event - Event. * @return {void} */ component.submit = function( event ) { var data = {}, request; event.preventDefault(); // Prevent form submission in favor of Ajax below. $.each( component.form.serializeArray(), function() { data[ this.name ] = this.value; } ); // Use value from codemirror if present. if ( component.instance ) { data.newcontent = component.instance.codemirror.getValue(); } if ( component.isSaving ) { return; } // Scroll to the line that has the error. if ( component.lintErrors.length ) { component.instance.codemirror.setCursor( component.lintErrors[0].from.line ); return; } component.isSaving = true; component.textarea.prop( 'readonly', true ); if ( component.instance ) { component.instance.codemirror.setOption( 'readOnly', true ); } component.spinner.addClass( 'is-active' ); request = wp.ajax.post( 'edit-theme-plugin-file', data ); // Remove previous save notice before saving. if ( component.lastSaveNoticeCode ) { component.removeNotice( component.lastSaveNoticeCode ); } request.done( function( response ) { component.lastSaveNoticeCode = 'file_saved'; component.addNotice({ code: component.lastSaveNoticeCode, type: 'success', message: response.message, dismissible: true }); component.dirty = false; } ); request.fail( function( response ) { var notice = $.extend( { code: 'save_error', message: __( 'Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.' ) }, response, { type: 'error', dismissible: true } ); component.lastSaveNoticeCode = notice.code; component.addNotice( notice ); } ); request.always( function() { component.spinner.removeClass( 'is-active' ); component.isSaving = false; component.textarea.prop( 'readonly', false ); if ( component.instance ) { component.instance.codemirror.setOption( 'readOnly', false ); } } ); }; /** * Add notice. * * @since 4.9.0 * * @param {Object} notice - Notice. * @param {string} notice.code - Code. * @param {string} notice.type - Type. * @param {string} notice.message - Message. * @param {boolean} [notice.dismissible=false] - Dismissible. * @param {Function} [notice.onDismiss] - Callback for when a user dismisses the notice. * @return {jQuery} Notice element. */ component.addNotice = function( notice ) { var noticeElement; if ( ! notice.code ) { throw new Error( 'Missing code.' ); } // Only let one notice of a given type be displayed at a time. component.removeNotice( notice.code ); noticeElement = $( component.noticeTemplate( notice ) ); noticeElement.hide(); noticeElement.find( '.notice-dismiss' ).on( 'click', function() { component.removeNotice( notice.code ); if ( notice.onDismiss ) { notice.onDismiss( notice ); } } ); wp.a11y.speak( notice.message ); component.noticesContainer.append( noticeElement ); noticeElement.slideDown( 'fast' ); component.noticeElements[ notice.code ] = noticeElement; return noticeElement; }; /** * Remove notice. * * @since 4.9.0 * * @param {string} code - Notice code. * @return {boolean} Whether a notice was removed. */ component.removeNotice = function( code ) { if ( component.noticeElements[ code ] ) { component.noticeElements[ code ].slideUp( 'fast', function() { $( this ).remove(); } ); delete component.noticeElements[ code ]; return true; } return false; }; /** * Initialize code editor. * * @since 4.9.0 * @return {void} */ component.initCodeEditor = function initCodeEditor() { var codeEditorSettings, editor; codeEditorSettings = $.extend( {}, component.codeEditor ); /** * Handle tabbing to the field before the editor. * * @since 4.9.0 * * @return {void} */ codeEditorSettings.onTabPrevious = function() { $( '#templateside' ).find( ':tabbable' ).last().trigger( 'focus' ); }; /** * Handle tabbing to the field after the editor. * * @since 4.9.0 * * @return {void} */ codeEditorSettings.onTabNext = function() { $( '#template' ).find( ':tabbable:not(.CodeMirror-code)' ).first().trigger( 'focus' ); }; /** * Handle change to the linting errors. * * @since 4.9.0 * * @param {Array} errors - List of linting errors. * @return {void} */ codeEditorSettings.onChangeLintingErrors = function( errors ) { component.lintErrors = errors; // Only disable the button in onUpdateErrorNotice when there are errors so users can still feel they can click the button. if ( 0 === errors.length ) { component.submitButton.toggleClass( 'disabled', false ); } }; /** * Update error notice. * * @since 4.9.0 * * @param {Array} errorAnnotations - Error annotations. * @return {void} */ codeEditorSettings.onUpdateErrorNotice = function onUpdateErrorNotice( errorAnnotations ) { var noticeElement; component.submitButton.toggleClass( 'disabled', errorAnnotations.length > 0 ); if ( 0 !== errorAnnotations.length ) { noticeElement = component.addNotice({ code: 'lint_errors', type: 'error', message: sprintf( /* translators: %s: Error count. */ _n( 'There is %s error which must be fixed before you can update this file.', 'There are %s errors which must be fixed before you can update this file.', errorAnnotations.length ), String( errorAnnotations.length ) ), dismissible: false }); noticeElement.find( 'input[type=checkbox]' ).on( 'click', function() { codeEditorSettings.onChangeLintingErrors( [] ); component.removeNotice( 'lint_errors' ); } ); } else { component.removeNotice( 'lint_errors' ); } }; editor = wp.codeEditor.initialize( $( '#newcontent' ), codeEditorSettings ); editor.codemirror.on( 'change', component.onChange ); // Improve the editor accessibility. $( editor.codemirror.display.lineDiv ) .attr({ role: 'textbox', 'aria-multiline': 'true', 'aria-labelledby': 'theme-plugin-editor-label', 'aria-describedby': 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4' }); // Focus the editor when clicking on its label. $( '#theme-plugin-editor-label' ).on( 'click', function() { editor.codemirror.focus(); }); component.instance = editor; }; /** * Initialization of the file browser's folder states. * * @since 4.9.0 * @return {void} */ component.initFileBrowser = function initFileBrowser() { var $templateside = $( '#templateside' ); // Collapse all folders. $templateside.find( '[role="group"]' ).parent().attr( 'aria-expanded', false ); // Expand ancestors to the current file. $templateside.find( '.notice' ).parents( '[aria-expanded]' ).attr( 'aria-expanded', true ); // Find Tree elements and enhance them. $templateside.find( '[role="tree"]' ).each( function() { var treeLinks = new TreeLinks( this ); treeLinks.init(); } ); // Scroll the current file into view. $templateside.find( '.current-file:first' ).each( function() { if ( this.scrollIntoViewIfNeeded ) { this.scrollIntoViewIfNeeded(); } else { this.scrollIntoView( false ); } } ); }; /* jshint ignore:start */ /* jscs:disable */ /* eslint-disable */ /** * Creates a new TreeitemLink. * * @since 4.9.0 * @class * @private * @see {@link https://www.w3.org/TR/wai-aria-practices-1.1/examples/treeview/treeview-2/treeview-2b.html|W3C Treeview Example} * @license W3C-20150513 */ var TreeitemLink = (function () { /** * This content is licensed according to the W3C Software License at * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document * * File: TreeitemLink.js * * Desc: Treeitem widget that implements ARIA Authoring Practices * for a tree being used as a file viewer * * Author: Jon Gunderson, Ku Ja Eun and Nicholas Hoyt */ /** * @constructor * * @desc * Treeitem object for representing the state and user interactions for a * treeItem widget * * @param node * An element with the role=tree attribute */ var TreeitemLink = function (node, treeObj, group) { // Check whether node is a DOM element. if (typeof node !== 'object') { return; } node.tabIndex = -1; this.tree = treeObj; this.groupTreeitem = group; this.domNode = node; this.label = node.textContent.trim(); this.stopDefaultClick = false; if (node.getAttribute('aria-label')) { this.label = node.getAttribute('aria-label').trim(); } this.isExpandable = false; this.isVisible = false; this.inGroup = false; if (group) { this.inGroup = true; } var elem = node.firstElementChild; while (elem) { if (elem.tagName.toLowerCase() == 'ul') { elem.setAttribute('role', 'group'); this.isExpandable = true; break; } elem = elem.nextElementSibling; } this.keyCode = Object.freeze({ RETURN: 13, SPACE: 32, PAGEUP: 33, PAGEDOWN: 34, END: 35, HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40 }); }; TreeitemLink.prototype.init = function () { this.domNode.tabIndex = -1; if (!this.domNode.getAttribute('role')) { this.domNode.setAttribute('role', 'treeitem'); } this.domNode.addEventListener('keydown', this.handleKeydown.bind(this)); this.domNode.addEventListener('click', this.handleClick.bind(this)); this.domNode.addEventListener('focus', this.handleFocus.bind(this)); this.domNode.addEventListener('blur', this.handleBlur.bind(this)); if (this.isExpandable) { this.domNode.firstElementChild.addEventListener('mouseover', this.handleMouseOver.bind(this)); this.domNode.firstElementChild.addEventListener('mouseout', this.handleMouseOut.bind(this)); } else { this.domNode.addEventListener('mouseover', this.handleMouseOver.bind(this)); this.domNode.addEventListener('mouseout', this.handleMouseOut.bind(this)); } }; TreeitemLink.prototype.isExpanded = function () { if (this.isExpandable) { return this.domNode.getAttribute('aria-expanded') === 'true'; } return false; }; /* EVENT HANDLERS */ TreeitemLink.prototype.handleKeydown = function (event) { var tgt = event.currentTarget, flag = false, _char = event.key, clickEvent; function isPrintableCharacter(str) { return str.length === 1 && str.match(/\S/); } function printableCharacter(item) { if (_char == '*') { item.tree.expandAllSiblingItems(item); flag = true; } else { if (isPrintableCharacter(_char)) { item.tree.setFocusByFirstCharacter(item, _char); flag = true; } } } this.stopDefaultClick = false; if (event.altKey || event.ctrlKey || event.metaKey) { return; } if (event.shift) { if (event.keyCode == this.keyCode.SPACE || event.keyCode == this.keyCode.RETURN) { event.stopPropagation(); this.stopDefaultClick = true; } else { if (isPrintableCharacter(_char)) { printableCharacter(this); } } } else { switch (event.keyCode) { case this.keyCode.SPACE: case this.keyCode.RETURN: if (this.isExpandable) { if (this.isExpanded()) { this.tree.collapseTreeitem(this); } else { this.tree.expandTreeitem(this); } flag = true; } else { event.stopPropagation(); this.stopDefaultClick = true; } break; case this.keyCode.UP: this.tree.setFocusToPreviousItem(this); flag = true; break; case this.keyCode.DOWN: this.tree.setFocusToNextItem(this); flag = true; break; case this.keyCode.RIGHT: if (this.isExpandable) { if (this.isExpanded()) { this.tree.setFocusToNextItem(this); } else { this.tree.expandTreeitem(this); } } flag = true; break; case this.keyCode.LEFT: if (this.isExpandable && this.isExpanded()) { this.tree.collapseTreeitem(this); flag = true; } else { if (this.inGroup) { this.tree.setFocusToParentItem(this); flag = true; } } break; case this.keyCode.HOME: this.tree.setFocusToFirstItem(); flag = true; break; case this.keyCode.END: this.tree.setFocusToLastItem(); flag = true; break; default: if (isPrintableCharacter(_char)) { printableCharacter(this); } break; } } if (flag) { event.stopPropagation(); event.preventDefault(); } }; TreeitemLink.prototype.handleClick = function (event) { // Only process click events that directly happened on this treeitem. if (event.target !== this.domNode && event.target !== this.domNode.firstElementChild) { return; } if (this.isExpandable) { if (this.isExpanded()) { this.tree.collapseTreeitem(this); } else { this.tree.expandTreeitem(this); } event.stopPropagation(); } }; TreeitemLink.prototype.handleFocus = function (event) { var node = this.domNode; if (this.isExpandable) { node = node.firstElementChild; } node.classList.add('focus'); }; TreeitemLink.prototype.handleBlur = function (event) { var node = this.domNode; if (this.isExpandable) { node = node.firstElementChild; } node.classList.remove('focus'); }; TreeitemLink.prototype.handleMouseOver = function (event) { event.currentTarget.classList.add('hover'); }; TreeitemLink.prototype.handleMouseOut = function (event) { event.currentTarget.classList.remove('hover'); }; return TreeitemLink; })(); /** * Creates a new TreeLinks. * * @since 4.9.0 * @class * @private * @see {@link https://www.w3.org/TR/wai-aria-practices-1.1/examples/treeview/treeview-2/treeview-2b.html|W3C Treeview Example} * @license W3C-20150513 */ TreeLinks = (function () { /* * This content is licensed according to the W3C Software License at * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document * * File: TreeLinks.js * * Desc: Tree widget that implements ARIA Authoring Practices * for a tree being used as a file viewer * * Author: Jon Gunderson, Ku Ja Eun and Nicholas Hoyt */ /* * @constructor * * @desc * Tree item object for representing the state and user interactions for a * tree widget * * @param node * An element with the role=tree attribute */ var TreeLinks = function (node) { // Check whether node is a DOM element. if (typeof node !== 'object') { return; } this.domNode = node; this.treeitems = []; this.firstChars = []; this.firstTreeitem = null; this.lastTreeitem = null; }; TreeLinks.prototype.init = function () { function findTreeitems(node, tree, group) { var elem = node.firstElementChild; var ti = group; while (elem) { if ((elem.tagName.toLowerCase() === 'li' && elem.firstElementChild.tagName.toLowerCase() === 'span') || elem.tagName.toLowerCase() === 'a') { ti = new TreeitemLink(elem, tree, group); ti.init(); tree.treeitems.push(ti); tree.firstChars.push(ti.label.substring(0, 1).toLowerCase()); } if (elem.firstElementChild) { findTreeitems(elem, tree, ti); } elem = elem.nextElementSibling; } } // Initialize pop up menus. if (!this.domNode.getAttribute('role')) { this.domNode.setAttribute('role', 'tree'); } findTreeitems(this.domNode, this, false); this.updateVisibleTreeitems(); this.firstTreeitem.domNode.tabIndex = 0; }; TreeLinks.prototype.setFocusToItem = function (treeitem) { for (var i = 0; i < this.treeitems.length; i++) { var ti = this.treeitems[i]; if (ti === treeitem) { ti.domNode.tabIndex = 0; ti.domNode.focus(); } else { ti.domNode.tabIndex = -1; } } }; TreeLinks.prototype.setFocusToNextItem = function (currentItem) { var nextItem = false; for (var i = (this.treeitems.length - 1); i >= 0; i--) { var ti = this.treeitems[i]; if (ti === currentItem) { break; } if (ti.isVisible) { nextItem = ti; } } if (nextItem) { this.setFocusToItem(nextItem); } }; TreeLinks.prototype.setFocusToPreviousItem = function (currentItem) { var prevItem = false; for (var i = 0; i < this.treeitems.length; i++) { var ti = this.treeitems[i]; if (ti === currentItem) { break; } if (ti.isVisible) { prevItem = ti; } } if (prevItem) { this.setFocusToItem(prevItem); } }; TreeLinks.prototype.setFocusToParentItem = function (currentItem) { if (currentItem.groupTreeitem) { this.setFocusToItem(currentItem.groupTreeitem); } }; TreeLinks.prototype.setFocusToFirstItem = function () { this.setFocusToItem(this.firstTreeitem); }; TreeLinks.prototype.setFocusToLastItem = function () { this.setFocusToItem(this.lastTreeitem); }; TreeLinks.prototype.expandTreeitem = function (currentItem) { if (currentItem.isExpandable) { currentItem.domNode.setAttribute('aria-expanded', true); this.updateVisibleTreeitems(); } }; TreeLinks.prototype.expandAllSiblingItems = function (currentItem) { for (var i = 0; i < this.treeitems.length; i++) { var ti = this.treeitems[i]; if ((ti.groupTreeitem === currentItem.groupTreeitem) && ti.isExpandable) { this.expandTreeitem(ti); } } }; TreeLinks.prototype.collapseTreeitem = function (currentItem) { var groupTreeitem = false; if (currentItem.isExpanded()) { groupTreeitem = currentItem; } else { groupTreeitem = currentItem.groupTreeitem; } if (groupTreeitem) { groupTreeitem.domNode.setAttribute('aria-expanded', false); this.updateVisibleTreeitems(); this.setFocusToItem(groupTreeitem); } }; TreeLinks.prototype.updateVisibleTreeitems = function () { this.firstTreeitem = this.treeitems[0]; for (var i = 0; i < this.treeitems.length; i++) { var ti = this.treeitems[i]; var parent = ti.domNode.parentNode; ti.isVisible = true; while (parent && (parent !== this.domNode)) { if (parent.getAttribute('aria-expanded') == 'false') { ti.isVisible = false; } parent = parent.parentNode; } if (ti.isVisible) { this.lastTreeitem = ti; } } }; TreeLinks.prototype.setFocusByFirstCharacter = function (currentItem, _char) { var start, index; _char = _char.toLowerCase(); // Get start index for search based on position of currentItem. start = this.treeitems.indexOf(currentItem) + 1; if (start === this.treeitems.length) { start = 0; } // Check remaining slots in the menu. index = this.getIndexFirstChars(start, _char); // If not found in remaining slots, check from beginning. if (index === -1) { index = this.getIndexFirstChars(0, _char); } // If match was found... if (index > -1) { this.setFocusToItem(this.treeitems[index]); } }; TreeLinks.prototype.getIndexFirstChars = function (startIndex, _char) { for (var i = startIndex; i < this.firstChars.length; i++) { if (this.treeitems[i].isVisible) { if (_char === this.firstChars[i]) { return i; } } } return -1; }; return TreeLinks; })(); /* jshint ignore:end */ /* jscs:enable */ /* eslint-enable */ return component; })( jQuery ); /** * Removed in 5.5.0, needed for back-compatibility. * * @since 4.9.0 * @deprecated 5.5.0 * * @type {object} */ wp.themePluginEditor.l10n = wp.themePluginEditor.l10n || { saveAlert: '', saveError: '', lintError: { alternative: 'wp.i18n', func: function() { return { singular: '', plural: '' }; } } }; wp.themePluginEditor.l10n = window.wp.deprecateL10nObject( 'wp.themePluginEditor.l10n', wp.themePluginEditor.l10n, '5.5.0' );