inherit
78803
0
Oct 22, 2014 18:09:05 GMT -8
Crackoala
Yar.
644
May 2006
waxxerx
|
Post by Crackoala on Feb 14, 2009 11:36:57 GMT -8
I don't know if this would be breaking the whole 'privacy' thingy, but I thought I'd request the code anyway, since it would be kind of cool. So basically I'm wondering if it's possible to put the current time of a member in their MP? [Mini Profile] Let's just have an example, since it's kinda hard to explain --- So let's say I'm going around my site, and I am scrolling through a thread, and I look at the MP of the other person who is posting in the thread. Instead of doing math trying to figure out her current time, I can just look at her Mini Profile and see what time it is there - meaning the time zone she set under her account when she clicked "Modify Profile" so the time displayed on the site would be accurate for her >.> or him --- Hope that made it clearer Maybe have it not appear under the MP of the account you're in? I hope that was explained well enough I just have a lot of people from strange Time Zones on my site, and I just want to be able to see what time it is there without having to google stuff and do math, and I've had a majority of the members ask the same thing ;D Thank you in advanced ~ and if this is possible, you have God-status in my book
|
|
inherit
78803
0
Oct 22, 2014 18:09:05 GMT -8
Crackoala
Yar.
644
May 2006
waxxerx
|
Post by Crackoala on Feb 15, 2009 11:37:11 GMT -8
Bump o.o Wow...it's like EXACTLY 24 hours later! *skill*
Please and thank you again <3
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,882
December 2005
horace
|
Post by Chris on Feb 15, 2009 22:47:47 GMT -8
Try this one (Global Footer): <script> /* nameless Local Time in Profile - Eton */ var tz_storage = 'location' //where in profile to store data tz_errorColor = 'red' //field index where time should be inserted (-0=above displayname, 0=below displayname, -1=above rank, 1=below rank, etc...) (999=below storage field) tz_index = 999 pb_bias=1 //compensate for proboards date drift (1=enable, 0=disable)
var tz_re=/\[\xb1(\d)([+-][\d.]+)\]/, tz_re3=/(\w+\s\d{1,2},\s\d{4},\s\d+:\d+[ap]m)/ var a,b,c,d,mTD,i,dt=new Date() if(document.modifyForm){ a=document.modifyForm[tz_storage], b=document.modifyForm['timezone'], c=document.modifyForm['summertime'] if(a&&b&&c){ function tzedit(ev){ try{ if(document.getElementById('showlocaltime').selectedIndex<1)return true var d = arguments.callee.prototype.tzb.options[arguments.callee.prototype.tzb.selectedIndex].value; d=(d>=1)?'+'+d:d d='[\xb1'+arguments.callee.prototype.tzc.options[arguments.callee.prototype.tzc.selectedIndex].value+d+']' arguments.callee.prototype.tza.value+=d; }catch(e){return true} } mTD=c.offsetParent.parentNode.cloneNode(1) mTD.firstChild.lastChild.innerHTML='Show Local Time:' mTD.firstChild.nextSibling.lastChild.lastChild.name= mTD.firstChild.nextSibling.lastChild.lastChild.id= 'showlocaltime' mTD.lastChild.lastChild.innerHTML='Do you want your local time displayed in your profile?' c.offsetParent.parentNode.parentNode.appendChild(mTD) a.value=a.value.replace(tz_re,''); i=document.getElementById('showlocaltime') if(tz_re.test(RegExp['$_']))i.selectedIndex=1; else i.selectedIndex=0 if(a.maxLength<(a.value.length+9)){ i.style.outline=a.style.outline=tz_errorColor+" solid medium"; mTD.lastChild.lastChild.innerHTML +='<font color="'+tz_errorColor+'">(Not enough room in '+tz_storage+' field to use this feature! Please make room and refresh this page)</font>' i.selectedIndex=0; i.disabled=true; } tzedit.prototype.tza=a; tzedit.prototype.tzb=b;tzedit.prototype.tzc=c; i.onchange=function(){ var t=document.getElementById('showlocaltime') if(!t)return true if(t.selectedIndex>0){ if(document.modifyForm.addEventListener){ document.modifyForm.addEventListener('submit',tzedit,0); }else if(document.modifyForm.attachEvent){ document.modifyForm.attachEvent('onsubmit',tzedit) }else{ document.modifyForm.onsubmit=tzedit} }else{ if(document.modifyForm.removeEventListener){ document.modifyForm.removeEventListener('submit',tzedit,0); }else if(document.modifyForm.detachEvent){ document.modifyForm.detachEvent('onsubmit',tzedit) }else{ document.modifyForm.onsubmit=null} } } i.onchange() } } function pbDateOffset(index,bT){ if(arguments.callee.prototype.pbdiff) return arguments.callee.prototype.pbdiff; else arguments.callee.prototype.pbdiff=[0,''] index=isNaN(index)?2:index; var b= 'The detected difference between your computer time and this Proboards forum ' var a=document.getElementsByTagName('td')[index].innerHTML.match(tz_re3) if(a&&a.length){ a= (bT&&pb_username!='Guest')?new Date(a[0].replace(/([ap]m)$/,' $1')):dt; if(!isNaN(a)){ arguments.callee.prototype.pbdiff= [dt-a,b+'is approximately '+String((dt-a)/1000/60).replace(/(\.\d{2})\d+/,'$1')+' minutes'] return arguments.callee.prototype.pbdiff } } return [0,b+'could not be determined'] } if(location.href.match(/action=(display|goto|(?:user)?recent|search2|(pm)?viewp?)/i)|| (location.href.split(/\//).pop().match(/index.cgi\??/) && (document.body.innerHTML.match(/b>\d+\sresults found<\/b/i)|| document.title.match(/-\sPreview/)))){ mTD=document.getElementsByTagName('td'); pb_bias=pbDateOffset(2,pb_bias)[0] for(i=0;i<mTD.length;i++){ if(((mTD.width=="20%" && mTD.className.match(/windowbg2?/) && mTD.innerHTML.match(/Posts:/)) || (mTD.previousSibling && mTD.previousSibling.width=="25%")) && mTD.innerHTML.match(tz_re) ){ if(mTD.innerHTML.match(/Posts:/)){ b=mTD.innerHTML.split(/<br\s*\/?>/i) while(b[b.length-1]=='')b.pop(); for(c=0;c<b.length;c++){ if(b[c].match(tz_re)){ b[c]= b[c].replace(tz_re,function(m,p1,p2,p3){ var lt=dt.getTime(),lo=dt.getTimezoneOffset() * 60000,utc=lt+lo, ti=tz_index,rt; utc=utc + (3600000*(parseInt(p2)+parseInt(p1))) - pb_bias utc=(new Date(utc)).toLocaleString() rt= "Local Time: "+(pbDateOffset.prototype.pbdiff[0]?"<a href='javascript:alert(pbDateOffset()[1])'>":"")+utc.split(' ')[0].replace(/(\w{3})[^,]+/,'$1')+' '+utc.split(/\s\d{4}\s/)[1]+(pbDateOffset.prototype.pbdiff[0]?'</a>':'') if(ti!=999){ ti=ti%b.length if(ti>-1){b[ti]=(b[ti].length?b[ti]+'<br>':'')+rt;}else{ti=0-ti; b[ti]=rt+(b[ti].length?'<br>'+b[ti]:'')} return '' }else{return ((b[c].length?'<br>':'')+rt)} }); break; } } mTD.innerHTML=b.join('<br>') }else mTD.innerHTML=mTD.innerHTML.replace(tz_re,'') } } } </script>
Forgot to mention that it's implemented as an opt-in feature to get around the privacy issue. User has to modify their profile and set the show local time option to yes. That option should be found under the date/time section (where you select daylight saving time, etc.)
|
|
inherit
78803
0
Oct 22, 2014 18:09:05 GMT -8
Crackoala
Yar.
644
May 2006
waxxerx
|
Post by Crackoala on Feb 17, 2009 10:43:24 GMT -8
Brilliant! Thank you! Though...it says, "Local Time: Tue undefined" when I ask it to show the local time I tried removing the one code I have that affects mini profiles, just to see if that was messing with it...but it still says, "Tue undefined" Plusss...I didn't edit anything. I looked at the code and didn't feel like messing with anything, in fear something would explode [it has happened in the past ]
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,882
December 2005
horace
|
Post by Chris on Feb 17, 2009 21:01:50 GMT -8
Brilliant! Thank you! Though...it says, "Local Time: Tue undefined" when I ask it to show the local time I tried removing the one code I have that affects mini profiles, just to see if that was messing with it...but it still says, "Tue undefined" Plusss...I didn't edit anything. I looked at the code and didn't feel like messing with anything, in fear something would explode [it has happened in the past ] Could you link me to a profile where this "undefined" is showing?
|
|
inherit
78803
0
Oct 22, 2014 18:09:05 GMT -8
Crackoala
Yar.
644
May 2006
waxxerx
|
Post by Crackoala on Feb 17, 2009 23:28:44 GMT -8
Now it's just showing the TZ code I'm not sure if that's what your code was supposed to do, but if so it's working now Les ProfileI was actually hoping it would have the local time instead of the TZ code Thanks for helping me by the way ;D *hands cookie*
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,882
December 2005
horace
|
Post by Chris on Feb 17, 2009 23:39:19 GMT -8
I don't see the code in your footer. Could you put it back in and make sure it is above the profile remodel code (http://davmax.100webspace.net/PBminipro.js)?
|
|
inherit
78803
0
Oct 22, 2014 18:09:05 GMT -8
Crackoala
Yar.
644
May 2006
waxxerx
|
Post by Crackoala on Feb 18, 2009 0:47:27 GMT -8
Hey it's working now But...I do have one last question o.o I set it to "999" and it's below the custom title...is there any way I could get it below the avatar, and maybe so it's one line? Like a smaller font o.O *feels like I'm being a pain* I'm sorry if I am Thank you againx10 for helping me ;D
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,882
December 2005
horace
|
Post by Chris on Feb 18, 2009 1:51:55 GMT -8
The reason it's up there is because the profile remodel put it there. If you temporarily disable the profile remodel code you'll see it is actually inserted below the location field.
As for affecting the size of the text you could probably use the css classes added by the profile remodel. Something like: <style> center+.miniprofile .minifont {font-size:9px;}</style>
in the global header should affect the size.
|
|
inherit
78803
0
Oct 22, 2014 18:09:05 GMT -8
Crackoala
Yar.
644
May 2006
waxxerx
|
Post by Crackoala on Feb 18, 2009 1:53:25 GMT -8
Thank ya <3
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,882
December 2005
horace
|
Post by Chris on Feb 18, 2009 2:08:30 GMT -8
you're welcome
|
|