Merge branch 'v3' into index

This commit is contained in:
Mayhem 2014-01-26 21:27:54 +01:00
commit a12bdb1451
4 changed files with 8 additions and 8 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

@ -99,16 +99,12 @@ $.rmClass = (el, className...) ->
el.classList.remove className...
$.hasClass = (el, className) ->
el.classList.contains className
$.rm = do ->
if 'remove' of Element.prototype
(el) -> el.remove()
else
(el) -> el.parentNode?.removeChild el
$.rm = (el) ->
el.remove()
$.rmAll = (root) ->
# jsperf.com/emptify-element
for node in [root.childNodes...]
# HTMLSelectElement.remove !== Element.remove
root.removeChild node
node.remove()
return
$.tn = (s) ->
d.createTextNode s

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]