Skip to content

Instantly share code, notes, and snippets.

@gugod
Forked from hlb/MoreText.js
Created November 22, 2010 08:46
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 gugod/709683 to your computer and use it in GitHub Desktop.
Save gugod/709683 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>x</title>
</head>
<body>
<a href="javascript:void(function(){var _el,_type,_n,_script;_el=document.activeElement;window._moreText=function(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);}}}());">MoreText</a>
</body>
</html>
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