Drop 'ff' prefixes in FileInfo values. It's already prefixed you aho.

This commit is contained in:
Nicolas Stepien 2012-02-29 22:29:38 +01:00
parent 9d0594312e
commit 23766e8ef9
2 changed files with 20 additions and 20 deletions

View File

@ -2320,7 +2320,7 @@
return $.id('backlinkPreview').textContent = conf['backlink'].replace(/%id/, '123456789'); return $.id('backlinkPreview').textContent = conf['backlink'].replace(/%id/, '123456789');
}, },
fileInfo: function() { fileInfo: function() {
FileInfo.ffType = this.name === 'fileInfoR' ? 0 : 1; FileInfo.type = this.name === 'fileInfoR' ? 0 : 1;
FileInfo.data = { FileInfo.data = {
link: '<a href="javascript:;">1329791824.png</a>', link: '<a href="javascript:;">1329791824.png</a>',
size: 996, size: 996,
@ -2329,7 +2329,7 @@
filename: 'Untitled.png' filename: 'Untitled.png'
}; };
FileInfo.funks = FileInfo.setFormats(); FileInfo.funks = FileInfo.setFormats();
return $.id("" + this.name + "Preview").innerHTML = FileInfo.funks[FileInfo.ffType](FileInfo); return $.id("" + this.name + "Preview").innerHTML = FileInfo.funks[FileInfo.type](FileInfo);
}, },
favicon: function() { favicon: function() {
Favicon["switch"](); Favicon["switch"]();
@ -2937,8 +2937,8 @@
node: function(root) { node: function(root) {
var filename, link, node, resolution, size, unit, _, _ref; var filename, link, node, resolution, size, unit, _, _ref;
if (root.className === 'inline' || !(node = $('.filesize', root))) return; if (root.className === 'inline' || !(node = $('.filesize', root))) return;
FileInfo.ffType = node.childElementCount === 2 ? 0 : 1; FileInfo.type = node.childElementCount === 2 ? 0 : 1;
_ref = node.innerHTML.match(FileInfo.ffRgex[FileInfo.ffType]), _ = _ref[0], link = _ref[1], size = _ref[2], unit = _ref[3], resolution = _ref[4], filename = _ref[5]; _ref = node.innerHTML.match(FileInfo.regexp[FileInfo.type]), _ = _ref[0], link = _ref[1], size = _ref[2], unit = _ref[3], resolution = _ref[4], filename = _ref[5];
FileInfo.data = { FileInfo.data = {
link: link, link: link,
size: size, size: size,
@ -2946,13 +2946,13 @@
resolution: resolution, resolution: resolution,
filename: filename filename: filename
}; };
return node.innerHTML = FileInfo.funks[FileInfo.ffType](FileInfo); return node.innerHTML = FileInfo.funks[FileInfo.type](FileInfo);
}, },
setFormats: function() { setFormats: function() {
var code, i, _results; var code, i, _results;
_results = []; _results = [];
for (i = 0; i <= 1; i++) { for (i = 0; i <= 1; i++) {
code = conf[FileInfo.ffConf[i]].replace(FileInfo.ffMtrs[i], function(s, c) { code = conf[FileInfo.conf[i]].replace(FileInfo.param[i], function(s, c) {
if (c in FileInfo.formatters) { if (c in FileInfo.formatters) {
return "' + FileInfo.formatters." + c + "() + '"; return "' + FileInfo.formatters." + c + "() + '";
} else { } else {
@ -2986,9 +2986,9 @@
} }
return "" + size + " " + unitT; return "" + size + " " + unitT;
}, },
ffConf: ['fileInfoR', 'fileInfoT'], conf: ['fileInfoR', 'fileInfoT'],
ffMtrs: [/%([BKlLMnNrs])/g, /%([BKlMrs])/g], param: [/%([BKlLMnNrs])/g, /%([BKlMrs])/g],
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)\)/], regexp: [/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)\)/],
formatters: { formatters: {
B: function() { B: function() {
return FileInfo.convertUnit('B'); return FileInfo.convertUnit('B');
@ -2997,7 +2997,7 @@
return FileInfo.convertUnit('KB'); return FileInfo.convertUnit('KB');
}, },
l: function() { l: function() {
if (FileInfo.ffType === 0) { if (FileInfo.type === 0) {
return FileInfo.data.link.replace(/>\d+\.\w+</, '>' + FileInfo.formatters.n() + '<'); return FileInfo.data.link.replace(/>\d+\.\w+</, '>' + FileInfo.formatters.n() + '<');
} else { } else {
return FileInfo.data.link; return FileInfo.data.link;

View File

@ -1904,7 +1904,7 @@ options =
backlink: -> backlink: ->
$.id('backlinkPreview').textContent = conf['backlink'].replace /%id/, '123456789' $.id('backlinkPreview').textContent = conf['backlink'].replace /%id/, '123456789'
fileInfo: -> fileInfo: ->
FileInfo.ffType = if @name is 'fileInfoR' then 0 else 1 FileInfo.type = if @name is 'fileInfoR' then 0 else 1
FileInfo.data = FileInfo.data =
link : '<a href="javascript:;">1329791824.png</a>' link : '<a href="javascript:;">1329791824.png</a>'
size : 996 size : 996
@ -1912,7 +1912,7 @@ options =
resolution: '1366x768' resolution: '1366x768'
filename : 'Untitled.png' filename : 'Untitled.png'
FileInfo.funks = FileInfo.setFormats() FileInfo.funks = FileInfo.setFormats()
$.id("#{@name}Preview").innerHTML = FileInfo.funks[FileInfo.ffType] FileInfo $.id("#{@name}Preview").innerHTML = FileInfo.funks[FileInfo.type] FileInfo
favicon: -> favicon: ->
Favicon.switch() Favicon.switch()
unread.update true unread.update true
@ -2402,19 +2402,19 @@ FileInfo =
g.callbacks.push @node g.callbacks.push @node
node: (root) -> node: (root) ->
return if root.className is 'inline' or not node = $ '.filesize', root return if root.className is 'inline' or not node = $ '.filesize', root
FileInfo.ffType = if node.childElementCount is 2 then 0 else 1 FileInfo.type = if node.childElementCount is 2 then 0 else 1
[_, link, size, unit, resolution, filename] = [_, link, size, unit, resolution, filename] =
node.innerHTML.match FileInfo.ffRgex[FileInfo.ffType] node.innerHTML.match FileInfo.regexp[FileInfo.type]
FileInfo.data = FileInfo.data =
link: link link: link
size: size size: size
unit: unit unit: unit
resolution: resolution resolution: resolution
filename: filename filename: filename
node.innerHTML = FileInfo.funks[FileInfo.ffType] FileInfo node.innerHTML = FileInfo.funks[FileInfo.type] FileInfo
setFormats: -> setFormats: ->
for i in [0..1] for i in [0..1]
code = conf[FileInfo.ffConf[i]].replace FileInfo.ffMtrs[i], (s, c) -> code = conf[FileInfo.conf[i]].replace FileInfo.param[i], (s, c) ->
if c of FileInfo.formatters if c of FileInfo.formatters
"' + FileInfo.formatters.#{c}() + '" "' + FileInfo.formatters.#{c}() + '"
else else
@ -2434,15 +2434,15 @@ FileInfo =
if size < 1 and size.toString().length > size.toFixed(2).length if size < 1 and size.toString().length > size.toFixed(2).length
size = size.toFixed 2 size = size.toFixed 2
"#{size} #{unitT}" "#{size} #{unitT}"
ffConf: [ conf: [
'fileInfoR' 'fileInfoR'
'fileInfoT' 'fileInfoT'
] ]
ffMtrs: [ param: [
/%([BKlLMnNrs])/g /%([BKlLMnNrs])/g
/%([BKlMrs])/g /%([BKlMrs])/g
] ]
ffRgex: [ regexp: [
/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),\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)\)/
] ]
@ -2450,7 +2450,7 @@ FileInfo =
B: -> FileInfo.convertUnit 'B' B: -> FileInfo.convertUnit 'B'
K: -> FileInfo.convertUnit 'KB' K: -> FileInfo.convertUnit 'KB'
l: -> l: ->
if FileInfo.ffType is 0 if FileInfo.type is 0
FileInfo.data.link.replace />\d+\.\w+</, '>' + FileInfo.formatters.n() + '<' FileInfo.data.link.replace />\d+\.\w+</, '>' + FileInfo.formatters.n() + '<'
else else
FileInfo.data.link FileInfo.data.link