From 23766e8ef916584eeea567407b8cc7c96e66f51a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 29 Feb 2012 22:29:38 +0100 Subject: [PATCH] Drop 'ff' prefixes in FileInfo values. It's already prefixed you aho. --- 4chan_x.user.js | 20 ++++++++++---------- script.coffee | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 63d2ca4fc..025489f63 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2320,7 +2320,7 @@ return $.id('backlinkPreview').textContent = conf['backlink'].replace(/%id/, '123456789'); }, fileInfo: function() { - FileInfo.ffType = this.name === 'fileInfoR' ? 0 : 1; + FileInfo.type = this.name === 'fileInfoR' ? 0 : 1; FileInfo.data = { link: '1329791824.png', size: 996, @@ -2329,7 +2329,7 @@ filename: 'Untitled.png' }; 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["switch"](); @@ -2937,8 +2937,8 @@ node: function(root) { var filename, link, node, resolution, size, unit, _, _ref; if (root.className === 'inline' || !(node = $('.filesize', root))) return; - FileInfo.ffType = 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]; + FileInfo.type = node.childElementCount === 2 ? 0 : 1; + _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 = { link: link, size: size, @@ -2946,13 +2946,13 @@ resolution: resolution, filename: filename }; - return node.innerHTML = FileInfo.funks[FileInfo.ffType](FileInfo); + return node.innerHTML = FileInfo.funks[FileInfo.type](FileInfo); }, setFormats: function() { var code, i, _results; _results = []; 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) { return "' + FileInfo.formatters." + c + "() + '"; } else { @@ -2986,9 +2986,9 @@ } return "" + size + " " + unitT; }, - ffConf: ['fileInfoR', 'fileInfoT'], - ffMtrs: [/%([BKlLMnNrs])/g, /%([BKlMrs])/g], - ffRgex: [/File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s/, /File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/], + conf: ['fileInfoR', 'fileInfoT'], + param: [/%([BKlLMnNrs])/g, /%([BKlMrs])/g], + regexp: [/File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s/, /File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/], formatters: { B: function() { return FileInfo.convertUnit('B'); @@ -2997,7 +2997,7 @@ return FileInfo.convertUnit('KB'); }, l: function() { - if (FileInfo.ffType === 0) { + if (FileInfo.type === 0) { return FileInfo.data.link.replace(/>\d+\.\w+' + FileInfo.formatters.n() + '<'); } else { return FileInfo.data.link; diff --git a/script.coffee b/script.coffee index 0d99f65d9..1d21f7489 100644 --- a/script.coffee +++ b/script.coffee @@ -1904,7 +1904,7 @@ options = backlink: -> $.id('backlinkPreview').textContent = conf['backlink'].replace /%id/, '123456789' fileInfo: -> - FileInfo.ffType = if @name is 'fileInfoR' then 0 else 1 + FileInfo.type = if @name is 'fileInfoR' then 0 else 1 FileInfo.data = link : '1329791824.png' size : 996 @@ -1912,7 +1912,7 @@ options = resolution: '1366x768' filename : 'Untitled.png' FileInfo.funks = FileInfo.setFormats() - $.id("#{@name}Preview").innerHTML = FileInfo.funks[FileInfo.ffType] FileInfo + $.id("#{@name}Preview").innerHTML = FileInfo.funks[FileInfo.type] FileInfo favicon: -> Favicon.switch() unread.update true @@ -2402,19 +2402,19 @@ FileInfo = g.callbacks.push @node node: (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] = - node.innerHTML.match FileInfo.ffRgex[FileInfo.ffType] + node.innerHTML.match FileInfo.regexp[FileInfo.type] FileInfo.data = link: link size: size unit: unit resolution: resolution filename: filename - node.innerHTML = FileInfo.funks[FileInfo.ffType] FileInfo + node.innerHTML = FileInfo.funks[FileInfo.type] FileInfo setFormats: -> 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 "' + FileInfo.formatters.#{c}() + '" else @@ -2434,15 +2434,15 @@ FileInfo = if size < 1 and size.toString().length > size.toFixed(2).length size = size.toFixed 2 "#{size} #{unitT}" - ffConf: [ + conf: [ 'fileInfoR' 'fileInfoT' ] - ffMtrs: [ + param: [ /%([BKlLMnNrs])/g /%([BKlMrs])/g ] - ffRgex: [ + regexp: [ /File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s/ /File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/ ] @@ -2450,7 +2450,7 @@ FileInfo = B: -> FileInfo.convertUnit 'B' K: -> FileInfo.convertUnit 'KB' l: -> - if FileInfo.ffType is 0 + if FileInfo.type is 0 FileInfo.data.link.replace />\d+\.\w+' + FileInfo.formatters.n() + '<' else FileInfo.data.link