|
Post by Wormopolis on Apr 30, 2011 20:44:33 GMT -8
Browsers Tested: IE and FF placement: board or global footer
you create an array of trophy images for each milestone of word counts that will display in different spots on the post. you can have as many milestones as you desire.
<script type="text/javascript"> <!-- // word count trophies // v 1.5 // by Wormopolis - www.wormocodes.com // keep header intact - do not repost
var WCtrophyArray=[ [50,"http://i197.photobucket.com/albums/aa250/WORMOPOLIS/bronzetrophy.png"], [200,"http://i197.photobucket.com/albums/aa250/WORMOPOLIS/silvertrophy.png"], [500,"http://i197.photobucket.com/albums/aa250/WORMOPOLIS/goldtrophy.png"] //no comma last entry ];
var WCtrophyplacement=1; // 1=replace thread icon // 2=bottom of post, centered // 3=bottom of MP
var fudgeNumber=1; //percent value if you want to round up longer posts to acheive trophies // set to 0 if you dont.
// no need to edit below unless you know what you are doing for (tds=document.getElementsByTagName('td'), tt=0; tt<tds.length; tt++) { if (tds[tt].width=='80%' && tds[tt].vAlign=='top' && tds[tt].className.match(/windowbg/) && tds[tt].firstChild && tds[tt].firstChild.nodeName.match(/table/i)) { var postRow=tds[tt].firstChild.rows[1]; var postContent=postRow.cells[0].firstChild.nextSibling.cloneNode(true); postContent.innerHTML=postContent.innerHTML.replace(/<br>/gi,' '); var WCcontent=(postContent.innerText ? postContent.innerText : postContent.textContent); var WCcontent=WCcontent.replace(/\.+/g,' ').replace(/[^a-zA-Z0-9\s]+/g,''); WCcontent=WCcontent.replace(/\n*/g,'').replace(/(^\s+|\s+$)/g,''); var WCcount=WCcontent.split(/\s+/).length; var WCcountHold=WCcount; if (fudgeNumber>0) WCcount=Math.round(WCcount * (1 + (fudgeNumber/100))); var WCtrophy=''; for (tr=WCtrophyArray.length-1; tr>=0; tr--) { if (WCcount>=WCtrophyArray[tr][0]) { WCtrophy=WCtrophyArray[tr][1]; break; } } if (WCtrophyplacement==1 && WCtrophy) tds[tt].firstChild.rows[0].cells[0].innerHTML='<img src="'+ WCtrophy +'" title="approx '+WCcountHold+'">'; if (WCtrophyplacement==2 && WCtrophy) tds[tt].firstChild.rows[1].cells[0].innerHTML+='<center><img src="'+ WCtrophy +'" title="approx '+WCcountHold+'"></center>'; if (WCtrophyplacement==3 && WCtrophy) tds[tt].previousSibling.innerHTML+='<center><img src="'+ WCtrophy +'" title="approx '+WCcountHold+'"></center>'; } }
// --> </script>
|
|
|
Post by Wormopolis on Jul 18, 2011 23:22:42 GMT -8
added variable to turn on/off actual word count hover
|
|
|
Post by Wormopolis on Sept 28, 2011 18:17:50 GMT -8
small bug fix where I didnt comment out something
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 6, 2012 19:56:57 GMT -8
darkendofmadness.proboards.com/index.cgi?action=display&board=ideas&thread=7&page=1You can see my test thread there. The code is applying the image for a lower level. Here is how it should be working 200 words = Para Rp'er Award 500 words = Multi Para Rp'er Award 750 words = Master Para Rp'er Award 1000 words = Madness RP'er Award but here's the way its showing 200 words = nothing 500 words = Para RP'er Award 750 words = Multi Para RP'er Award 1000 words = Master Para RP'er Award 1200 words = Madness RP'er Award So what's happening Wormo? The code has been working on my other site. (I just went a grabbed a fresh version of it, same problem.) Is it meant to handle quadruple digits? Nvrmnd. I changed it so they were all 3 or less and it still had the problem.
|
|
|
Post by Wormopolis on Feb 6, 2012 20:02:43 GMT -8
can you make it where I can see the thread?
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 6, 2012 20:05:28 GMT -8
Okay Wormo (forgot about the permissions...also I tried moving it under the code for the Word Counter by Eton and that didn't help fix it either.)
|
|
|
Post by Wormopolis on Feb 6, 2012 20:41:29 GMT -8
recopy OP
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 7, 2012 5:05:04 GMT -8
Now 200 words = Master Para RP'er Award 500+ words = Madness RP'er Award
Edit: Ahh it works now! Wormo is perfect once again.
|
|
|
Post by Wormopolis on Feb 7, 2012 15:09:56 GMT -8
version update 1.5: increased accuracy of word count (still not 100% at LONG posts). also added in a fudge number so you can award a trophy to someone who almost made it to target word count. fudge number is percentage based, so 1% would mean 49/50 wouldnt hit, but 199/200 would. set to 0 if you dont want to use it.
|
|
Suzee
Not New Member
Posts: 17
Suzee said 0 great things
|
Post by Suzee on May 17, 2012 10:45:42 GMT -8
Hey Wormo!! Love this code and we're using it in our RP boards usstalon.proboards.com. But it is stretching the board a bit. I've tried to modify the code but when I do the trophies disappear entirely since I don't really know what I'm doing there. The crew LOVES them and I'm just nit picking but if you have a way to help it would be great.
|
|
|
Post by Wormopolis on May 17, 2012 19:46:19 GMT -8
|
|
Suzee
Not New Member
Posts: 17
Suzee said 0 great things
|
Post by Suzee on Oct 12, 2012 8:26:46 GMT -8
Hi Again Wormo,
We've been using this code for awhile now but we're getting some people quoting other posts (it's an RP board) and padding their own count a bit excessively.
A recent one had about 538 of her own words and got an 800+ trophy because of the quotes.
Is there a way to filter out parts of a post based on whether it's using the bb code for italics? [ i ] and [ / i ] I used spaces to get it to show up.
|
|
|
Post by Wormopolis on Oct 12, 2012 13:23:10 GMT -8
once it hits the display page, there isnt UBBC anymore. I have to sit down and figure a way to seperate out quote tables
|
|
Suzee
Not New Member
Posts: 17
Suzee said 0 great things
|
Post by Suzee on Oct 13, 2012 6:12:05 GMT -8
Just to clarify, we aren't using the [ quote ][ /quote] tags for this so the quotes don't end up in tables. The words are in the posts in itallics.
Don't make yourself crazy trying to parse that out if it isn't really possible. I was just a thought.
|
|
|
Post by Wormopolis on Oct 13, 2012 19:02:34 GMT -8
well.. I can have it ignore ALL italic tags..BUT I cant make it discern between what you are making quotes and what would be ANY word in italics. if someone were to put part of their post in italics, it would be ignored as well...
|
|