|
41 | 41 | refreshMillis: 60000,
|
42 | 42 | allowFuture: false,
|
43 | 43 | localeTitle: false,
|
44 |
| - cutoff: 0, |
| 44 | + cutoff: 172800000, |
45 | 45 | strings: {
|
46 | 46 | prefixAgo: null,
|
47 | 47 | prefixFromNow: null,
|
48 | 48 | suffixAgo: "ago",
|
49 | 49 | suffixFromNow: "from now",
|
50 |
| - seconds: "less than a minute", |
51 |
| - minute: "about a minute", |
| 50 | + seconds: "Mere seconds", |
| 51 | + minute: "A minute", |
52 | 52 | minutes: "%d minutes",
|
53 |
| - hour: "about an hour", |
54 |
| - hours: "about %d hours", |
55 |
| - day: "a day", |
| 53 | + hour: "An hour", |
| 54 | + hours: "%d hours", |
| 55 | + day: "A day", |
56 | 56 | days: "%d days",
|
57 |
| - month: "about a month", |
| 57 | + month: "A month", |
58 | 58 | months: "%d months",
|
59 |
| - year: "about a year", |
60 |
| - years: "%d years", |
| 59 | + year: "A year", |
| 60 | + years: "Over a year", |
61 | 61 | wordSeparator: " ",
|
62 | 62 | numbers: []
|
63 | 63 | }
|
|
124 | 124 | // functions are called with context of a single element
|
125 | 125 | var functions = {
|
126 | 126 | init: function(){
|
| 127 | + $(this).data("origtime",$(this).html()); |
127 | 128 | var refresh_el = $.proxy(refresh, this);
|
128 | 129 | refresh_el();
|
129 | 130 | var $s = $t.settings;
|
|
159 | 160 |
|
160 | 161 | if (!isNaN(data.datetime)) {
|
161 | 162 | if ( $s.cutoff == 0 || distance(data.datetime) < $s.cutoff) {
|
162 |
| - $(this).text(inWords(data.datetime)); |
| 163 | + |
| 164 | + $(this).text(inWords(data.datetime)).hover( |
| 165 | + function(){ |
| 166 | + var $this = $(this); |
| 167 | + var d = data.datetime, |
| 168 | + daysago = (new Date().getDate() - d.getDate()), |
| 169 | + exacttime = [(d.getHours() > 12 ? d.getHours() - 12 : d.getHours()),d.getMinutes()].join(":") + (d.getHours() >= 12 ? "pm" : "am"), |
| 170 | + realdate; |
| 171 | + switch (daysago) { |
| 172 | + case 0: |
| 173 | + realdate = "At " + exacttime; |
| 174 | + break; |
| 175 | + case 1: |
| 176 | + realdate = "Yesterday at " + exacttime; |
| 177 | + break; |
| 178 | + default: |
| 179 | + realdate = d.toLocaleDateString() + " at " + exacttime; |
| 180 | + } |
| 181 | + $this.stop().fadeOut(100,function(){ |
| 182 | + $this.data("orig",$this.text()).text(realdate).stop().fadeIn(100); |
| 183 | + }); |
| 184 | + }, function() { |
| 185 | + var $this = $(this); |
| 186 | + $this.fadeOut(100,function(){ |
| 187 | + $this.text($this.data("orig")).stop().fadeIn(100); |
| 188 | + }); |
| 189 | + } |
| 190 | + ); |
163 | 191 | }
|
164 | 192 | }
|
| 193 | + $(this).fadeIn('slow'); |
165 | 194 | return this;
|
166 | 195 | }
|
167 | 196 |
|
|
0 commit comments