Topeka
Junior Member
Posts: 94
Topeka said 0 great things
|
Post by Topeka on Feb 10, 2011 18:20:07 GMT -8
Hello again, This is actually a code you made for me before, I could not find the thread on here, so maybe i asked you this on proboards, but in anycase.. I was wondering if this can be edited to manipulate the "too long" string when on the reply page to the thread that has the overlength string.? To explain it better, When someone writes the a 140character string without spaces, this code breaks it at the "maxWordLength" value, but only when viewing the post. Not when replying to it. When you reply to the Thread that has a post like that in it, the last few posts are viewed below, and this script does not break the '140' character string below, which is what I would like to happen. This is the code <script type="text/javascript"> <!-- // wordbreaker v.1.1 // by Wormopolis - [url]www.wormocodes.com[/url] // keep header intact var maxWordLength=50; function chkfertext(objkt) { var holdtemp=objkt; for (var h=0; h<holdtemp.length; h++) { if (holdtemp[h].nodeName.match(/text/i)) { holding=holdtemp[h].nodeValue.split(' '); for (var k=0; k<holding.length; k++) { if (holding[k].length>maxWordLength) { temp=''; temp2=holding[k]; while (temp2.length>maxWordLength) { temp+=temp2.substr(0,maxWordLength)+' '; temp2=temp2.substr(maxWordLength, temp2.length) } holding[k]=temp+temp2; } } holdtemp[h].nodeValue=holding.join(' '); } else { if (holdtemp[h].className!='code' && !holdtemp[h].nodeName.match(/textarea/) && holdtemp[h].hasChildNodes()) chkfertext(holdtemp[h].childNodes); } } } if (location.href.match(/action=display/)) { for (tds=document.getElementsByTagName('td'), i=0; i<tds.length; i++) { if (tds[i].width=="20%" && tds[i].align=="left" && tds[i].vAlign=="top" && tds[i].className.match(/windowbg/)) { postPart=tds[i].nextSibling.getElementsByTagName('tr')[1].cells[0].firstChild.nextSibling; postStuff = postPart.childNodes; chkfertext(postStuff); } } } // --> </script>
Get to this whenever you can. Im in no rush. And if you cant, dont sweat it. Its just a perk that I like having. I already feel like im asking too much out of you. Many Thanks ahead of time. ~Topeka
|
|
|
Post by Wormopolis on Feb 10, 2011 20:03:20 GMT -8
you mean in the topic summary areas?
|
|
Topeka
Junior Member
Posts: 94
Topeka said 0 great things
|
Post by Topeka on Feb 11, 2011 14:28:35 GMT -8
Yes.
|
|
|
Post by Wormopolis on Feb 11, 2011 21:49:33 GMT -8
add this at the end of the code:
if (location.href.match(/action=post/)) {
for (tds=document.getElementsByTagName('td'), i=0; i<tds.length; i++) { if (tds.width=="100%" && tds.className='windowbg2' && tds.parentNode.parentNode.firstChild.innerHTML.match(/Topic Summary/)) { postPart=tds.firstChild; postStuff = postPart.childNodes; chkfertext(postStuff); } }
}
|
|
Topeka
Junior Member
Posts: 94
Topeka said 0 great things
|
Post by Topeka on Feb 12, 2011 11:02:42 GMT -8
You forgot an = sign
if (location.href.match(/action=post/)) {
for (tds=document.getElementsByTagName('td'), i=0; i<tds.length; i++) { if (tds.width=="100%" && tds.className=='windowbg2' && tds.parentNode.parentNode.firstChild.innerHTML.match(/Topic Summary/)) { postPart=tds.firstChild; postStuff = postPart.childNodes; chkfertext(postStuff); } }
}
But after that it works great! Thanks a bunch.
|
|
|
Post by Wormopolis on Feb 12, 2011 15:48:23 GMT -8
woops! sorry about that. I would blame it on the pain meds, but we all know the truth!
|
|