Skip to content

Instantly share code, notes, and snippets.

@f5io
Created January 3, 2014 11:07
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 f5io/8236283 to your computer and use it in GitHub Desktop.
Save f5io/8236283 to your computer and use it in GitHub Desktop.
Trollololololololololol
(function(d) {
var tags = 'h1 h2 h3 h4 h5 h6 p div'.split(' ');
var elems = [];
for (var t in tags) {
elems = elems.concat(Array.prototype.slice.call(d.getElementsByTagName(tags[t])));
}
for (var e in elems) {
var el = elems[e];
var str = el.innerHTML;
var idx = str.lastIndexOf(' ');
el.innerHTML = str.substr(0, idx) + '<br />' + str.substr(idx + 1);
}
})(document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment