Merge pull request #1407 from ParrotParrot/v3

Added %name to sauce
This commit is contained in:
Mayhem 2014-01-25 13:41:46 -08:00
commit 24f93da8e7
3 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,4 @@
- Added `Original filename` variable to Sauce panel.
- Added a `Reset Settings` button in the settings.
### 3.15.2 - *2014-01-22*

View File

@ -5,6 +5,7 @@
<li><code>%TURL</code>: Thumbnail URL.</li>
<li><code>%URL</code>: Full image URL.</li>
<li><code>%MD5</code>: MD5 hash.</li>
<li><code>%name</code>: Original file name.</li>
<li><code>%board</code>: Current board.</li>
</ul>
<textarea name="sauces" class="field" spellcheck="false"></textarea>

View File

@ -15,7 +15,7 @@ Sauce =
name: 'Sauce'
cb: @node
createSauceLink: (link) ->
link = link.replace /%(T?URL|MD5|board)/g, (parameter) ->
link = link.replace /%(T?URL|MD5|board|name)/g, (parameter) ->
switch parameter
when '%TURL'
"' + encodeURIComponent(post.file.thumbURL) + '"
@ -25,6 +25,8 @@ Sauce =
"' + encodeURIComponent(post.file.MD5) + '"
when '%board'
"' + encodeURIComponent(post.board) + '"
when '%name'
"' + encodeURIComponent(post.file.name) + '"
else
parameter
text = if m = link.match(/;text:(.+)$/) then m[1] else link.match(/(\w+)\.\w+\//)[1]