Add original file name to links inside threads. Add truncated/untrancated parameters.

This commit is contained in:
ahodesuka 2012-02-21 16:47:37 -06:00
parent ecf79d56f1
commit c5fd4455dc
3 changed files with 37 additions and 16 deletions

View File

@ -149,8 +149,8 @@
sauces: ['http://iqdb.org/?url=$1', 'http://www.google.com/searchbyimage?image_url=$1', '#http://tineye.com/search?url=$1', '#http://saucenao.com/search.php?db=999&url=$1', '#http://3d.iqdb.org/?url=$1', '#http://regex.info/exif.cgi?imgurl=$2', '# uploaders:', '#http://imgur.com/upload?url=$2', '#http://omploader.org/upload?url1=$2', '# "View Same" in archives:', '#http://archive.foolz.us/a/image/$3/', '#http://archive.installgentoo.net/g/image/$3'].join('\n'), sauces: ['http://iqdb.org/?url=$1', 'http://www.google.com/searchbyimage?image_url=$1', '#http://tineye.com/search?url=$1', '#http://saucenao.com/search.php?db=999&url=$1', '#http://3d.iqdb.org/?url=$1', '#http://regex.info/exif.cgi?imgurl=$2', '# uploaders:', '#http://imgur.com/upload?url=$2', '#http://omploader.org/upload?url1=$2', '# "View Same" in archives:', '#http://archive.foolz.us/a/image/$3/', '#http://archive.installgentoo.net/g/image/$3'].join('\n'),
time: '%m/%d/%y(%a)%H:%M', time: '%m/%d/%y(%a)%H:%M',
backlink: '>>%id', backlink: '>>%id',
fileInfoR: '%l (%s, %r, %n)', fileInfoR: '%l, %s, %r',
fileInfoT: '%l (%s, %r)', fileInfoT: '%l, %s, %r',
favicon: 'ferongr', favicon: 'ferongr',
hotkeys: { hotkeys: {
openOptions: ['ctrl+o', 'Open Options'], openOptions: ['ctrl+o', 'Open Options'],
@ -2146,14 +2146,16 @@
</ul>\ </ul>\
<div class=warning><code>File Info Formatting</code> is disabled.</div>\ <div class=warning><code>File Info Formatting</code> is disabled.</div>\
<ul>\ <ul>\
Reply File Info Formatting\
<li><input type=text name=fileInfoR> : <span id=fileInfoRPreview></span></li>\
Thread File Info Formatting\ Thread File Info Formatting\
<li><input type=text name=fileInfoT> : <span id=fileInfoTPreview></span></li>\ <li><input type=text name=fileInfoT> : <span id=fileInfoTPreview></span></li>\
<li>Link: %l (lowercase L)</li>\ <li>Link: %l (lowercase L)</li>\
<li>Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)</li>\ <li>Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)</li>\
<li>Resolution: %r (Displays PDF on /po/, for PDF\'s)</li>\ <li>Resolution: %r (Displays PDF on /po/, for PDF\'s)</li>\
<li>Original filename: %n (Reply only)</li>\ Reply File Info Formatting\
<li><input type=text name=fileInfoR> : <span id=fileInfoRPreview></span></li>\
<li>All thread formatters also work for reply formatting.</li>\
<li>Link (with original file name): %l (lowercase L)(Truncated), %L (Untruncated)</li>\
<li>Original file name: %n (Truncated), %N (Untruncated)</li>\
</ul>\ </ul>\
<div class=warning><code>Unread Favicon</code> is disabled.</div>\ <div class=warning><code>Unread Favicon</code> is disabled.</div>\
Unread favicons<br>\ Unread favicons<br>\
@ -2294,6 +2296,7 @@
resolution: '1366x768', resolution: '1366x768',
filename: 'Untitled.png' filename: 'Untitled.png'
}; };
FileInfo.funks = FileInfo.setFormats();
return $.id("" + this.name + "Preview").innerHTML = FileInfo.funks[this.name === 'fileInfoR' ? 0 : 1](FileInfo); return $.id("" + this.name + "Preview").innerHTML = FileInfo.funks[this.name === 'fileInfoR' ? 0 : 1](FileInfo);
}, },
favicon: function() { favicon: function() {
@ -2893,7 +2896,7 @@
init: function() { init: function() {
if (g.BOARD === 'f') return; if (g.BOARD === 'f') return;
FileInfo.ffConf = ['fileInfoR', 'fileInfoT']; FileInfo.ffConf = ['fileInfoR', 'fileInfoT'];
FileInfo.ffMtrs = [/%([BKlMnrs])/g, /%([BKlMrs])/g]; FileInfo.ffMtrs = [/%([BKlLMnNrs])/g, /%([BKlMrs])/g];
FileInfo.ffRgex = [/File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s<span\stitle=\"([^\"]+)\">/, /File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/]; FileInfo.ffRgex = [/File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s<span\stitle=\"([^\"]+)\">/, /File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/];
this.parse = function(node) { this.parse = function(node) {
var filename, link, resolution, size, unit, _, _ref; var filename, link, resolution, size, unit, _, _ref;
@ -2962,7 +2965,14 @@
return FileInfo.convertUnit('KB'); return FileInfo.convertUnit('KB');
}, },
l: function() { l: function() {
return FileInfo.data.link; if (FileInfo.ffType === 0) {
return FileInfo.data.link.replace(/>\d+\.\w+</, '>' + FileInfo.formatters.n() + '<');
} else {
return FileInfo.data.link;
}
},
L: function() {
return FileInfo.data.link.replace(/>\d+\.\w+</, '>' + FileInfo.data.filename + '<');
}, },
M: function() { M: function() {
return FileInfo.convertUnit('MB'); return FileInfo.convertUnit('MB');
@ -2975,6 +2985,9 @@
return FileInfo.data.filename; return FileInfo.data.filename;
} }
}, },
N: function() {
return FileInfo.data.filename;
},
r: function() { r: function() {
return FileInfo.data.resolution; return FileInfo.data.resolution;
}, },

View File

@ -5,10 +5,10 @@ master
Add Open Reply in New Tab option for replies made from the main board (not dumping). Add Open Reply in New Tab option for replies made from the main board (not dumping).
Scroll back up (top of anchor - 42px) when unexpanding images. Scroll back up (top of anchor - 42px) when unexpanding images.
Reply/Thread File Info Formatting: Reply/Thread File Info Formatting:
- Link: %l. - Link: %l, %L (Original file names are shown inside threads).
- Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default). - Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default).
- Resolution/PDF: %r - Resolution/PDF: %r
- Original filename: %n (truncated if longer than 40~ character, on hover the entire string is shown. - Original filename: %n, %N.
- Mayhem - Mayhem
The Filter now has per filter settings: The Filter now has per filter settings:
- Filter the OP only along its thread, replies only, or both. - Filter the OP only along its thread, replies only, or both.

View File

@ -78,8 +78,8 @@ config =
].join '\n' ].join '\n'
time: '%m/%d/%y(%a)%H:%M' time: '%m/%d/%y(%a)%H:%M'
backlink: '>>%id' backlink: '>>%id'
fileInfoR: '%l (%s, %r, %n)' fileInfoR: '%l, %s, %r'
fileInfoT: '%l (%s, %r)' fileInfoT: '%l, %s, %r'
favicon: 'ferongr' favicon: 'ferongr'
hotkeys: hotkeys:
openOptions: ['ctrl+o', 'Open Options'] openOptions: ['ctrl+o', 'Open Options']
@ -1718,14 +1718,16 @@ options =
</ul> </ul>
<div class=warning><code>File Info Formatting</code> is disabled.</div> <div class=warning><code>File Info Formatting</code> is disabled.</div>
<ul> <ul>
Reply File Info Formatting
<li><input type=text name=fileInfoR> : <span id=fileInfoRPreview></span></li>
Thread File Info Formatting Thread File Info Formatting
<li><input type=text name=fileInfoT> : <span id=fileInfoTPreview></span></li> <li><input type=text name=fileInfoT> : <span id=fileInfoTPreview></span></li>
<li>Link: %l (lowercase L)</li> <li>Link: %l (lowercase L)</li>
<li>Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)</li> <li>Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)</li>
<li>Resolution: %r (Displays PDF on /po/, for PDF\'s)</li> <li>Resolution: %r (Displays PDF on /po/, for PDF\'s)</li>
<li>Original filename: %n (Reply only)</li> Reply File Info Formatting
<li><input type=text name=fileInfoR> : <span id=fileInfoRPreview></span></li>
<li>All thread formatters also work for reply formatting.</li>
<li>Link (with original file name): %l (lowercase L)(Truncated), %L (Untruncated)</li>
<li>Original file name: %n (Truncated), %N (Untruncated)</li>
</ul> </ul>
<div class=warning><code>Unread Favicon</code> is disabled.</div> <div class=warning><code>Unread Favicon</code> is disabled.</div>
Unread favicons<br> Unread favicons<br>
@ -1852,6 +1854,7 @@ options =
unit : 'KB' unit : 'KB'
resolution: '1366x768' resolution: '1366x768'
filename : 'Untitled.png' filename : 'Untitled.png'
FileInfo.funks = FileInfo.setFormats()
$.id("#{@name}Preview").innerHTML = FileInfo.funks[if @name is 'fileInfoR' then 0 else 1] FileInfo $.id("#{@name}Preview").innerHTML = FileInfo.funks[if @name is 'fileInfoR' then 0 else 1] FileInfo
favicon: -> favicon: ->
Favicon.switch() Favicon.switch()
@ -2333,7 +2336,7 @@ FileInfo =
init: -> init: ->
return if g.BOARD is 'f' return if g.BOARD is 'f'
FileInfo.ffConf = [ 'fileInfoR', 'fileInfoT' ] FileInfo.ffConf = [ 'fileInfoR', 'fileInfoT' ]
FileInfo.ffMtrs = [ /%([BKlMnrs])/g, /%([BKlMrs])/g ] FileInfo.ffMtrs = [ /%([BKlLMnNrs])/g, /%([BKlMrs])/g ]
FileInfo.ffRgex = [ /File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s<span\stitle=\"([^\"]+)\">/, FileInfo.ffRgex = [ /File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s<span\stitle=\"([^\"]+)\">/,
/File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/ ] /File:\s(<a.+<\/a>)-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/ ]
@parse = (node) -> @parse = (node) ->
@ -2377,12 +2380,17 @@ FileInfo =
formatters: formatters:
B: -> FileInfo.convertUnit 'B' B: -> FileInfo.convertUnit 'B'
K: -> FileInfo.convertUnit 'KB' K: -> FileInfo.convertUnit 'KB'
l: -> FileInfo.data.link l: -> if FileInfo.ffType is 0
FileInfo.data.link.replace />\d+\.\w+</, '>' + FileInfo.formatters.n() + '<'
else
FileInfo.data.link
L: -> FileInfo.data.link.replace />\d+\.\w+</, '>' + FileInfo.data.filename + '<'
M: -> FileInfo.convertUnit 'MB' M: -> FileInfo.convertUnit 'MB'
n: -> if (ext = FileInfo.data.filename.lastIndexOf '.') > 38 n: -> if (ext = FileInfo.data.filename.lastIndexOf '.') > 38
'<span class=fnfull>' + FileInfo.data.filename + '</span><span class=fntrunc>' + FileInfo.data.filename.substr(0, 32) + ' (...)' + FileInfo.data.filename.substr(ext) + '</span>' '<span class=fnfull>' + FileInfo.data.filename + '</span><span class=fntrunc>' + FileInfo.data.filename.substr(0, 32) + ' (...)' + FileInfo.data.filename.substr(ext) + '</span>'
else else
FileInfo.data.filename FileInfo.data.filename
N: -> FileInfo.data.filename
r: -> FileInfo.data.resolution r: -> FileInfo.data.resolution
s: -> "#{FileInfo.data.size} #{FileInfo.data.unit}" s: -> "#{FileInfo.data.size} #{FileInfo.data.unit}"