Ignore:
Timestamp:
12/09/05 13:43:04 (14 years ago)
Author:
gocher
Message:

Changes to CharCounter? Plugin
and updates of extended example to check it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/CharCounter/char-counter.js

    r432 r433  
    1717 
    1818CharCounter._pluginInfo = { 
    19     name : "CharCounter", 
    20     version : "1.1", 
    21     developer : "Udo Schmal", 
     19    name          : "CharCounter", 
     20    version       : "1.1", 
     21    developer     : "Udo Schmal", 
    2222    developer_url : "http://www.schaffrath-neuemedien.de", 
    2323    sponsor       : "L.N.Schaffrath NeueMedien", 
    2424    sponsor_url   : "http://www.schaffrath-neuemedien.de", 
    25     c_owner : "Udo Schmal & L.N.Schaffrath NeueMedien", 
    26     license : "htmlArea" 
     25    c_owner       : "Udo Schmal & L.N.Schaffrath NeueMedien", 
     26    license       : "htmlArea" 
    2727}; 
    2828 
     
    8888    string[string.length] = this._lc("HTML") + ": " + contents.length; 
    8989  } 
    90         if (cfg.CharCounter.showWord) { 
     90  if (cfg.CharCounter.showWord || cfg.CharCounter.showChar) { 
    9191    contents = contents.replace(/<\/?\s*!--[^-->]*-->/gi, "" ); 
    9292    contents = contents.replace(/<(.+?)>/g, '');//Don't count HTML tags 
     
    9696    contents = contents.replace(/&(.*);/g, ' ');//Count htmlentities as one keystroke 
    9797    contents = contents.replace(/^\s*|\s*$/g, '');//trim 
     98  } 
     99  if (cfg.CharCounter.showWord) { 
    98100    var words=0; 
    99     for (var x=0;x<contents.length;x++) 
     101    for (var x=0;x<contents.length;x++)  
    100102    { 
    101103      if (contents.charAt(x) == " " ) {words++;} 
    102104    } 
    103   if (words>=1) { words = words+1; } 
     105    if (words>=1) { words++; } 
    104106    string[string.length] = this._lc("Words") + ": " + words; 
    105107  } 
Note: See TracChangeset for help on using the changeset viewer.