0 Members and 1 Guest are viewing this topic.

*

Vink

  • *****
  • 329
    • NedDate.nl
  • osDate Version: osDate v2.1.9a
Implement jquery Timeago
« on: February 16, 2016, 04:17:21 PM »
Hi!
This is a way to change the way osDate shows "the Last logged in" time on a Profile.
You can apply it to other pages also if you want.





howto:
add at the top in your nickpage_logo.tpl
Code: [Select]
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<script src="javascript/jquery.timeago.js" type="text/javascript"></script>


{literal}<script type="text/javascript">
$(document).ready(function() {
  $("time.timeago").timeago();
});
    </script>{/literal}

find:
Code: [Select]
{if $user.lastvisit >0}{$user.lastvisit|date_format:$lang.DATE_FORMAT}{else}{mylang mkey='unknown'}{/if}
and make it:
Code: [Select]
{if $user.lastvisit >0}
        <script type="text/javascript">
var date = $.timeago('{$user.lastvisit}');           
document.write(date);
</script>

{else}{mylang mkey='unknown'}{/if}
{/if}

Upload the jquery.timeago.js and jquery.min.js to your javascript dir.
Upload your nickpage_logo.tpl

You can change in jquery.timeago.tpl on line 50 ect. your language.
Examples in the Language Dir.

website: http://timeago.yarp.com/
note: only use jquery.timeago.js from the attachment because it supports the osDate Unix time stamp.
 
« Last Edit: February 16, 2016, 04:23:50 PM by Vink »
Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91

*

Pharg

  • *****
  • 3,272
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Implement jquery Timeago
« Reply #1 on: February 17, 2016, 12:42:49 AM »
Hi Vink,

Nice mod, thanks for sharing :)
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35

*

Vink

  • *****
  • 329
    • NedDate.nl
  • osDate Version: osDate v2.1.9a
Re: Implement jquery Timeago
« Reply #2 on: February 17, 2016, 08:56:31 AM »
Hi Pharg,

Thanks!.. It really works very good.. also on a foreach list in listviewwinks or buddybanlist.

 
Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91