Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #72 from aeonofdiscord/localtime
Browse files Browse the repository at this point in the history
show local time as a tooltip on each entry's timestamp (#19)
  • Loading branch information
ianh committed Oct 21, 2017
2 parents fc47966 + 24259d8 commit 394f21e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ function Entry(data)
operation = "whisper:"+this.portal+" ";
else
operation = "quote:"+this.portal+"-"+this.id+" ";
var offset = new Date().getTimezoneOffset()*60000;
var date = new Date(this.timestamp - offset);
var lz = (v)=> { return (v<10 ? '0':'')+v; };
var localtime = ''+date.getFullYear()+'-'+lz(date.getMonth()+1)+'-'+lz(date.getDate())+' '+lz(date.getHours())+':'+lz(date.getMinutes());

html += this.editstamp ? "<c class='editstamp' data-operation='"+operation+"'>edited "+timeSince(this.editstamp)+" ago</c>" : "<c class='timestamp' data-operation='"+operation+"'>"+timeSince(this.timestamp)+" ago</c>";
html += this.editstamp ? "<c class='editstamp' data-operation='"+operation+"' title='"+localtime+"'>edited "+timeSince(this.editstamp)+" ago</c>" : "<c class='timestamp' data-operation='"+operation+"' title='"+localtime+"'>"+timeSince(this.timestamp)+" ago</c>";

html += this.portal == r.portal.data.name && r.is_owner ? "<t class='tools'><t data-operation='delete:"+this.id+"'>del</t></t>" : "";

Expand Down

0 comments on commit 394f21e

Please sign in to comment.