Skip to content

Instantly share code, notes, and snippets.

@hlb
Created November 22, 2010 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hlb/709673 to your computer and use it in GitHub Desktop.
Save hlb/709673 to your computer and use it in GitHub Desktop.
var _el, _type, _n, _script;
_el = document.activeElement;
function _moreText(data) {
_el.value += data.sentences.join('');
};
if (_el) {
_type = _el.tagName.toLowerCase();
switch (_type) {
case 'textarea':
_n = 10;
break;
case 'input':
_n = 1;
break;
}
if (_n) {
_script = document.createElement('script');
_script.src = 'http://more.handlino.com/sentences.json?_='+ Date.now() +'&callback=_moreText&n=' + _n ;
document.body.appendChild(_script);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment