Add data-md5 attribute to /f/ posts built from JSON.
This makes MD5 Sauce links work for cross-board/thread quotes to /f/.
This commit is contained in:
parent
11a465c720
commit
56ebd3bd44
@ -39,6 +39,8 @@ Build.Test =
|
||||
$.rmClass el, 'prettyprinted'
|
||||
for el in $$ 'pre[style=""]', root2
|
||||
el.removeAttribute 'style'
|
||||
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
|
||||
$('.fileInfo[data-md5]', root2)?.removeAttribute 'data-md5'
|
||||
textNodes = $.X './/text()', root2
|
||||
i = 0
|
||||
while (node = textNodes.snapshotItem i++)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
?{file}{
|
||||
<div class="file" id="f${ID}">
|
||||
?{boardID === "f"}{
|
||||
<div class="fileInfo"><span class="fileText" id="fT${ID}">
|
||||
<div class="fileInfo" data-md5="${file.MD5}"><span class="fileText" id="fT${ID}">
|
||||
File:
|
||||
<a data-width="${file.width}" data-height="${file.height}" href="${fileURL}" target="_blank">${file.name}</a>
|
||||
-(${file.size}, ${file.dimensions}?{file.tag}{, ${file.tag}})
|
||||
|
||||
@ -199,6 +199,7 @@ class Post
|
||||
isVideo: /webm$/i.test link.href
|
||||
dimensions: info[0].match(/\d+x\d+/)?[0]
|
||||
tag: info[0].match(/,[^,]*, ([a-z]+)\)/i)?[1]
|
||||
MD5: fileText.dataset.md5
|
||||
size = +@file.size.match(/[\d.]+/)[0]
|
||||
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
|
||||
size *= 1024 while unit-- > 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user