From d5f5349c63520a906c0938d68ac48bbc3feb7929 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:10:24 +0100 Subject: [PATCH 01/10] Added %FNAME case to the HTML page --- html/General/Settings-section-Sauce.html | 1 + 1 file changed, 1 insertion(+) diff --git a/html/General/Settings-section-Sauce.html b/html/General/Settings-section-Sauce.html index b31017946..370b07142 100644 --- a/html/General/Settings-section-Sauce.html +++ b/html/General/Settings-section-Sauce.html @@ -5,6 +5,7 @@
  • %TURL: Thumbnail URL.
  • %URL: Full image URL.
  • %MD5: MD5 hash.
  • +
  • %FNAME: Original file name.
  • %board: Current board.
  • From 7a2faf861efe0984f5417fb555e9b462435b3228 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:10:40 +0100 Subject: [PATCH 02/10] Added %FNAME case to link.replace switch --- src/Images/Sauce.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index b7ce89779..56a5abebc 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -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|FNAME)/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 '%FNAME' + "' + encodeURIComponent(post.file.name) + '" else parameter text = if m = link.match(/;text:(.+)$/) then m[1] else link.match(/(\w+)\.\w+\//)[1] From 5752e082ab809068646d3e1bff437784b8d38487 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:10:57 +0100 Subject: [PATCH 03/10] added %FNAME case to data.Conf.sauces I don't know what this actually does. Sounds stupid, but i only added a case because it's the only other place in the code that calls %URL and %TURL outside of HTML pages. Please review carefully. --- src/General/Settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 0d85a8d44..70d22171a 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -239,6 +239,8 @@ Settings = '%MD5' when '$4' '%board' + when '$5' + '%FNAME' else c for key, val of Config.hotkeys when key of data.Conf From 3d19f2ff11f7134be06372b8b124360179c8ab25 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:30:24 +0100 Subject: [PATCH 04/10] %NAME is indeed better --- html/General/Settings-section-Sauce.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/General/Settings-section-Sauce.html b/html/General/Settings-section-Sauce.html index 370b07142..d1b1555c6 100644 --- a/html/General/Settings-section-Sauce.html +++ b/html/General/Settings-section-Sauce.html @@ -5,7 +5,7 @@
  • %TURL: Thumbnail URL.
  • %URL: Full image URL.
  • %MD5: MD5 hash.
  • -
  • %FNAME: Original file name.
  • +
  • %NAME: Original file name.
  • %board: Current board.
  • From 1118b380265d2877d526362b366178b7d952b5b3 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:30:55 +0100 Subject: [PATCH 05/10] Not Necessary --- src/General/Settings.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 70d22171a..0d85a8d44 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -239,8 +239,6 @@ Settings = '%MD5' when '$4' '%board' - when '$5' - '%FNAME' else c for key, val of Config.hotkeys when key of data.Conf From dbd4de88b1e64e3bb277fb48cc9f09fe58b33a05 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:31:27 +0100 Subject: [PATCH 06/10] %NAME is indeed better --- src/Images/Sauce.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index 56a5abebc..a6c5da7ec 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -15,7 +15,7 @@ Sauce = name: 'Sauce' cb: @node createSauceLink: (link) -> - link = link.replace /%(T?URL|MD5|board|FNAME)/g, (parameter) -> + link = link.replace /%(T?URL|MD5|board|NAME)/g, (parameter) -> switch parameter when '%TURL' "' + encodeURIComponent(post.file.thumbURL) + '" @@ -25,7 +25,7 @@ Sauce = "' + encodeURIComponent(post.file.MD5) + '" when '%board' "' + encodeURIComponent(post.board) + '" - when '%FNAME' + when '%NAME' "' + encodeURIComponent(post.file.name) + '" else parameter From 7000c3c110cc69b718eec7e8ae6d762892a07b3b Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:34:45 +0100 Subject: [PATCH 07/10] changed to lowercase --- html/General/Settings-section-Sauce.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/General/Settings-section-Sauce.html b/html/General/Settings-section-Sauce.html index d1b1555c6..c630955c4 100644 --- a/html/General/Settings-section-Sauce.html +++ b/html/General/Settings-section-Sauce.html @@ -5,7 +5,7 @@
  • %TURL: Thumbnail URL.
  • %URL: Full image URL.
  • %MD5: MD5 hash.
  • -
  • %NAME: Original file name.
  • +
  • %name: Original file name.
  • %board: Current board.
  • From 0aaa9af8cc5278e0b3fcf2e314d60818f96431eb Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:35:12 +0100 Subject: [PATCH 08/10] changed to lowercase --- src/Images/Sauce.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index a6c5da7ec..8e7f06e06 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -15,7 +15,7 @@ Sauce = name: 'Sauce' cb: @node createSauceLink: (link) -> - link = link.replace /%(T?URL|MD5|board|NAME)/g, (parameter) -> + link = link.replace /%(T?URL|MD5|board|name)/g, (parameter) -> switch parameter when '%TURL' "' + encodeURIComponent(post.file.thumbURL) + '" @@ -25,7 +25,7 @@ Sauce = "' + encodeURIComponent(post.file.MD5) + '" when '%board' "' + encodeURIComponent(post.board) + '" - when '%NAME' + when '%name' "' + encodeURIComponent(post.file.name) + '" else parameter From 985be3113d0bd2f4dc9e9aa83ae88b8d9747d2b9 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 22:40:51 +0100 Subject: [PATCH 09/10] Added Original filename to Sauce --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f727a71bb..a2c95cd74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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* From 06e5ce4ef6a14ec8823c166f59a474ee7b8629de Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 21:25:18 +0100 Subject: [PATCH 10/10] It is now safe to use Node::remove. --- lib/$.coffee | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index c50412cbf..3b39b3b30 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -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