Skip to content

Instantly share code, notes, and snippets.

@abraham
Created April 3, 2010 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abraham/354936 to your computer and use it in GitHub Desktop.
Save abraham/354936 to your computer and use it in GitHub Desktop.
function iev(count)
{
var ifs=$('iframe',g.getActiveViewElement());
var ifm;
for(var i=0;i
{
if(!ifs[i].gcc_added)
{
ifm=ifs[i].contentDocument;
ifm.body.setAttribute('count_class','char_count'+count);
ifm.count_class='char_count'+count;
ifm.addEventListener('keyup',function()
{
var spans=$('.'+this.body.getAttribute('count_class'),g.getActiveViewElement());
for(var i=spans.length-1;i>=0;i--)
{
// start modified code
current=this.body.textContent.length;
spans[i].innerHTML='( '+first+' + '+(current-first)+' Characters )';
// end modified code
};
return;
},false);
var spans=$('.char_count'+count,g.getActiveViewElement());
// start added code
first=ifm.body.textContent.length;
// end added code
for(var i=spans.length-1;i>=0;i--)
{
current=ifm.body.textContent.length;
// start modified code
spans[i].innerHTML='( '+first+' + 0 Characters )';
// end modified code
};
ifs[i].gcc_added=true;
return;
}
};
return;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment