diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6373d1251..c736ca036 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,9 @@
- More stability update.
- Stability update.
+**ParrotParrot**:
+- Added `Original filename` variable to Sauce panel.
+
**seaweedchan**:
- Fix Menu errors on older Firefox versions, such as the ESR
diff --git a/LICENSE b/LICENSE
index 486b179bc..a9480db3d 100755
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
/*
-* 4chan X - Version 1.3.2 - 2014-01-24
+* 4chan X - Version 1.3.2 - 2014-01-28
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index 690c1005d..13a5371f9 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -23,7 +23,7 @@
// ==/UserScript==
/*
-* 4chan X - Version 1.3.2 - 2014-01-24
+* 4chan X - Version 1.3.2 - 2014-01-28
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@@ -561,21 +561,12 @@
return __indexOf.call(el.classList, className) >= 0;
};
- $.rm = (function() {
- if ('remove' in Element.prototype) {
- return function(el) {
- return el.remove();
- };
- } else {
- return function(el) {
- var _ref;
- return (_ref = el.parentNode) != null ? _ref.removeChild(el) : void 0;
- };
- }
- })();
+ $.rm = function(el) {
+ return el.remove();
+ };
$.rmAll = function(root) {
- return root.textContent = '';
+ return root.textContent = null;
};
$.tn = function(s) {
@@ -7972,19 +7963,15 @@
},
createSauceLink: function(link) {
var m, text;
- link = link.replace(/%(T?URL|MD5|board)/ig, function(parameter) {
- switch (parameter) {
- case '%TURL':
- return "' + encodeURIComponent(post.file.thumbURL) + '";
- case '%URL':
- return "' + encodeURIComponent(post.file.URL) + '";
- case '%MD5':
- return "' + encodeURIComponent(post.file.MD5) + '";
- case '%board':
- return "' + encodeURIComponent(post.board) + '";
- default:
- return parameter;
- }
+ link = link.replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
+ var type;
+ return ((type = {
+ '%TURL': 'post.file.thumbURL',
+ '%URL': 'post.file.URL',
+ '%MD5': 'post.file.MD5',
+ '%board': 'post.board',
+ '%name': 'post.file.name'
+ }[parameter]) ? "' + encodeURIComponent(" + type + ") + '" : parameter);
});
text = (m = link.match(/;text:(.+)$/)) ? m[1] : link.match(/(\w+)\.\w+\//)[1];
link = link.replace(/;text:.+$/, '');
@@ -12845,7 +12832,7 @@
},
sauce: function(section) {
var ta;
- 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.
These parameters will be replaced by their corresponding values:%TURL: Thumbnail URL.%URL: Full image URL.%MD5: MD5 hash.%board: Current board.
";
+ 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.
These parameters will be replaced by their corresponding values:%TURL: Thumbnail URL.%URL: Full image URL.%MD5: MD5 hash.%name: Original file name.%board: Current board.
";
ta = $('textarea', section);
$.get('sauces', Conf['sauces'], function(item) {
return ta.value = item['sauces'];
diff --git a/builds/crx/script.js b/builds/crx/script.js
index 5a949b0c4..20e45a00a 100644
--- a/builds/crx/script.js
+++ b/builds/crx/script.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
-* 4chan X - Version 1.3.2 - 2014-01-24
+* 4chan X - Version 1.3.2 - 2014-01-28
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@@ -538,21 +538,12 @@
return __indexOf.call(el.classList, className) >= 0;
};
- $.rm = (function() {
- if ('remove' in Element.prototype) {
- return function(el) {
- return el.remove();
- };
- } else {
- return function(el) {
- var _ref;
- return (_ref = el.parentNode) != null ? _ref.removeChild(el) : void 0;
- };
- }
- })();
+ $.rm = function(el) {
+ return el.remove();
+ };
$.rmAll = function(root) {
- return root.textContent = '';
+ return root.textContent = null;
};
$.tn = function(s) {
@@ -7965,19 +7956,15 @@
},
createSauceLink: function(link) {
var m, text;
- link = link.replace(/%(T?URL|MD5|board)/ig, function(parameter) {
- switch (parameter) {
- case '%TURL':
- return "' + encodeURIComponent(post.file.thumbURL) + '";
- case '%URL':
- return "' + encodeURIComponent(post.file.URL) + '";
- case '%MD5':
- return "' + encodeURIComponent(post.file.MD5) + '";
- case '%board':
- return "' + encodeURIComponent(post.board) + '";
- default:
- return parameter;
- }
+ link = link.replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
+ var type;
+ return ((type = {
+ '%TURL': 'post.file.thumbURL',
+ '%URL': 'post.file.URL',
+ '%MD5': 'post.file.MD5',
+ '%board': 'post.board',
+ '%name': 'post.file.name'
+ }[parameter]) ? "' + encodeURIComponent(" + type + ") + '" : parameter);
});
text = (m = link.match(/;text:(.+)$/)) ? m[1] : link.match(/(\w+)\.\w+\//)[1];
link = link.replace(/;text:.+$/, '');
@@ -12841,7 +12828,7 @@
},
sauce: function(section) {
var ta;
- 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.
These parameters will be replaced by their corresponding values:%TURL: Thumbnail URL.%URL: Full image URL.%MD5: MD5 hash.%board: Current board.
";
+ 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.
These parameters will be replaced by their corresponding values:%TURL: Thumbnail URL.%URL: Full image URL.%MD5: MD5 hash.%name: Original file name.%board: Current board.
";
ta = $('textarea', section);
$.get('sauces', Conf['sauces'], function(item) {
return ta.value = item['sauces'];
diff --git a/package.json b/package.json
index df8fc5e18..276bfc368 100755
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-watch": "~0.5.3",
- "grunt-shell": "~0.6.3",
+ "grunt-shell": "~0.6.4",
"load-grunt-tasks": "~0.2.1"
},
"repository": {
diff --git a/src/General/html/Settings/Sauce.html b/src/General/html/Settings/Sauce.html
index d4e9df83c..69548c470 100755
--- a/src/General/html/Settings/Sauce.html
+++ b/src/General/html/Settings/Sauce.html
@@ -5,6 +5,7 @@
%TURL: Thumbnail URL.
%URL: Full image URL.
%MD5: MD5 hash.
+ %name: Original file name.
%board: Current board.
-
\ No newline at end of file
+
diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee
index c33f2271c..0827732fb 100755
--- a/src/General/lib/$.coffee
+++ b/src/General/lib/$.coffee
@@ -127,14 +127,12 @@ $.toggleClass = (el, className) ->
$.hasClass = (el, className) ->
className in el.classList
-$.rm = do ->
- if 'remove' of Element::
- (el) -> el.remove()
- else
- (el) -> el.parentNode?.removeChild el
+$.rm = (el) ->
+ el.remove()
-# jsperf.com/emptify-element/9
-$.rmAll = (root) -> root.textContent = ''
+$.rmAll = (root) ->
+ # https://gist.github.com/MayhemYDG/8646194
+ root.textContent = null
$.tn = (s) ->
d.createTextNode s
diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee
index e230b3c3b..1b121ea7e 100755
--- a/src/Images/Sauce.coffee
+++ b/src/Images/Sauce.coffee
@@ -15,19 +15,17 @@ Sauce =
name: 'Sauce'
cb: @node
createSauceLink: (link) ->
- link = link.replace /%(T?URL|MD5|board)/ig, (parameter) ->
- switch parameter
-
- when '%TURL'
- "' + encodeURIComponent(post.file.thumbURL) + '"
- when '%URL'
- "' + encodeURIComponent(post.file.URL) + '"
- when '%MD5'
- "' + encodeURIComponent(post.file.MD5) + '"
- when '%board'
- "' + encodeURIComponent(post.board) + '"
- else
- parameter
+ link = link.replace /%(T?URL|MD5|board|name)/g, (parameter) ->
+ return (if type = {
+ '%TURL': 'post.file.thumbURL'
+ '%URL': 'post.file.URL'
+ '%MD5': 'post.file.MD5'
+ '%board': 'post.board'
+ '%name': 'post.file.name'
+ }[parameter]
+ "' + encodeURIComponent(#{type}) + '"
+ else
+ parameter)
text = if m = link.match(/;text:(.+)$/) then m[1] else link.match(/(\w+)\.\w+\//)[1]
link = link.replace /;text:.+$/, ''
Function 'post', 'a', """