|
Post by Wormopolis on Dec 7, 2009 2:59:32 GMT -8
Browser Tested: IE and FF Placement: Global Footer
puts a small color bar in the miniprofile that shows activity of posting per day compared to a base number you define. a white line moves along the bar showing value.
code:
<script type="text/javascript"> <!-- // activity meter in MP // v 1.21 // by Wormopolis - www.wormocodes.com // keep header intact - do not repost
var postsPerDay=3; // number of posts per day you consider very active var barHeight=10; var taperedBar=true; // increasing height of colored bar
function getColor(n) { red=parseInt(2.55*(100-n)); green=parseInt(2.55*(n)); return ((red<16?'0':'') + red.toString(16) + (green<16?'0':'') + green.toString(16) + '00'); }
tstArray=['jan','feb','mar','apr','may','jun','jul','aug','sept','oct','nov','dec']; for (tds=document.getElementsByTagName('td'), t=0; t<tds.length; t++) { if (tds[t].width=='20%' && tds[t].className.match(/windowbg/) && tds[t].vAlign=='top' && tds[t].innerHTML.match(/posts: (.*?)<br>/i)) { pstcnt=parseInt(RegExp.$1.replace(/,/g,'')); datechk=tds[t].innerHTML.match(/joined: (.*?) (\d+)(<|$|\n)/i); var datechkM=RegExp.$1; var datechkY=RegExp.$2; for (m=0; m<tstArray.length; m++) { if (datechkM.toLowerCase()==tstArray[m]) break; } sDate=new Date(); sDate.setDate(1); sDate.setYear(datechkY); sDate.setMonth(m); cDate=new Date(); timeSpan=parseInt((cDate-sDate)/(1000*60*60*24)); ppd=pstcnt/timeSpan; ppdp=parseInt((ppd/postsPerDay)*100); notch=(ppdp>100 ? 100 : ppdp); for (br=tds[t].getElementsByTagName('br'), b=0; b<br.length; b++) { if (br[b].nextSibling && br[b].nextSibling.nodeName.match(/text/) && br[b].nextSibling.nodeValue.match(/posts:/i)) { spot=br[b].nextSibling.nextSibling; break; } } nwdv=document.createElement('div'); nwdv.title=pstcnt+" posts / "+timeSpan+ " days = "+ppd.toFixed(2)+" (active="+postsPerDay+")"; nwdv.width='100%'; nwdv.vAlign='middle'; nwdv.height=nwdv.style.height=(barHeight+10)+'px'; nwdv.align='center' hdr=nwdv.appendChild(document.createElement('font')); hdr.innerHTML='Posting Activity'; hdr.size=1; nwtbl=nwdv.appendChild(document.createElement('table')); nwtbl.cellSpacing=nwtbl.cellPadding=0; nwtbl.insertRow(0); for (i=0; i<=100; i++) { nwcl=nwtbl.rows[0].insertCell(-1); nwcl.style.width='1'; nwcl.style.height='20px'; nwcl.vAlign='middle'; nwcl.style.borderWidth="0px"; cdiv=nwcl.appendChild(document.createElement('div')); cdiv.style.width='1'; if (i==notch) { cdiv.height=cdiv.style.height=(barHeight+5)+'px'; cdiv.style.backgroundColor='ffffff'; } else { cdiv.height=cdiv.style.height=(taperedBar ? parseInt(i*barHeight/100) : barHeight)+'px'; cdiv.style.fontSize=0; test=getColor(i); cdiv.style.backgroundColor=getColor(i); } } spot.parentNode.insertBefore(nwdv,spot);
} } // --> </script>
Preview: using it on this site.
|
|
|
Post by Wormopolis on Dec 16, 2009 12:00:19 GMT -8
fixed a guest view glitch
|
|
|
Post by rhondairv on Apr 20, 2010 12:22:15 GMT -8
This is not showing up for me. Does it not work with any other codes maybe?
I can not for the life of me find the name of one code i am using ,but it shows a bar showing how far you have to go before you reach your next rank and how many posts to go. Maybe these 2 do not like each other? lol
|
|
|
Post by Wormopolis on Apr 21, 2010 0:24:03 GMT -8
typically this code gets affected by codes that change the miniprofile in some way so that postcount cant be found or recognized.
since my code doesnt destroy how postcount is displayed, but rather just adds in some new info, try reversing the order of the 2 codes.
|
|
mrthomas
Not New Member
Posts: 9
mrthomas said 0 great things
|
Post by mrthomas on Jun 25, 2010 14:47:52 GMT -8
Seems as if this conflicts with the colorsmear code???
|
|
|
Post by Wormopolis on Jun 25, 2010 21:33:12 GMT -8
it shouldnt.. rhonda's name is colorsmeared on this site and it shows her name 2 posts up.
what are you seeing on your site? perhaps a URL so I can look too?
|
|
mrthomas
Not New Member
Posts: 9
mrthomas said 0 great things
|
Post by mrthomas on Jun 26, 2010 0:47:06 GMT -8
I took the script out but when I placed it in the "Global Footer" I noticed my activity meter pegged out to the left but when I removed it, things were fine. I'm not understanding at why I'm having so much trouble with the various scripts for the mini profile =(
|
|
|
Post by Wormopolis on Jun 26, 2010 1:18:45 GMT -8
a lot of times, placement is the key. those 2 codes shouldnt really conflict with each other however since they work on different things. I have colorsmear and posting activity running on this site right now so I know they CAN work together. it could very well be something else entirely.
if you put both codes back in and give me a link I can see what the issue is.
|
|
mrthomas
Not New Member
Posts: 9
mrthomas said 0 great things
|
Post by mrthomas on Jun 26, 2010 15:34:12 GMT -8
Seems as if this conflicts with the colorsmear code??? Nevermind... I got it to work properly ;D
|
|
|
Post by Wormopolis on Jun 26, 2010 17:59:07 GMT -8
good deal!
|
|
game
Junior Member
Code Digger
Posts: 59
game said 0 great things
|
Post by game on Jul 7, 2010 16:27:39 GMT -8
I've came back and tried this code a few times. Each time it shows up, but it stretches all the way across the board.
|
|
|
Post by Wormopolis on Jul 7, 2010 16:28:42 GMT -8
really? it stretches the MP? do you have a URL I can see this for myself?
|
|
game
Junior Member
Code Digger
Posts: 59
game said 0 great things
|
Post by game on Jul 11, 2010 10:44:43 GMT -8
|
|
|
Post by Wormopolis on Jul 11, 2010 11:25:40 GMT -8
I see what it is.. you have CSS setup to put a 2px border around EVERY cell on the page. since there are 100 cells in a row there, you effectively just added 400 pixels to the width. did you notice the cells looked weird?
find this line:
nwcl.style.width='1'; nwcl.style.height='20'; nwcl.vAlign='middle';
add this right after it:
nwcl.style.borderWidth="0px !important";
|
|
game
Junior Member
Code Digger
Posts: 59
game said 0 great things
|
Post by game on Jul 11, 2010 12:19:50 GMT -8
lol, good find! Thanks brotha
|
|