FileFormat sounds stupid.
This commit is contained in:
parent
56877c39c2
commit
ecf79d56f1
@ -72,7 +72,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, DAY, Favicon, FileFormat, HOUR, MINUTE, Main, NAMESPACE, SECOND, Time, VERSION, anonymize, conf, config, d, engine, expandComment, expandThread, filter, flatten, g, getTitle, imgExpand, imgGif, imgHover, key, keybinds, log, nav, options, qr, quoteBacklink, quoteIndicators, quoteInline, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, strikethroughQuotes, threadHiding, threadStats, threading, titlePost, ui, unread, unxify, updater, val, watcher, _base;
|
var $, $$, DAY, Favicon, FileInfo, HOUR, MINUTE, Main, NAMESPACE, SECOND, Time, VERSION, anonymize, conf, config, d, engine, expandComment, expandThread, filter, flatten, g, getTitle, imgExpand, imgGif, imgHover, key, keybinds, log, nav, options, qr, quoteBacklink, quoteIndicators, quoteInline, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, strikethroughQuotes, threadHiding, threadStats, threading, titlePost, ui, unread, unxify, updater, val, watcher, _base;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
main: {
|
main: {
|
||||||
@ -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',
|
||||||
fileFormatR: '%l (%s, %r, %n)',
|
fileInfoR: '%l (%s, %r, %n)',
|
||||||
fileFormatT: '%l (%s, %r)',
|
fileInfoT: '%l (%s, %r)',
|
||||||
favicon: 'ferongr',
|
favicon: 'ferongr',
|
||||||
hotkeys: {
|
hotkeys: {
|
||||||
openOptions: ['ctrl+o', 'Open Options'],
|
openOptions: ['ctrl+o', 'Open Options'],
|
||||||
@ -2079,7 +2079,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var arr, back, checked, description, dialog, favicon, fileFormatR, fileFormatT, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, ta, time, tr, ul, _i, _j, _len, _len2, _ref, _ref2, _ref3, _ref4;
|
var arr, back, checked, description, dialog, favicon, fileInfoR, fileInfoT, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, ta, time, tr, ul, _i, _j, _len, _len2, _ref, _ref2, _ref3, _ref4;
|
||||||
dialog = $.el('div', {
|
dialog = $.el('div', {
|
||||||
id: 'options',
|
id: 'options',
|
||||||
className: 'reply dialog',
|
className: 'reply dialog',
|
||||||
@ -2123,7 +2123,7 @@
|
|||||||
<p>Comment:<br><textarea name=comment></textarea></p>\
|
<p>Comment:<br><textarea name=comment></textarea></p>\
|
||||||
<p>Filename:<br><textarea name=filename></textarea></p>\
|
<p>Filename:<br><textarea name=filename></textarea></p>\
|
||||||
<p>Image dimensions:<br><textarea name=dimensions></textarea></p>\
|
<p>Image dimensions:<br><textarea name=dimensions></textarea></p>\
|
||||||
<p>FileFormat:<br><textarea name=filesize></textarea></p>\
|
<p>FileInfo:<br><textarea name=filesize></textarea></p>\
|
||||||
<p>Image MD5:<br><textarea name=md5></textarea></p>\
|
<p>Image MD5:<br><textarea name=md5></textarea></p>\
|
||||||
</div>\
|
</div>\
|
||||||
<input type=radio name=tab hidden id=rice_tab>\
|
<input type=radio name=tab hidden id=rice_tab>\
|
||||||
@ -2147,9 +2147,9 @@
|
|||||||
<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\
|
Reply File Info Formatting\
|
||||||
<li><input type=text name=fileFormatR> : <span id=fileFormatRPreview></span></li>\
|
<li><input type=text name=fileInfoR> : <span id=fileInfoRPreview></span></li>\
|
||||||
Thread File Info Formatting\
|
Thread File Info Formatting\
|
||||||
<li><input type=text name=fileFormatT> : <span id=fileFormatTPreview></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>\
|
||||||
@ -2208,16 +2208,16 @@
|
|||||||
}
|
}
|
||||||
(back = $('[name=backlink]', dialog)).value = conf['backlink'];
|
(back = $('[name=backlink]', dialog)).value = conf['backlink'];
|
||||||
(time = $('[name=time]', dialog)).value = conf['time'];
|
(time = $('[name=time]', dialog)).value = conf['time'];
|
||||||
(fileFormatR = $('[name=fileFormatR]', dialog)).value = conf['fileFormatR'];
|
(fileInfoR = $('[name=fileInfoR]', dialog)).value = conf['fileInfoR'];
|
||||||
(fileFormatT = $('[name=fileFormatT]', dialog)).value = conf['fileFormatT'];
|
(fileInfoT = $('[name=fileInfoT]', dialog)).value = conf['fileInfoT'];
|
||||||
$.on(back, 'keyup', $.cb.value);
|
$.on(back, 'keyup', $.cb.value);
|
||||||
$.on(back, 'keyup', options.backlink);
|
$.on(back, 'keyup', options.backlink);
|
||||||
$.on(time, 'keyup', $.cb.value);
|
$.on(time, 'keyup', $.cb.value);
|
||||||
$.on(time, 'keyup', options.time);
|
$.on(time, 'keyup', options.time);
|
||||||
$.on(fileFormatR, 'keyup', $.cb.value);
|
$.on(fileInfoR, 'keyup', $.cb.value);
|
||||||
$.on(fileFormatR, 'keyup', options.fileFormat);
|
$.on(fileInfoR, 'keyup', options.fileInfo);
|
||||||
$.on(fileFormatT, 'keyup', $.cb.value);
|
$.on(fileInfoT, 'keyup', $.cb.value);
|
||||||
$.on(fileFormatT, 'keyup', options.fileFormat);
|
$.on(fileInfoT, 'keyup', options.fileInfo);
|
||||||
favicon = $('select', dialog);
|
favicon = $('select', dialog);
|
||||||
favicon.value = conf['favicon'];
|
favicon.value = conf['favicon'];
|
||||||
$.on(favicon, 'change', $.cb.value);
|
$.on(favicon, 'change', $.cb.value);
|
||||||
@ -2256,8 +2256,8 @@
|
|||||||
d.body.style.setProperty('overflow', 'hidden', null);
|
d.body.style.setProperty('overflow', 'hidden', null);
|
||||||
options.backlink.call(back);
|
options.backlink.call(back);
|
||||||
options.time.call(time);
|
options.time.call(time);
|
||||||
options.fileFormat.call(fileFormatR);
|
options.fileInfo.call(fileInfoR);
|
||||||
options.fileFormat.call(fileFormatT);
|
options.fileInfo.call(fileInfoT);
|
||||||
return options.favicon.call(favicon);
|
return options.favicon.call(favicon);
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function() {
|
||||||
@ -2286,15 +2286,15 @@
|
|||||||
backlink: function() {
|
backlink: function() {
|
||||||
return $.id('backlinkPreview').textContent = conf['backlink'].replace(/%id/, '123456789');
|
return $.id('backlinkPreview').textContent = conf['backlink'].replace(/%id/, '123456789');
|
||||||
},
|
},
|
||||||
fileFormat: function() {
|
fileInfo: function() {
|
||||||
FileFormat.data = {
|
FileInfo.data = {
|
||||||
link: '<a href="javascript:;">1329791824.png</a>',
|
link: '<a href="javascript:;">1329791824.png</a>',
|
||||||
size: 996,
|
size: 996,
|
||||||
unit: 'KB',
|
unit: 'KB',
|
||||||
resolution: '1366x768',
|
resolution: '1366x768',
|
||||||
filename: 'Untitled.png'
|
filename: 'Untitled.png'
|
||||||
};
|
};
|
||||||
return $.id("" + this.name + "Preview").innerHTML = FileFormat.funks[this.name === 'fileFormatR' ? 0 : 1](FileFormat);
|
return $.id("" + this.name + "Preview").innerHTML = FileInfo.funks[this.name === 'fileInfoR' ? 0 : 1](FileInfo);
|
||||||
},
|
},
|
||||||
favicon: function() {
|
favicon: function() {
|
||||||
Favicon["switch"]();
|
Favicon["switch"]();
|
||||||
@ -2889,16 +2889,16 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
FileFormat = {
|
FileInfo = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (g.BOARD === 'f') return;
|
if (g.BOARD === 'f') return;
|
||||||
FileFormat.ffConf = ['fileFormatR', 'fileFormatT'];
|
FileInfo.ffConf = ['fileInfoR', 'fileInfoT'];
|
||||||
FileFormat.ffMtrs = [/%([BKlMnrs])/g, /%([BKlMrs])/g];
|
FileInfo.ffMtrs = [/%([BKlMnrs])/g, /%([BKlMrs])/g];
|
||||||
FileFormat.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;
|
||||||
FileFormat.ffType = node.childNodes.length > 3 ? 0 : 1;
|
FileInfo.ffType = node.childNodes.length > 3 ? 0 : 1;
|
||||||
_ref = node.innerHTML.match(FileFormat.ffRgex[FileFormat.ffType]), _ = _ref[0], link = _ref[1], size = _ref[2], unit = _ref[3], resolution = _ref[4], filename = _ref[5];
|
_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];
|
||||||
return {
|
return {
|
||||||
link: link,
|
link: link,
|
||||||
size: size,
|
size: size,
|
||||||
@ -2907,34 +2907,34 @@
|
|||||||
filename: filename
|
filename: filename
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
FileFormat.funks = FileFormat.setFormats();
|
FileInfo.funks = FileInfo.setFormats();
|
||||||
return g.callbacks.push(this.node);
|
return g.callbacks.push(this.node);
|
||||||
},
|
},
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
var node;
|
var node;
|
||||||
if (root.className === 'inline' || !(node = $('.filesize', root))) return;
|
if (root.className === 'inline' || !(node = $('.filesize', root))) return;
|
||||||
FileFormat.data = FileFormat.parse(node);
|
FileInfo.data = FileInfo.parse(node);
|
||||||
return node.innerHTML = FileFormat.funks[FileFormat.ffType](FileFormat) + ' ';
|
return node.innerHTML = FileInfo.funks[FileInfo.ffType](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[FileFormat.ffConf[i]].replace(FileFormat.ffMtrs[i], function(s, c) {
|
code = conf[FileInfo.ffConf[i]].replace(FileInfo.ffMtrs[i], function(s, c) {
|
||||||
if (c in FileFormat.formatters) {
|
if (c in FileInfo.formatters) {
|
||||||
return "' + FileFormat.formatters." + c + "() + '";
|
return "' + FileInfo.formatters." + c + "() + '";
|
||||||
} else {
|
} else {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_results.push(Function('FileFormat', "return '" + code + "'"));
|
_results.push(Function('FileInfo', "return '" + code + "'"));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
},
|
},
|
||||||
convertUnit: function(unitT) {
|
convertUnit: function(unitT) {
|
||||||
var i, size, unitF, units;
|
var i, size, unitF, units;
|
||||||
size = FileFormat.data.size;
|
size = FileInfo.data.size;
|
||||||
unitF = FileFormat.data.unit;
|
unitF = FileInfo.data.unit;
|
||||||
if (unitF !== unitT) {
|
if (unitF !== unitT) {
|
||||||
units = ['B', 'KB', 'MB'];
|
units = ['B', 'KB', 'MB'];
|
||||||
i = units.indexOf(unitF) - units.indexOf(unitT);
|
i = units.indexOf(unitF) - units.indexOf(unitT);
|
||||||
@ -2956,30 +2956,30 @@
|
|||||||
},
|
},
|
||||||
formatters: {
|
formatters: {
|
||||||
B: function() {
|
B: function() {
|
||||||
return FileFormat.convertUnit('B');
|
return FileInfo.convertUnit('B');
|
||||||
},
|
},
|
||||||
K: function() {
|
K: function() {
|
||||||
return FileFormat.convertUnit('KB');
|
return FileInfo.convertUnit('KB');
|
||||||
},
|
},
|
||||||
l: function() {
|
l: function() {
|
||||||
return FileFormat.data.link;
|
return FileInfo.data.link;
|
||||||
},
|
},
|
||||||
M: function() {
|
M: function() {
|
||||||
return FileFormat.convertUnit('MB');
|
return FileInfo.convertUnit('MB');
|
||||||
},
|
},
|
||||||
n: function() {
|
n: function() {
|
||||||
var ext;
|
var ext;
|
||||||
if ((ext = FileFormat.data.filename.lastIndexOf('.')) > 38) {
|
if ((ext = FileInfo.data.filename.lastIndexOf('.')) > 38) {
|
||||||
return '<span class=fnfull>' + FileFormat.data.filename + '</span><span class=fntrunc>' + FileFormat.data.filename.substr(0, 32) + ' (...)' + FileFormat.data.filename.substr(ext) + '</span>';
|
return '<span class=fnfull>' + FileInfo.data.filename + '</span><span class=fntrunc>' + FileInfo.data.filename.substr(0, 32) + ' (...)' + FileInfo.data.filename.substr(ext) + '</span>';
|
||||||
} else {
|
} else {
|
||||||
return FileFormat.data.filename;
|
return FileInfo.data.filename;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
r: function() {
|
r: function() {
|
||||||
return FileFormat.data.resolution;
|
return FileInfo.data.resolution;
|
||||||
},
|
},
|
||||||
s: function() {
|
s: function() {
|
||||||
return "" + FileFormat.data.size + " " + FileFormat.data.unit;
|
return "" + FileInfo.data.size + " " + FileInfo.data.unit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -3249,7 +3249,7 @@
|
|||||||
if (conf['Image Auto-Gif']) imgGif.node(qp);
|
if (conf['Image Auto-Gif']) imgGif.node(qp);
|
||||||
if (conf['Time Formatting']) Time.node(qp);
|
if (conf['Time Formatting']) Time.node(qp);
|
||||||
if (conf['File Info Formatting']) {
|
if (conf['File Info Formatting']) {
|
||||||
if (id !== threadID) return FileFormat.node(qp);
|
if (id !== threadID) return FileInfo.node(qp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -3743,7 +3743,7 @@
|
|||||||
if (conf['Filter'] || conf['Reply Hiding']) strikethroughQuotes.init();
|
if (conf['Filter'] || conf['Reply Hiding']) strikethroughQuotes.init();
|
||||||
if (conf['Anonymize']) anonymize.init();
|
if (conf['Anonymize']) anonymize.init();
|
||||||
if (conf['Time Formatting']) Time.init();
|
if (conf['Time Formatting']) Time.init();
|
||||||
if (conf['File Info Formatting']) FileFormat.init();
|
if (conf['File Info Formatting']) FileInfo.init();
|
||||||
if (conf['Sauce']) sauce.init();
|
if (conf['Sauce']) sauce.init();
|
||||||
if (conf['Reveal Spoilers']) revealSpoilers.init();
|
if (conf['Reveal Spoilers']) revealSpoilers.init();
|
||||||
if (conf['Image Auto-Gif']) imgGif.init();
|
if (conf['Image Auto-Gif']) imgGif.init();
|
||||||
|
|||||||
@ -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'
|
||||||
fileFormatR: '%l (%s, %r, %n)'
|
fileInfoR: '%l (%s, %r, %n)'
|
||||||
fileFormatT: '%l (%s, %r)'
|
fileInfoT: '%l (%s, %r)'
|
||||||
favicon: 'ferongr'
|
favicon: 'ferongr'
|
||||||
hotkeys:
|
hotkeys:
|
||||||
openOptions: ['ctrl+o', 'Open Options']
|
openOptions: ['ctrl+o', 'Open Options']
|
||||||
@ -1695,7 +1695,7 @@ options =
|
|||||||
<p>Comment:<br><textarea name=comment></textarea></p>
|
<p>Comment:<br><textarea name=comment></textarea></p>
|
||||||
<p>Filename:<br><textarea name=filename></textarea></p>
|
<p>Filename:<br><textarea name=filename></textarea></p>
|
||||||
<p>Image dimensions:<br><textarea name=dimensions></textarea></p>
|
<p>Image dimensions:<br><textarea name=dimensions></textarea></p>
|
||||||
<p>FileFormat:<br><textarea name=filesize></textarea></p>
|
<p>FileInfo:<br><textarea name=filesize></textarea></p>
|
||||||
<p>Image MD5:<br><textarea name=md5></textarea></p>
|
<p>Image MD5:<br><textarea name=md5></textarea></p>
|
||||||
</div>
|
</div>
|
||||||
<input type=radio name=tab hidden id=rice_tab>
|
<input type=radio name=tab hidden id=rice_tab>
|
||||||
@ -1719,9 +1719,9 @@ options =
|
|||||||
<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
|
Reply File Info Formatting
|
||||||
<li><input type=text name=fileFormatR> : <span id=fileFormatRPreview></span></li>
|
<li><input type=text name=fileInfoR> : <span id=fileInfoRPreview></span></li>
|
||||||
Thread File Info Formatting
|
Thread File Info Formatting
|
||||||
<li><input type=text name=fileFormatT> : <span id=fileFormatTPreview></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>
|
||||||
@ -1775,16 +1775,16 @@ options =
|
|||||||
#rice
|
#rice
|
||||||
(back = $ '[name=backlink]', dialog).value = conf['backlink']
|
(back = $ '[name=backlink]', dialog).value = conf['backlink']
|
||||||
(time = $ '[name=time]', dialog).value = conf['time']
|
(time = $ '[name=time]', dialog).value = conf['time']
|
||||||
(fileFormatR = $ '[name=fileFormatR]', dialog).value = conf['fileFormatR']
|
(fileInfoR = $ '[name=fileInfoR]', dialog).value = conf['fileInfoR']
|
||||||
(fileFormatT = $ '[name=fileFormatT]', dialog).value = conf['fileFormatT']
|
(fileInfoT = $ '[name=fileInfoT]', dialog).value = conf['fileInfoT']
|
||||||
$.on back, 'keyup', $.cb.value
|
$.on back, 'keyup', $.cb.value
|
||||||
$.on back, 'keyup', options.backlink
|
$.on back, 'keyup', options.backlink
|
||||||
$.on time, 'keyup', $.cb.value
|
$.on time, 'keyup', $.cb.value
|
||||||
$.on time, 'keyup', options.time
|
$.on time, 'keyup', options.time
|
||||||
$.on fileFormatR, 'keyup', $.cb.value
|
$.on fileInfoR, 'keyup', $.cb.value
|
||||||
$.on fileFormatR, 'keyup', options.fileFormat
|
$.on fileInfoR, 'keyup', options.fileInfo
|
||||||
$.on fileFormatT, 'keyup', $.cb.value
|
$.on fileInfoT, 'keyup', $.cb.value
|
||||||
$.on fileFormatT, 'keyup', options.fileFormat
|
$.on fileInfoT, 'keyup', options.fileInfo
|
||||||
favicon = $ 'select', dialog
|
favicon = $ 'select', dialog
|
||||||
favicon.value = conf['favicon']
|
favicon.value = conf['favicon']
|
||||||
$.on favicon, 'change', $.cb.value
|
$.on favicon, 'change', $.cb.value
|
||||||
@ -1817,8 +1817,8 @@ options =
|
|||||||
|
|
||||||
options.backlink.call back
|
options.backlink.call back
|
||||||
options.time.call time
|
options.time.call time
|
||||||
options.fileFormat.call fileFormatR
|
options.fileInfo.call fileInfoR
|
||||||
options.fileFormat.call fileFormatT
|
options.fileInfo.call fileInfoT
|
||||||
options.favicon.call favicon
|
options.favicon.call favicon
|
||||||
|
|
||||||
close: ->
|
close: ->
|
||||||
@ -1845,14 +1845,14 @@ options =
|
|||||||
$.id('timePreview').textContent = Time.funk Time
|
$.id('timePreview').textContent = Time.funk Time
|
||||||
backlink: ->
|
backlink: ->
|
||||||
$.id('backlinkPreview').textContent = conf['backlink'].replace /%id/, '123456789'
|
$.id('backlinkPreview').textContent = conf['backlink'].replace /%id/, '123456789'
|
||||||
fileFormat: ->
|
fileInfo: ->
|
||||||
FileFormat.data =
|
FileInfo.data =
|
||||||
link : '<a href="javascript:;">1329791824.png</a>'
|
link : '<a href="javascript:;">1329791824.png</a>'
|
||||||
size : 996
|
size : 996
|
||||||
unit : 'KB'
|
unit : 'KB'
|
||||||
resolution: '1366x768'
|
resolution: '1366x768'
|
||||||
filename : 'Untitled.png'
|
filename : 'Untitled.png'
|
||||||
$.id("#{@name}Preview").innerHTML = FileFormat.funks[if @name is 'fileFormatR' then 0 else 1] FileFormat
|
$.id("#{@name}Preview").innerHTML = FileInfo.funks[if @name is 'fileInfoR' then 0 else 1] FileInfo
|
||||||
favicon: ->
|
favicon: ->
|
||||||
Favicon.switch()
|
Favicon.switch()
|
||||||
unread.update true
|
unread.update true
|
||||||
@ -2329,40 +2329,40 @@ Time =
|
|||||||
P: -> if Time.date.getHours() < 12 then 'am' else 'pm'
|
P: -> if Time.date.getHours() < 12 then 'am' else 'pm'
|
||||||
y: -> Time.date.getFullYear() - 2000
|
y: -> Time.date.getFullYear() - 2000
|
||||||
|
|
||||||
FileFormat =
|
FileInfo =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.BOARD is 'f'
|
return if g.BOARD is 'f'
|
||||||
FileFormat.ffConf = [ 'fileFormatR', 'fileFormatT' ]
|
FileInfo.ffConf = [ 'fileInfoR', 'fileInfoT' ]
|
||||||
FileFormat.ffMtrs = [ /%([BKlMnrs])/g, /%([BKlMrs])/g ]
|
FileInfo.ffMtrs = [ /%([BKlMnrs])/g, /%([BKlMrs])/g ]
|
||||||
FileFormat.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) ->
|
||||||
FileFormat.ffType = if node.childNodes.length > 3 then 0 else 1
|
FileInfo.ffType = if node.childNodes.length > 3 then 0 else 1
|
||||||
[_, link, size, unit, resolution, filename] =
|
[_, link, size, unit, resolution, filename] =
|
||||||
node.innerHTML.match FileFormat.ffRgex[FileFormat.ffType]
|
node.innerHTML.match FileInfo.ffRgex[FileInfo.ffType]
|
||||||
link : link
|
link : link
|
||||||
size : size
|
size : size
|
||||||
unit : unit
|
unit : unit
|
||||||
resolution: resolution
|
resolution: resolution
|
||||||
filename : filename
|
filename : filename
|
||||||
|
|
||||||
FileFormat.funks = FileFormat.setFormats()
|
FileInfo.funks = FileInfo.setFormats()
|
||||||
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
|
||||||
FileFormat.data = FileFormat.parse node
|
FileInfo.data = FileInfo.parse node
|
||||||
node.innerHTML = FileFormat.funks[FileFormat.ffType](FileFormat) + ' '
|
node.innerHTML = FileInfo.funks[FileInfo.ffType](FileInfo) + ' '
|
||||||
setFormats: ->
|
setFormats: ->
|
||||||
for i in [0..1]
|
for i in [0..1]
|
||||||
code = conf[FileFormat.ffConf[i]].replace FileFormat.ffMtrs[i], (s, c) ->
|
code = conf[FileInfo.ffConf[i]].replace FileInfo.ffMtrs[i], (s, c) ->
|
||||||
if c of FileFormat.formatters
|
if c of FileInfo.formatters
|
||||||
"' + FileFormat.formatters.#{c}() + '"
|
"' + FileInfo.formatters.#{c}() + '"
|
||||||
else
|
else
|
||||||
s
|
s
|
||||||
Function 'FileFormat', "return '#{code}'"
|
Function 'FileInfo', "return '#{code}'"
|
||||||
convertUnit: (unitT) ->
|
convertUnit: (unitT) ->
|
||||||
size = FileFormat.data.size
|
size = FileInfo.data.size
|
||||||
unitF = FileFormat.data.unit
|
unitF = FileInfo.data.unit
|
||||||
if unitF isnt unitT
|
if unitF isnt unitT
|
||||||
units = [ 'B', 'KB', 'MB' ]
|
units = [ 'B', 'KB', 'MB' ]
|
||||||
i = units.indexOf(unitF) - units.indexOf(unitT)
|
i = units.indexOf(unitF) - units.indexOf(unitT)
|
||||||
@ -2375,16 +2375,16 @@ FileFormat =
|
|||||||
size = size.toFixed 2
|
size = size.toFixed 2
|
||||||
"#{size} #{unitT}"
|
"#{size} #{unitT}"
|
||||||
formatters:
|
formatters:
|
||||||
B: -> FileFormat.convertUnit 'B'
|
B: -> FileInfo.convertUnit 'B'
|
||||||
K: -> FileFormat.convertUnit 'KB'
|
K: -> FileInfo.convertUnit 'KB'
|
||||||
l: -> FileFormat.data.link
|
l: -> FileInfo.data.link
|
||||||
M: -> FileFormat.convertUnit 'MB'
|
M: -> FileInfo.convertUnit 'MB'
|
||||||
n: -> if (ext = FileFormat.data.filename.lastIndexOf '.') > 38
|
n: -> if (ext = FileInfo.data.filename.lastIndexOf '.') > 38
|
||||||
'<span class=fnfull>' + FileFormat.data.filename + '</span><span class=fntrunc>' + FileFormat.data.filename.substr(0, 32) + ' (...)' + FileFormat.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
|
||||||
FileFormat.data.filename
|
FileInfo.data.filename
|
||||||
r: -> FileFormat.data.resolution
|
r: -> FileInfo.data.resolution
|
||||||
s: -> "#{FileFormat.data.size} #{FileFormat.data.unit}"
|
s: -> "#{FileInfo.data.size} #{FileInfo.data.unit}"
|
||||||
|
|
||||||
getTitle = (thread) ->
|
getTitle = (thread) ->
|
||||||
el = $ '.filetitle', thread
|
el = $ '.filetitle', thread
|
||||||
@ -2586,7 +2586,7 @@ quotePreview =
|
|||||||
if conf['Time Formatting']
|
if conf['Time Formatting']
|
||||||
Time.node qp
|
Time.node qp
|
||||||
if conf['File Info Formatting']
|
if conf['File Info Formatting']
|
||||||
FileFormat.node qp if id isnt threadID
|
FileInfo.node qp if id isnt threadID
|
||||||
|
|
||||||
quoteIndicators =
|
quoteIndicators =
|
||||||
init: ->
|
init: ->
|
||||||
@ -2986,7 +2986,7 @@ Main =
|
|||||||
Time.init()
|
Time.init()
|
||||||
|
|
||||||
if conf['File Info Formatting']
|
if conf['File Info Formatting']
|
||||||
FileFormat.init()
|
FileInfo.init()
|
||||||
|
|
||||||
if conf['Sauce']
|
if conf['Sauce']
|
||||||
sauce.init()
|
sauce.init()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user