diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c13c7154..1e3c85000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor ### v1.11.22 +**v1.11.22.1** *(2016-01-12)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.22.1/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.22.1/builds/4chan-X-noupdate.crx "Chromium version")] +- Update archive image search URL, avoiding problem with image search on fireden.net. +- Add `%sMD5` (MD5 in URL-safe base64) and `%hMD5` (MD5 in hexadecimal) to available sauce parameters. +- Improve Violentmonkey support. + **v1.11.22.0** *(2016-01-10)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.22.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.22.0/builds/4chan-X-noupdate.crx "Chromium version")] - Based on v1.11.21.5. - Disable safe search in Google image search links. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index c8ba0bbd1..46d1517f8 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index 106510046..08b255140 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.11.22.0 +// @version 1.11.22.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 8c7815db4..335520e68 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.11.22.0 +// @version 1.11.22.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -309,7 +309,7 @@ filesize: '', MD5: '' }, - sauces: "https://www.google.com/searchbyimage?image_url=%IMG&safe=off\n//iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n# tools:\n#http://regex.info/exif.cgi?imgurl=%URL\n#//imgops.com/%URL;types:gif,jpg,png\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.4plebs.org/_/search/image/%MD5/;text:View same on 4plebs\n#https://archive.4plebs.org/%board/search/image/%MD5/;text:View same on 4plebs /%board/;boards:adv,f,hr,o,pol,s4s,sp,tg,trv,tv,x\n#https://rbt.asia/%board/?task=search2&search_media_hash=%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", + sauces: "https://www.google.com/searchbyimage?image_url=%IMG&safe=off\n//iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n# tools:\n#http://regex.info/exif.cgi?imgurl=%URL\n#//imgops.com/%URL;types:gif,jpg,png\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.4plebs.org/_/search/image/%sMD5/;text:View same on 4plebs\n#https://archive.4plebs.org/%board/search/image/%sMD5/;text:View same on 4plebs /%board/;boards:adv,f,hr,o,pol,s4s,sp,tg,trv,tv,x\n#https://rbt.asia/%board/image/%sMD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", FappeT: { werk: false }, @@ -434,7 +434,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.22.0', + VERSION: '1.11.22.1', NAMESPACE: '4chan X.', boards: {} }; @@ -1041,7 +1041,7 @@ if (key in $.syncing) { delete $.oldValue[key]; if ($.hasStorage) { - return delete localStorage[key]; + return localStorage.removeItem(key); } } }; @@ -1060,7 +1060,7 @@ if (key in $.syncing) { delete $.oldValue[key]; } - return delete localStorage[key]; + return localStorage.removeItem(key); }; } else { $.setValue = function() {}; @@ -1088,30 +1088,33 @@ }; (function() { var onChange; - onChange = function(key) { - var cb, newValue; + onChange = function(arg) { + var cb, key, newValue; + key = arg.key, newValue = arg.newValue; if (!(cb = $.syncing[key])) { return; } - newValue = $.getValue(key); - if (newValue === $.oldValue[key]) { - return; - } if (newValue != null) { + if (newValue === $.oldValue[key]) { + return; + } $.oldValue[key] = newValue; return cb(JSON.parse(newValue), key.slice(g.NAMESPACE.length)); } else { + if ($.oldValue[key] == null) { + return; + } delete $.oldValue[key]; return cb(void 0, key.slice(g.NAMESPACE.length)); } }; - $.on(window, 'storage', function(arg) { - var key; - key = arg.key; - return onChange(key); - }); + $.on(window, 'storage', onChange); return $.forceSync = function(key) { - return onChange(g.NAMESPACE + key); + key = g.NAMESPACE + key; + return onChange({ + key: key, + newValue: $.getValue(key) + }); }; })(); } else { @@ -11528,23 +11531,14 @@ ext = post.file.url.match(/[^.]*$/)[0]; skip = false; for (key in parts) { - parts[key] = parts[key].replace(/%(T?URL|IMG|MD5|board|name|%|semi)/g, function(parameter) { + parts[key] = parts[key].replace(/%(T?URL|IMG|[sh]?MD5|board|name|%|semi)/g, function(_, parameter) { var type; - type = { - '%TURL': post.file.thumbURL, - '%URL': post.file.url, - '%IMG': ext === 'gif' || ext === 'jpg' || ext === 'png' ? post.file.url : post.file.thumbURL, - '%MD5': post.file.MD5, - '%board': post.board.ID, - '%name': post.file.name, - '%%': '%', - '%semi': ';' - }[parameter]; + type = Sauce.formatters[parameter](post, ext); if (type == null) { skip = true; return ''; } - if (key === 'url' && parameter !== '%%' && parameter !== '%semi') { + if (key === 'url' && (parameter !== '%' && parameter !== 'semi')) { if (/^javascript:/i.test(parts['url'])) { type = JSON.stringify(type); } @@ -11591,6 +11585,60 @@ } } return $.add(this.file.text, nodes); + }, + formatters: { + TURL: function(post) { + return post.file.thumbURL; + }, + URL: function(post) { + return post.file.url; + }, + IMG: function(post, ext) { + if (ext === 'gif' || ext === 'jpg' || ext === 'png') { + return post.file.url; + } else { + return post.file.thumbURL; + } + }, + MD5: function(post) { + return post.file.MD5; + }, + sMD5: function(post) { + var ref; + return (ref = post.file.MD5) != null ? ref.replace(/[+\/=]/g, function(c) { + return { + '+': '-', + '/': '_', + '=': '' + }[c]; + }) : void 0; + }, + hMD5: function(post) { + if (post.file.MD5) { + return ((function() { + var k, len1, ref, results; + ref = atob(post.file.MD5); + results = []; + for (k = 0, len1 = ref.length; k < len1; k++) { + c = ref[k]; + results.push(("0" + (c.charCodeAt(0).toString(16))).slice(-2)); + } + return results; + })()).join(''); + } + }, + board: function(post) { + return post.board.ID; + }, + name: function(post) { + return post.file.name; + }, + '%': function() { + return '%'; + }, + semi: function() { + return ';'; + } } }; @@ -14690,9 +14738,17 @@ value = { 'Developer': 'dev' }[value] || value.toLowerCase(); + } else if (type === 'image') { + value = value.replace(/[+\/=]/g, function(c) { + return { + '+': '-', + '/': '_', + '=': '' + }[c]; + }); } value = encodeURIComponent(value); - path = archive.software === 'foolfuuka' ? boardID + "/search/" + type + "/" + value : boardID + "/?task=search2&search_" + (type === 'image' ? 'media_hash' : type) + "=" + value; + path = archive.software === 'foolfuuka' ? boardID + "/search/" + type + "/" + value + "/" : type === 'image' ? boardID + "/image/" + value : boardID + "/?task=search2&search_" + type + "=" + value; return "" + (Redirect.protocol(archive)) + archive.domain + "/" + path; }, report: function(archive, arg) { @@ -17314,7 +17370,7 @@ sauce: function(section) { var ta; $.extend(section, { - innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" + innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" }); $('.warning', section).hidden = Conf['Sauce']; ta = $('textarea', section); diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 956691ba4..065592079 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index 8773a73ad..1c4c4897a 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.22.0 +// @version 1.11.22.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -309,7 +309,7 @@ filesize: '', MD5: '' }, - sauces: "https://www.google.com/searchbyimage?image_url=%IMG&safe=off\n//iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n# tools:\n#http://regex.info/exif.cgi?imgurl=%URL\n#//imgops.com/%URL;types:gif,jpg,png\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.4plebs.org/_/search/image/%MD5/;text:View same on 4plebs\n#https://archive.4plebs.org/%board/search/image/%MD5/;text:View same on 4plebs /%board/;boards:adv,f,hr,o,pol,s4s,sp,tg,trv,tv,x\n#https://rbt.asia/%board/?task=search2&search_media_hash=%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", + sauces: "https://www.google.com/searchbyimage?image_url=%IMG&safe=off\n//iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n# tools:\n#http://regex.info/exif.cgi?imgurl=%URL\n#//imgops.com/%URL;types:gif,jpg,png\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.4plebs.org/_/search/image/%sMD5/;text:View same on 4plebs\n#https://archive.4plebs.org/%board/search/image/%sMD5/;text:View same on 4plebs /%board/;boards:adv,f,hr,o,pol,s4s,sp,tg,trv,tv,x\n#https://rbt.asia/%board/image/%sMD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", FappeT: { werk: false }, @@ -434,7 +434,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.22.0', + VERSION: '1.11.22.1', NAMESPACE: '4chan X.', boards: {} }; @@ -1041,7 +1041,7 @@ if (key in $.syncing) { delete $.oldValue[key]; if ($.hasStorage) { - return delete localStorage[key]; + return localStorage.removeItem(key); } } }; @@ -1060,7 +1060,7 @@ if (key in $.syncing) { delete $.oldValue[key]; } - return delete localStorage[key]; + return localStorage.removeItem(key); }; } else { $.setValue = function() {}; @@ -1088,30 +1088,33 @@ }; (function() { var onChange; - onChange = function(key) { - var cb, newValue; + onChange = function(arg) { + var cb, key, newValue; + key = arg.key, newValue = arg.newValue; if (!(cb = $.syncing[key])) { return; } - newValue = $.getValue(key); - if (newValue === $.oldValue[key]) { - return; - } if (newValue != null) { + if (newValue === $.oldValue[key]) { + return; + } $.oldValue[key] = newValue; return cb(JSON.parse(newValue), key.slice(g.NAMESPACE.length)); } else { + if ($.oldValue[key] == null) { + return; + } delete $.oldValue[key]; return cb(void 0, key.slice(g.NAMESPACE.length)); } }; - $.on(window, 'storage', function(arg) { - var key; - key = arg.key; - return onChange(key); - }); + $.on(window, 'storage', onChange); return $.forceSync = function(key) { - return onChange(g.NAMESPACE + key); + key = g.NAMESPACE + key; + return onChange({ + key: key, + newValue: $.getValue(key) + }); }; })(); } else { @@ -11528,23 +11531,14 @@ ext = post.file.url.match(/[^.]*$/)[0]; skip = false; for (key in parts) { - parts[key] = parts[key].replace(/%(T?URL|IMG|MD5|board|name|%|semi)/g, function(parameter) { + parts[key] = parts[key].replace(/%(T?URL|IMG|[sh]?MD5|board|name|%|semi)/g, function(_, parameter) { var type; - type = { - '%TURL': post.file.thumbURL, - '%URL': post.file.url, - '%IMG': ext === 'gif' || ext === 'jpg' || ext === 'png' ? post.file.url : post.file.thumbURL, - '%MD5': post.file.MD5, - '%board': post.board.ID, - '%name': post.file.name, - '%%': '%', - '%semi': ';' - }[parameter]; + type = Sauce.formatters[parameter](post, ext); if (type == null) { skip = true; return ''; } - if (key === 'url' && parameter !== '%%' && parameter !== '%semi') { + if (key === 'url' && (parameter !== '%' && parameter !== 'semi')) { if (/^javascript:/i.test(parts['url'])) { type = JSON.stringify(type); } @@ -11591,6 +11585,60 @@ } } return $.add(this.file.text, nodes); + }, + formatters: { + TURL: function(post) { + return post.file.thumbURL; + }, + URL: function(post) { + return post.file.url; + }, + IMG: function(post, ext) { + if (ext === 'gif' || ext === 'jpg' || ext === 'png') { + return post.file.url; + } else { + return post.file.thumbURL; + } + }, + MD5: function(post) { + return post.file.MD5; + }, + sMD5: function(post) { + var ref; + return (ref = post.file.MD5) != null ? ref.replace(/[+\/=]/g, function(c) { + return { + '+': '-', + '/': '_', + '=': '' + }[c]; + }) : void 0; + }, + hMD5: function(post) { + if (post.file.MD5) { + return ((function() { + var k, len1, ref, results; + ref = atob(post.file.MD5); + results = []; + for (k = 0, len1 = ref.length; k < len1; k++) { + c = ref[k]; + results.push(("0" + (c.charCodeAt(0).toString(16))).slice(-2)); + } + return results; + })()).join(''); + } + }, + board: function(post) { + return post.board.ID; + }, + name: function(post) { + return post.file.name; + }, + '%': function() { + return '%'; + }, + semi: function() { + return ';'; + } } }; @@ -14690,9 +14738,17 @@ value = { 'Developer': 'dev' }[value] || value.toLowerCase(); + } else if (type === 'image') { + value = value.replace(/[+\/=]/g, function(c) { + return { + '+': '-', + '/': '_', + '=': '' + }[c]; + }); } value = encodeURIComponent(value); - path = archive.software === 'foolfuuka' ? boardID + "/search/" + type + "/" + value : boardID + "/?task=search2&search_" + (type === 'image' ? 'media_hash' : type) + "=" + value; + path = archive.software === 'foolfuuka' ? boardID + "/search/" + type + "/" + value + "/" : type === 'image' ? boardID + "/image/" + value : boardID + "/?task=search2&search_" + type + "=" + value; return "" + (Redirect.protocol(archive)) + archive.domain + "/" + path; }, report: function(archive, arg) { @@ -17314,7 +17370,7 @@ sauce: function(section) { var ta; $.extend(section, { - innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" + innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" }); $('.warning', section).hidden = Conf['Sauce']; ta = $('textarea', section); diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index b1c022422..706081619 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index 5546f0f92..493ee2b55 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.22.0 +// @version 1.11.22.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index b2960b0d0..8ec59400c 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.22.0 +// @version 1.11.22.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -309,7 +309,7 @@ filesize: '', MD5: '' }, - sauces: "https://www.google.com/searchbyimage?image_url=%IMG&safe=off\n//iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n# tools:\n#http://regex.info/exif.cgi?imgurl=%URL\n#//imgops.com/%URL;types:gif,jpg,png\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.4plebs.org/_/search/image/%MD5/;text:View same on 4plebs\n#https://archive.4plebs.org/%board/search/image/%MD5/;text:View same on 4plebs /%board/;boards:adv,f,hr,o,pol,s4s,sp,tg,trv,tv,x\n#https://rbt.asia/%board/?task=search2&search_media_hash=%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", + sauces: "https://www.google.com/searchbyimage?image_url=%IMG&safe=off\n//iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n# tools:\n#http://regex.info/exif.cgi?imgurl=%URL\n#//imgops.com/%URL;types:gif,jpg,png\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.4plebs.org/_/search/image/%sMD5/;text:View same on 4plebs\n#https://archive.4plebs.org/%board/search/image/%sMD5/;text:View same on 4plebs /%board/;boards:adv,f,hr,o,pol,s4s,sp,tg,trv,tv,x\n#https://rbt.asia/%board/image/%sMD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", FappeT: { werk: false }, @@ -434,7 +434,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.22.0', + VERSION: '1.11.22.1', NAMESPACE: '4chan X.', boards: {} }; @@ -1041,7 +1041,7 @@ if (key in $.syncing) { delete $.oldValue[key]; if ($.hasStorage) { - return delete localStorage[key]; + return localStorage.removeItem(key); } } }; @@ -1060,7 +1060,7 @@ if (key in $.syncing) { delete $.oldValue[key]; } - return delete localStorage[key]; + return localStorage.removeItem(key); }; } else { $.setValue = function() {}; @@ -1088,30 +1088,33 @@ }; (function() { var onChange; - onChange = function(key) { - var cb, newValue; + onChange = function(arg) { + var cb, key, newValue; + key = arg.key, newValue = arg.newValue; if (!(cb = $.syncing[key])) { return; } - newValue = $.getValue(key); - if (newValue === $.oldValue[key]) { - return; - } if (newValue != null) { + if (newValue === $.oldValue[key]) { + return; + } $.oldValue[key] = newValue; return cb(JSON.parse(newValue), key.slice(g.NAMESPACE.length)); } else { + if ($.oldValue[key] == null) { + return; + } delete $.oldValue[key]; return cb(void 0, key.slice(g.NAMESPACE.length)); } }; - $.on(window, 'storage', function(arg) { - var key; - key = arg.key; - return onChange(key); - }); + $.on(window, 'storage', onChange); return $.forceSync = function(key) { - return onChange(g.NAMESPACE + key); + key = g.NAMESPACE + key; + return onChange({ + key: key, + newValue: $.getValue(key) + }); }; })(); } else { @@ -11528,23 +11531,14 @@ ext = post.file.url.match(/[^.]*$/)[0]; skip = false; for (key in parts) { - parts[key] = parts[key].replace(/%(T?URL|IMG|MD5|board|name|%|semi)/g, function(parameter) { + parts[key] = parts[key].replace(/%(T?URL|IMG|[sh]?MD5|board|name|%|semi)/g, function(_, parameter) { var type; - type = { - '%TURL': post.file.thumbURL, - '%URL': post.file.url, - '%IMG': ext === 'gif' || ext === 'jpg' || ext === 'png' ? post.file.url : post.file.thumbURL, - '%MD5': post.file.MD5, - '%board': post.board.ID, - '%name': post.file.name, - '%%': '%', - '%semi': ';' - }[parameter]; + type = Sauce.formatters[parameter](post, ext); if (type == null) { skip = true; return ''; } - if (key === 'url' && parameter !== '%%' && parameter !== '%semi') { + if (key === 'url' && (parameter !== '%' && parameter !== 'semi')) { if (/^javascript:/i.test(parts['url'])) { type = JSON.stringify(type); } @@ -11591,6 +11585,60 @@ } } return $.add(this.file.text, nodes); + }, + formatters: { + TURL: function(post) { + return post.file.thumbURL; + }, + URL: function(post) { + return post.file.url; + }, + IMG: function(post, ext) { + if (ext === 'gif' || ext === 'jpg' || ext === 'png') { + return post.file.url; + } else { + return post.file.thumbURL; + } + }, + MD5: function(post) { + return post.file.MD5; + }, + sMD5: function(post) { + var ref; + return (ref = post.file.MD5) != null ? ref.replace(/[+\/=]/g, function(c) { + return { + '+': '-', + '/': '_', + '=': '' + }[c]; + }) : void 0; + }, + hMD5: function(post) { + if (post.file.MD5) { + return ((function() { + var k, len1, ref, results; + ref = atob(post.file.MD5); + results = []; + for (k = 0, len1 = ref.length; k < len1; k++) { + c = ref[k]; + results.push(("0" + (c.charCodeAt(0).toString(16))).slice(-2)); + } + return results; + })()).join(''); + } + }, + board: function(post) { + return post.board.ID; + }, + name: function(post) { + return post.file.name; + }, + '%': function() { + return '%'; + }, + semi: function() { + return ';'; + } } }; @@ -14690,9 +14738,17 @@ value = { 'Developer': 'dev' }[value] || value.toLowerCase(); + } else if (type === 'image') { + value = value.replace(/[+\/=]/g, function(c) { + return { + '+': '-', + '/': '_', + '=': '' + }[c]; + }); } value = encodeURIComponent(value); - path = archive.software === 'foolfuuka' ? boardID + "/search/" + type + "/" + value : boardID + "/?task=search2&search_" + (type === 'image' ? 'media_hash' : type) + "=" + value; + path = archive.software === 'foolfuuka' ? boardID + "/search/" + type + "/" + value + "/" : type === 'image' ? boardID + "/image/" + value : boardID + "/?task=search2&search_" + type + "=" + value; return "" + (Redirect.protocol(archive)) + archive.domain + "/" + path; }, report: function(archive, arg) { @@ -17314,7 +17370,7 @@ sauce: function(section) { var ta; $.extend(section, { - innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" + innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" }); $('.warning', section).hidden = Conf['Sauce']; ta = $('textarea', section); diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index e74765fd9..7d1ce7f0d 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index 293c58d96..326b59952 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index a91489a47..242944148 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/version.json b/version.json index afb3bc790..8c8a4f5df 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "1.11.22.0", - "date": "2016-01-11T01:04:20.341Z" + "version": "1.11.22.1", + "date": "2016-01-12T10:18:55.491Z" }