Add unix timestamps to fileinfo.

This commit is contained in:
Nicolas Stepien 2012-10-25 00:46:23 +02:00
parent d51dc0d74c
commit 98607c27d8
3 changed files with 18 additions and 8 deletions

View File

@ -2763,8 +2763,8 @@
<ul>\
File Info Formatting\
<li><input name=fileInfo class=field> : <span id=fileInfoPreview class=fileText></span></li>\
<li>Link (with original file name): %l (lowercase L, truncated), %L (untruncated)</li>\
<li>Original file name: %n (Truncated), %N (Untruncated)</li>\
<li>Link: %l (lowercase L, truncated), %L (untruncated), %t (Unix timestamp)</li>\
<li>Original file name: %n (truncated), %N (untruncated), %T (Unix timestamp)</li>\
<li>Spoiler indicator: %p</li>\
<li>Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)</li>\
<li>Resolution: %r (Displays PDF on /po/, for PDFs)</li>\
@ -2949,7 +2949,7 @@
},
fileInfo: function() {
FileInfo.data = {
link: 'javascript:;',
link: '//images.4chan.org/g/src/1334437723720.jpg',
spoiler: true,
size: '276',
unit: 'KB',
@ -3540,7 +3540,7 @@
},
setFormats: function() {
var code;
code = Conf['fileInfo'].replace(/%([BKlLMnNprs])/g, function(s, c) {
code = Conf['fileInfo'].replace(/%(.)/g, function(s, c) {
if (c in FileInfo.formatters) {
return "' + f.formatters." + c + "() + '";
} else {
@ -3575,6 +3575,12 @@
return "" + size + " " + unitT;
},
formatters: {
t: function() {
return FileInfo.data.link.match(/\d+\..+$/)[0];
},
T: function() {
return "<a href=" + FileInfo.data.link + " target=_blank>" + (this.t()) + "</a>";
},
l: function() {
return "<a href=" + FileInfo.data.link + " target=_blank>" + (this.n()) + "</a>";
},

View File

@ -1,6 +1,8 @@
master
- noface
The Menu now has search links for Archivers.
- Mayhem
Added possibility to display unix timestamps with File Info Formatting.
2.36.0
- Mayhem

View File

@ -2199,8 +2199,8 @@ Options =
<ul>
File Info Formatting
<li><input name=fileInfo class=field> : <span id=fileInfoPreview class=fileText></span></li>
<li>Link (with original file name): %l (lowercase L, truncated), %L (untruncated)</li>
<li>Original file name: %n (Truncated), %N (Untruncated)</li>
<li>Link: %l (lowercase L, truncated), %L (untruncated), %t (Unix timestamp)</li>
<li>Original file name: %n (truncated), %N (untruncated), %T (Unix timestamp)</li>
<li>Spoiler indicator: %p</li>
<li>Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)</li>
<li>Resolution: %r (Displays PDF on /po/, for PDFs)</li>
@ -2367,7 +2367,7 @@ Options =
$.id('backlinkPreview').textContent = Conf['backlink'].replace /%id/, '123456789'
fileInfo: ->
FileInfo.data =
link: 'javascript:;'
link: '//images.4chan.org/g/src/1334437723720.jpg'
spoiler: true
size: '276'
unit: 'KB'
@ -2812,7 +2812,7 @@ FileInfo =
node.setAttribute 'data-filename', filename
node.innerHTML = FileInfo.funk FileInfo
setFormats: ->
code = Conf['fileInfo'].replace /%([BKlLMnNprs])/g, (s, c) ->
code = Conf['fileInfo'].replace /%(.)/g, (s, c) ->
if c of FileInfo.formatters
"' + f.formatters.#{c}() + '"
else
@ -2833,6 +2833,8 @@ FileInfo =
size = size.toFixed 2
"#{size} #{unitT}"
formatters:
t: -> FileInfo.data.link.match(/\d+\..+$/)[0]
T: -> "<a href=#{FileInfo.data.link} target=_blank>#{@t()}</a>"
l: -> "<a href=#{FileInfo.data.link} target=_blank>#{@n()}</a>"
L: -> "<a href=#{FileInfo.data.link} target=_blank>#{@N()}</a>"
n: ->