Created
April 3, 2010 23:24
-
-
Save abraham/354936 to your computer and use it in GitHub Desktop.
Gmail Character count modification - http://the.hackerconundrum.com/2009/01/gmail-character-count.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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