Add current board sauce parameter. Close #298.

This commit is contained in:
Nicolas Stepien 2012-02-29 20:17:29 +01:00
parent 3de9684dba
commit 558d65b15d
3 changed files with 20 additions and 13 deletions

View File

@ -148,7 +148,7 @@
filesize: [''].join('\n'), filesize: [''].join('\n'),
md5: [''].join('\n') md5: [''].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'), 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/$4/image/$3/', '#http://archive.installgentoo.net/$4/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', fileInfoR: '%l, %s, %r',
@ -2125,10 +2125,11 @@
<div>\ <div>\
<div class=warning><code>Sauce</code> is disabled.</div>\ <div class=warning><code>Sauce</code> is disabled.</div>\
Lines starting with a <code>#</code> will be ignored.\ Lines starting with a <code>#</code> will be ignored.\
<ul>These variables will be replaced by the corresponding url:\ <ul>These parameters will be replaced by their corresponding values:\
<li>$1: Thumbnail.</li>\ <li>$1: Thumbnail url.</li>\
<li>$2: Full image.</li>\ <li>$2: Full image url.</li>\
<li>$3: MD5 hash.</li>\ <li>$3: MD5 hash.</li>\
<li>$4: Current board.</li>\
</ul>\ </ul>\
<textarea name=sauces id=sauces></textarea>\ <textarea name=sauces id=sauces></textarea>\
</div>\ </div>\
@ -2771,14 +2772,16 @@
funk: function(link) { funk: function(link) {
var domain, href; var domain, href;
domain = link.match(/(\w+)\.\w+\//)[1]; domain = link.match(/(\w+)\.\w+\//)[1];
href = link.replace(/(\$\d)/, function(fragment) { href = link.replace(/(\$\d)/g, function(parameter) {
switch (fragment) { switch (parameter) {
case '$1': case '$1':
return "http://thumbs.4chan.org' + img.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '"; return "http://thumbs.4chan.org' + img.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '";
case '$2': case '$2':
return "' + img.href + '"; return "' + img.href + '";
case '$3': case '$3':
return "' + img.firstChild.getAttribute('md5').replace(/\=*$/, '') + '"; return "' + img.firstChild.getAttribute('md5').replace(/\=*$/, '') + '";
case '$4':
return g.BOARD;
} }
}); });
href = Function('img', "return '" + href + "'"); href = Function('img', "return '" + href + "'");

View File

@ -10,6 +10,7 @@ master
Fix stubs if poster has unique ID. Fix stubs if poster has unique ID.
- Mayhem - Mayhem
You can now filter or highlight admin/mod posts. You can now filter or highlight admin/mod posts.
New sauce parameter. $4: Current board.
2.27.1 2.27.1
- Mayhem - Mayhem

View File

@ -104,8 +104,8 @@ config =
'#http://imgur.com/upload?url=$2' '#http://imgur.com/upload?url=$2'
'#http://omploader.org/upload?url1=$2' '#http://omploader.org/upload?url1=$2'
'# "View Same" in archives:' '# "View Same" in archives:'
'#http://archive.foolz.us/a/image/$3/' '#http://archive.foolz.us/$4/image/$3/'
'#http://archive.installgentoo.net/g/image/$3' '#http://archive.installgentoo.net/$4/image/$3'
].join '\n' ].join '\n'
time: '%m/%d/%y(%a)%H:%M' time: '%m/%d/%y(%a)%H:%M'
backlink: '>>%id' backlink: '>>%id'
@ -1723,10 +1723,11 @@ options =
<div> <div>
<div class=warning><code>Sauce</code> is disabled.</div> <div class=warning><code>Sauce</code> is disabled.</div>
Lines starting with a <code>#</code> will be ignored. Lines starting with a <code>#</code> will be ignored.
<ul>These variables will be replaced by the corresponding url: <ul>These parameters will be replaced by their corresponding values:
<li>$1: Thumbnail.</li> <li>$1: Thumbnail url.</li>
<li>$2: Full image.</li> <li>$2: Full image url.</li>
<li>$3: MD5 hash.</li> <li>$3: MD5 hash.</li>
<li>$4: Current board.</li>
</ul> </ul>
<textarea name=sauces id=sauces></textarea> <textarea name=sauces id=sauces></textarea>
</div> </div>
@ -2282,14 +2283,16 @@ sauce =
funk: (link) -> funk: (link) ->
domain = link.match(/(\w+)\.\w+\//)[1] domain = link.match(/(\w+)\.\w+\//)[1]
href = link.replace /(\$\d)/, (fragment) -> href = link.replace /(\$\d)/g, (parameter) ->
switch fragment switch parameter
when '$1' when '$1'
"http://thumbs.4chan.org' + img.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '" "http://thumbs.4chan.org' + img.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '"
when '$2' when '$2'
"' + img.href + '" "' + img.href + '"
when '$3' when '$3'
"' + img.firstChild.getAttribute('md5').replace(/\=*$/, '') + '" "' + img.firstChild.getAttribute('md5').replace(/\=*$/, '') + '"
when '$4'
g.BOARD
href = Function 'img', "return '#{href}'" href = Function 'img', "return '#{href}'"
(img) -> (img) ->
$.el 'a', $.el 'a',