Support the same options for the boards: option in Sauce that we do for Filter. #2171

This commit is contained in:
ccd0 2019-07-15 22:52:37 -07:00
parent 6ca5b28cd5
commit 1d217f63eb
2 changed files with 5 additions and 3 deletions

View File

@ -18,7 +18,7 @@
</ul>
<div>Lines starting with a <code>#</code> will be ignored.</div>
<div>You can specify a display text by appending <code>;text:[text]</code> to the URL.</div>
<div>You can specify the applicable boards by appending <code>;boards:[board1],[board2]</code>.</div>
<div>You can specify the applicable boards/sites by appending <code>;boards:[board1],[board2]</code>. See the Filter guide for details.</div>
<div>You can specify the applicable file types by appending <code>;types:[extension1],[extension2]</code>.</div>
<div>You can specify a regular expression the filename must match by appending <code>;regexp:[regular expression]</code>.</div>
</div>

View File

@ -26,6 +26,8 @@ Sauce =
m = part.match /^(\w*):?(.*)$/
parts[m[1]] = m[2]
parts['text'] or= parts['url'].match(/(\w+)\.\w+\//)?[1] or '?'
if 'boards' of parts
parts['boards'] = Filter.parseBoards parts['boards']
if 'regexp' of parts
try
if (regexp = parts['regexp'].match /^\/(.*)\/(\w*)$/)
@ -48,8 +50,8 @@ Sauce =
parts = {}
$.extend parts, link
return null unless !parts['boards'] or post.board.ID in parts['boards'].split ','
return null unless !parts['types'] or ext in parts['types'].split ','
return null unless !parts['boards'] or parts['boards']["#{post.siteID}/#{post.boardID}"] or parts['boards']["#{post.siteID}/*"]
return null unless !parts['types'] or ext in parts['types'].split(',')
return null unless !parts['regexp'] or (matches = file.name.match parts['regexp'])
missing = []