File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 17
17
$ . timeago = function ( timestamp ) {
18
18
if ( timestamp instanceof Date ) return inWords ( timestamp ) ;
19
19
else if ( typeof timestamp == "string" ) return inWords ( $ . timeago . parse ( timestamp ) ) ;
20
- else return inWords ( $ . timeago . parse ( $ ( timestamp ) . attr ( "title" ) ) ) ;
20
+ else return inWords ( $ . timeago . datetime ( timestamp ) ) ;
21
21
} ;
22
22
var $t = $ . timeago ;
23
23
83
83
s = s . replace ( / T / , " " ) . replace ( / Z / , " UTC" ) ;
84
84
s = s . replace ( / ( [ \+ - ] \d \d ) \: ? ( \d \d ) / , " $1$2" ) ; // -04:00 -> -0400
85
85
return new Date ( s ) ;
86
+ } ,
87
+ datetime : function ( elem ) {
88
+ var that = $ ( elem ) ;
89
+ return $t . parse ( that . is ( 'time' ) ? that . attr ( 'datetime' ) : that . attr ( 'title' ) ) ;
86
90
}
87
91
} ) ;
88
92
98
102
} ;
99
103
100
104
function refresh ( ) {
101
- var date = $t . parse ( this . title ) ;
105
+ var date = $t . datetime ( this ) ;
102
106
if ( ! isNaN ( date ) ) {
103
107
$ ( this ) . text ( inWords ( date ) ) ;
104
108
}
120
124
121
125
// fix for IE6 suckage
122
126
document . createElement ( 'abbr' ) ;
127
+ document . createElement ( 'time' ) ;
123
128
} ) ( jQuery ) ;
You can’t perform that action at this time.
0 commit comments