Make date parsing work on onesixtwo.club.
This commit is contained in:
parent
e4fd082bde
commit
bb8fab20b0
@ -39,9 +39,7 @@ class Post
|
||||
flagCode: @nodes.flag?.className.match(/flag-(\w+)/)?[1].toUpperCase()
|
||||
flagCodeTroll: @nodes.flag?.src?.match(/(\w+)\.gif$/)?[1].toUpperCase()
|
||||
flag: @nodes.flag?.title
|
||||
date: if @nodes.date then new Date(@nodes.date.getAttribute('datetime')?.trim() or (@nodes.date.dataset.utc * 1000))
|
||||
|
||||
delete @info.date if @info.date and isNaN(@info.date.getTime())
|
||||
date: if @nodes.date then g.SITE.parseDate(@nodes.date)
|
||||
|
||||
if Conf['Anonymize']
|
||||
@info.nameBlock = 'Anonymous'
|
||||
|
||||
@ -174,6 +174,13 @@ SW.tinyboard =
|
||||
$.replace nextSibling, uniqueID
|
||||
$.add uniqueID, nextSibling
|
||||
|
||||
parseDate: (node) ->
|
||||
date = Date.parse(node.getAttribute('datetime')?.trim())
|
||||
return new Date(date) unless isNaN(date)
|
||||
date = Date.parse(node.textContent.trim() + ' UTC') # e.g. onesixtwo.club
|
||||
return new Date(date) unless isNaN(date)
|
||||
undefined
|
||||
|
||||
parseFile: (post, file) ->
|
||||
{text, link, thumb} = file
|
||||
return false if $.x("ancestor::#{@xpath.postContainer}[1]", text) isnt post.nodes.root # file belongs to a reply
|
||||
|
||||
@ -174,6 +174,9 @@ SW.yotsuba =
|
||||
for type in ['Sticky', 'Closed'] when (icon = $ "img[alt=#{type}]", nodes.info)
|
||||
$.addClass icon, "#{type.toLowerCase()}Icon", 'retina'
|
||||
|
||||
parseDate: (node) ->
|
||||
new Date(node.dataset.utc * 1000)
|
||||
|
||||
parseFile: (post, file) ->
|
||||
{text, link, thumb} = file
|
||||
return false if not (info = link.nextSibling?.textContent.match /\(([\d.]+ [KMG]?B).*\)/)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user