Post by Chris on Jun 9, 2007 19:51:40 GMT -8
Description:
Show the elapsed time for dated material on your Proboards forum instead of or in addition to the date.
This is an update to a previous code that had an intermittent problem with Proboards' various submission forms.
Installation:
Place in GLOBAL FOOTER. There are some settings in the userSettings
section at the top of the code you may wish to change from their default
values and experiment with.
userSettings:{
daysOnly:false, /*set true to NOT breakdown into years, months and weeks*/
parentheses:true, /*set true to put elapsed time in parentheses*/
showMinutes:3, /*set to age (in days) when hours and minutes are no longer shown*/
keepDate:true, /*set true to add elapsed time next to date instead of replace it*/
truncate:true /*set true to simplify "2 years 1 month 2 weeks 3 hours ago" into "over 2 years ago" */
/*NOTE: no comma after last entry*/
},
Preview:
default settings (keepDate=true, parentheses=true, daysOnly=false, showMinutes=3)
custom settings (keepDate=false, parentheses=false, daysOnly=false, showMinutes=3)
Code:
Additional Information:
If your forum user has their month format set to use the british date
form (ie. 28 December instead of December 28) then they must modify
their profile (no need to change anything just click the "modify profile
button) for the setting to be recorded and then used. If they see
elapsed times only for dates that contain the Today and
yesterday format then they most likely don't have their format
choice recorded and should do as stated above. The code defaults to the
non-British date form so anyone not using the British form need not do
anything extra. no longer necessary
The accuracy of elapsed times greater than 1 month may be off by 1 or 2
days because (for the sake of efficiency and speed) the code doesn't
calculate how many days are in each month and simply uses 30
Credits:
Big thanks to Dre for helping me sort out a few of the bugs
Edits:
Show the elapsed time for dated material on your Proboards forum instead of or in addition to the date.
This is an update to a previous code that had an intermittent problem with Proboards' various submission forms.
Installation:
Place in GLOBAL FOOTER. There are some settings in the userSettings
section at the top of the code you may wish to change from their default
values and experiment with.
userSettings:{
daysOnly:false, /*set true to NOT breakdown into years, months and weeks*/
parentheses:true, /*set true to put elapsed time in parentheses*/
showMinutes:3, /*set to age (in days) when hours and minutes are no longer shown*/
keepDate:true, /*set true to add elapsed time next to date instead of replace it*/
truncate:true /*set true to simplify "2 years 1 month 2 weeks 3 hours ago" into "over 2 years ago" */
/*NOTE: no comma after last entry*/
},
Preview:
default settings (keepDate=true, parentheses=true, daysOnly=false, showMinutes=3)
custom settings (keepDate=false, parentheses=false, daysOnly=false, showMinutes=3)
Code:
Additional Information:
form (ie. 28 December instead of December 28) then they must modify
their profile (no need to change anything just click the "modify profile
button) for the setting to be recorded and then used. If they see
elapsed times only for dates that contain the Today and
yesterday format then they most likely don't have their format
choice recorded and should do as stated above. The code defaults to the
non-British date form so anyone not using the British form need not do
anything extra.
The accuracy of elapsed times greater than 1 month may be off by 1 or 2
days because (for the sake of efficiency and speed) the code doesn't
calculate how many days are in each month and simply uses 30
Credits:
Big thanks to Dre for helping me sort out a few of the bugs
Edits:
- June 12, 2007 - Regular expression for British dates was improperly
being wrapped in post causing it to fail when code was copied then
pasted. Also changed treatment of British setting from being
installation defined to user selection defined (as it should have been).
A cookie is created indicating the user's selection when they modify
their profile.Note: users who prefer the british date formno longer necessary
must modify their profile for the setting to be recorded. They
don't need to change anything but the "modify profile" button has to be
clicked. - June 13, 2007 - Changed linebreak detection method in Internet Explorer
section of the code - June 27, 2007 - Changed method used to detect british date format after
realizing there was a more elegant way requiring no user interaction or
cookies. - Dec 19, 2009 - added truncate option