|
|
Forum moderator: bigblog |
uCoz Community For Webmasters Design Customization Any way of changing the content of module links? |
Any way of changing the content of module links? |
Hello,
Is there any way I could change how some module links display? For example, using "$LAST_POST_DATE$" yields me the following: https://gyazo.com/dd290ab244a4c656de1dffcdaccfda65 But I would like to change the format by making it shorter and only displaying the time elapsed from last forum post (IE "x" hours ago, "x" days ago, weeks/months/years.) unfortunately I wasn't able to find any relevant information on this so I'm asking here for help. Thank you in advance! Added (2019-04-11, 12:27 PM) |
Code <?if($DATE$='Today')?> <span id="d$ID$"></span> <script type="text/javascript"> function corrDate(t,n){return n!=0?" " + n + " " + t[n%10==1&&n%100!=11?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2] + ", ":"";}; (function(time){var everySecond=true,ar=arguments,_=Math.ceil((time-($TIMESTAMP$*1000))/(1000)),day,hour,min,sec,text=[['day', 'of the day', 'days'], ['time', 'hours', 'hours'], ['a minute', 'minutes', 'minutes'], ['give me a sec', 'seconds', 'seconds']],res; day = Math.floor((_/86400)); _=_-(day*86400); hour = Math.floor((_/3600)); _=_-(hour*3600); min = Math.floor((_/60)); _=_-(min*60); if(min>0) {if(min==1) {res='A minute ago'} else {if(hour>0) {if(hour=='1') {res='An hour ago'} else {res=corrDate(text[1],hour)}} else {res=corrDate(text[2],min)}}} else {res='Just now'} document.getElementById("d$ID$").innerHTML=res.replace(/\,\s$/, " ago"); if (everySecond) {setTimeout(function(){ar.callee(new Date().getTime());},1000);}})(new Date().getTime()); </script> <?else?> $DATE$ at $TIME$ <?endif?> Paste that code where you want to display the time of entry but works only for the current day |
| |||
| |||