From 31d156d0e03152966dd25d39a1f91417962ff195 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 27 Apr 2013 00:32:37 +0200 Subject: [PATCH 1/5] RIP /v/ and /vg/ archives. --- src/Archive/Redirect.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 706ed380b..3697b2825 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -2,7 +2,7 @@ Redirect = image: (boardID, filename) -> # Do not use g.BOARD, the image url can originate from a cross-quote. switch boardID - when 'a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg' + when 'a', 'gd', 'jp', 'm', 'q', 'tg', 'vp', 'vr', 'wsg' "//archive.foolz.us/#{boardID}/full_image/#{filename}" when 'u' "//nsfw.foolz.us/#{boardID}/full_image/#{filename}" @@ -22,7 +22,7 @@ Redirect = # XXX foolz had HSTS set for 120 days, which broke XHR+CORS+Redirection when on HTTP. # Remove necessary HTTPS procotol in September 2013. switch boardID - when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg' + when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vp', 'vr', 'wsg' "https://archive.foolz.us/_/api/chan/post/?board=#{boardID}&num=#{postID}" when 'u' "https://nsfw.foolz.us/_/api/chan/post/?board=#{boardID}&num=#{postID}" @@ -35,7 +35,7 @@ Redirect = to: (data) -> {boardID} = data switch boardID - when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg' + when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vp', 'vr', 'wsg' Redirect.path '//archive.foolz.us', 'foolfuuka', data when 'u' Redirect.path '//nsfw.foolz.us', 'foolfuuka', data From c1c2e209355da8ef3bb213c20a055020b774c618 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 27 Apr 2013 03:35:15 +0200 Subject: [PATCH 2/5] Update deps. Actually I just want to test if the server is building correctly. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e17a0c52..46cbbe13c 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "grunt-contrib-clean": "~0.4.1", "grunt-contrib-coffee": "~0.7.0", "grunt-contrib-compress": "~0.5.0", - "grunt-contrib-concat": "~0.2.0", + "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-watch": "~0.3.1", "grunt-shell": "~0.2.2" From 010618a6efb2582b919a501589137f9a9895adb7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 27 Apr 2013 04:30:31 +0200 Subject: [PATCH 3/5] Move some html out the code. --- Gruntfile.js | 1 + html/General/Header.html | 14 ++ .../Settings-section-Filter-guide.html | 29 ++++ html/General/Settings-section-Filter.html | 16 ++ html/General/Settings-section-Keybinds.html | 6 + html/General/Settings-section-Main.html | 6 + html/General/Settings-section-Rice.html | 60 +++++++ html/General/Settings-section-Sauce.html | 10 ++ html/General/Settings.html | 15 ++ html/Monitoring/ThreadUpdater.html | 17 ++ html/Posting/QR.html | 35 +++++ src/General/Header.coffee | 13 +- src/General/Settings.coffee | 147 +----------------- src/Monitoring/ThreadUpdater.coffee | 8 +- src/Posting/QR.coffee | 38 +---- 15 files changed, 222 insertions(+), 193 deletions(-) create mode 100644 html/General/Header.html create mode 100644 html/General/Settings-section-Filter-guide.html create mode 100644 html/General/Settings-section-Filter.html create mode 100644 html/General/Settings-section-Keybinds.html create mode 100644 html/General/Settings-section-Main.html create mode 100644 html/General/Settings-section-Rice.html create mode 100644 html/General/Settings-section-Sauce.html create mode 100644 html/General/Settings.html create mode 100644 html/Monitoring/ThreadUpdater.html create mode 100644 html/Posting/QR.html diff --git a/Gruntfile.js b/Gruntfile.js index b3f1e7786..d2ce937a1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -120,6 +120,7 @@ module.exports = function(grunt) { 'package.json', 'lib/**/*', 'src/**/*', + 'html/**/*', 'css/**/*', 'img/**/*' ], diff --git a/html/General/Header.html b/html/General/Header.html new file mode 100644 index 000000000..9251d7ff3 --- /dev/null +++ b/html/General/Header.html @@ -0,0 +1,14 @@ +
+ + + + + + + + + + +
+
+
diff --git a/html/General/Settings-section-Filter-guide.html b/html/General/Settings-section-Filter-guide.html new file mode 100644 index 000000000..e3c9c2979 --- /dev/null +++ b/html/General/Settings-section-Filter-guide.html @@ -0,0 +1,29 @@ +
Filter is disabled.
+

+ Use regular expressions, one per line.
+ Lines starting with a # will be ignored.
+ For example, /weeaboo/i will filter posts containing the string `weeaboo`, case-insensitive.
+ MD5 filtering uses exact string matching, not regular expressions. +

+
    You can use these settings with each regular expression, separate them with semicolons: +
  • + Per boards, separate them with commas. It is global if not specified.
    + For example: boards:a,jp;. +
  • +
  • + Filter OPs only along with their threads (`only`), replies only (`no`), or both (`yes`, this is default).
    + For example: op:only;, op:no; or op:yes;. +
  • +
  • + Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).
    + For example: stub:yes; or stub:no;. +
  • +
  • + Highlight instead of hiding. You can specify a class name to use with a userstyle.
    + For example: highlight; or highlight:wallpaper;. +
  • +
  • + Highlighted OPs will have their threads put on top of board pages by default.
    + For example: top:yes; or top:no;. +
  • +
diff --git a/html/General/Settings-section-Filter.html b/html/General/Settings-section-Filter.html new file mode 100644 index 000000000..f17d3ea5f --- /dev/null +++ b/html/General/Settings-section-Filter.html @@ -0,0 +1,16 @@ + +
diff --git a/html/General/Settings-section-Keybinds.html b/html/General/Settings-section-Keybinds.html new file mode 100644 index 000000000..ec8d70518 --- /dev/null +++ b/html/General/Settings-section-Keybinds.html @@ -0,0 +1,6 @@ +
Keybinds are disabled.
+
Allowed keys: a-z, 0-9, Ctrl, Shift, Alt, Meta, Enter, Esc, Up, Down, Right, Left.
+
Press Backspace to disable a keybind.
+ + +
ActionsKeybinds
diff --git a/html/General/Settings-section-Main.html b/html/General/Settings-section-Main.html new file mode 100644 index 000000000..580ddae46 --- /dev/null +++ b/html/General/Settings-section-Main.html @@ -0,0 +1,6 @@ +
+ + + +
+

diff --git a/html/General/Settings-section-Rice.html b/html/General/Settings-section-Rice.html new file mode 100644 index 000000000..9d6eca249 --- /dev/null +++ b/html/General/Settings-section-Rice.html @@ -0,0 +1,60 @@ +
+ Custom Board Navigation is disabled. +
+
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
+
Board link: board
+
Title link: board-title
+
Board link (Replace with title when on that board): board-replace
+
Full text link: board-full
+
Custom text link: board-text:"VIP Board"
+
Index-only link: board-index
+
Catalog-only link: board-catalog
+
Combinations are possible: board-index-text:"VIP Index"
+
Full board list toggle: toggle-all
+
+ +
+ Time Formatting is disabled. +
:
+
Supported format specifiers:
+
Day: %a, %A, %d, %e
+
Month: %m, %b, %B
+
Year: %y
+
Hour: %k, %H, %l, %I, %p, %P
+
Minute: %M
+
Second: %S
+
+ +
+ Quote Backlinks formatting is disabled. +
:
+
+ +
+ File Info Formatting is disabled. +
:
+
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
+
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
+
Spoiler indicator: %p
+
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
+
Resolution: %r (Displays 'PDF' for PDF files)
+
+ +
+ Unread Tab Icon is disabled. + + +
+ +
+ + + + + +
diff --git a/html/General/Settings-section-Sauce.html b/html/General/Settings-section-Sauce.html new file mode 100644 index 000000000..b31017946 --- /dev/null +++ b/html/General/Settings-section-Sauce.html @@ -0,0 +1,10 @@ +
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.
  • +
+ diff --git a/html/General/Settings.html b/html/General/Settings.html new file mode 100644 index 000000000..8ee5f006b --- /dev/null +++ b/html/General/Settings.html @@ -0,0 +1,15 @@ +
+ +
+
+
+
+
diff --git a/html/Monitoring/ThreadUpdater.html b/html/Monitoring/ThreadUpdater.html new file mode 100644 index 000000000..04a6a17b2 --- /dev/null +++ b/html/Monitoring/ThreadUpdater.html @@ -0,0 +1,17 @@ +
+   +
+#{html} +
+ +
+
+ +
+
+ +
diff --git a/html/Posting/QR.html b/html/Posting/QR.html new file mode 100644 index 000000000..ef6776598 --- /dev/null +++ b/html/Posting/QR.html @@ -0,0 +1,35 @@ +
+ + + + × +
+
+
+ + + + +
+
+
+ + +
+
+ + +
+
+ + + + No selected file + + + × + +
+ +
diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 19e0af2ca..cc714549e 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -3,17 +3,8 @@ Header = headerEl = $.el 'div', id: 'header' innerHTML: """ -
- - - - - - -
-
-
- """.replace />\s+<' # get rid of spaces between elements + <%= grunt.file.read('html/General/Header.html').replace(/>\s+<').trim() %> + """ @bar = $ '#header-bar', headerEl @toggle = $ '#toggle-header-bar', @bar diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 887a3f1a5..cbd1965db 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -60,19 +60,7 @@ Settings = $.event 'CloseMenu' html = """ -
- -
-
-
+ <%= grunt.file.read('html/General/Settings.html').replace(/>\s+<').trim() %> """ Settings.dialog = overlay = $.el 'div', @@ -124,12 +112,7 @@ Settings = main: (section) -> section.innerHTML = """ -
- - - -
-

+ <%= grunt.file.read('html/General/Settings-section-Main.html').replace(/>\s+<').trim() %> """ $.on $('.export', section), 'click', Settings.export $.on $('.import', section), 'click', Settings.import @@ -315,22 +298,7 @@ Settings = filter: (section) -> section.innerHTML = """ - -
+ <%= grunt.file.read('html/General/Settings-section-Filter.html').replace(/>\s+<').trim() %> """ select = $ 'select', section $.on select, 'change', Settings.selectFilter @@ -349,49 +317,12 @@ Settings = $.add div, ta return div.innerHTML = """ -
Filter is disabled.
-

- Use regular expressions, one per line.
- Lines starting with a # will be ignored.
- For example, /weeaboo/i will filter posts containing the string `weeaboo`, case-insensitive.
- MD5 filtering uses exact string matching, not regular expressions. -

-
    You can use these settings with each regular expression, separate them with semicolons: -
  • - Per boards, separate them with commas. It is global if not specified.
    - For example: boards:a,jp;. -
  • -
  • - Filter OPs only along with their threads (`only`), replies only (`no`), or both (`yes`, this is default).
    - For example: op:only;, op:no; or op:yes;. -
  • -
  • - Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).
    - For example: stub:yes; or stub:no;. -
  • -
  • - Highlight instead of hiding. You can specify a class name to use with a userstyle.
    - For example: highlight; or highlight:wallpaper;. -
  • -
  • - Highlighted OPs will have their threads put on top of board pages by default.
    - For example: top:yes; or top:no;. -
  • -
+ <%= grunt.file.read('html/General/Settings-section-Filter-guide.html').replace(/>\s+<').trim() %> """ sauce: (section) -> 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.
  • -
- + <%= grunt.file.read('html/General/Settings-section-Sauce.html').replace(/>\s+<').trim() %> """ sauce = $ 'textarea', section $.get 'sauces', Conf['sauces'], (item) -> @@ -400,66 +331,7 @@ Settings = rice: (section) -> section.innerHTML = """ -
- Custom Board Navigation is disabled. -
-
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
-
Board link: board
-
Title link: board-title
-
Board link (Replace with title when on that board): board-replace
-
Full text link: board-full
-
Custom text link: board-text:"VIP Board"
-
Index-only link: board-index
-
Catalog-only link: board-catalog
-
Combinations are possible: board-index-text:"VIP Index"
-
Full board list toggle: toggle-all
-
- -
- Time Formatting is disabled. -
:
-
Supported format specifiers:
-
Day: %a, %A, %d, %e
-
Month: %m, %b, %B
-
Year: %y
-
Hour: %k, %H, %l, %I, %p, %P
-
Minute: %M
-
Second: %S
-
- -
- Quote Backlinks formatting is disabled. -
:
-
- -
- File Info Formatting is disabled. -
:
-
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
-
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
-
Spoiler indicator: %p
-
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
-
Resolution: %r (Displays 'PDF' for PDF files)
-
- -
- Unread Tab Icon is disabled. - - -
- -
- - - - - -
+ <%= grunt.file.read('html/General/Settings-section-Rice.html').replace(/>\s+<').trim() %> """ items = {} inputs = {} @@ -522,12 +394,7 @@ Settings = keybinds: (section) -> section.innerHTML = """ -
Keybinds are disabled.
-
Allowed keys: a-z, 0-9, Ctrl, Shift, Alt, Meta, Enter, Esc, Up, Down, Right, Left.
-
Press Backspace to disable a keybind.
- - -
ActionsKeybinds
+ <%= grunt.file.read('html/General/Settings-section-Keybinds.html').replace(/>\s+<').trim() %> """ tbody = $ 'tbody', section items = {} diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index 02f448dfb..b1c50f2ef 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -8,12 +8,8 @@ ThreadUpdater = html += "
" html = """ -
- #{html} -
-
-
- """ + <%= grunt.file.read('html/Monitoring/ThreadUpdater.html').replace(/>\s+<').trim() %> + """ @dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html @timer = $ '#update-timer', @dialog diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index db7f355a2..dadde52d0 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -717,42 +717,8 @@ QR = dialog: -> dialog = UI.dialog 'qr', 'top:0;right:0;', """ -
- - - - × -
-
-
- - - - -
-
-
- + -
-
- - -
-
- - - - No selected file - - - × - -
- -
- """.replace />\s+<' # get rid of spaces between elements + <%= grunt.file.read('html/Posting/QR.html').replace(/>\s+<').trim() %> + """ QR.nodes = nodes = el: dialog From 437856be6436fdd6e62ae01c3672609faa6b5c6c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 27 Apr 2013 04:42:40 +0200 Subject: [PATCH 4/5] Rice section fixes. --- CHANGELOG.md | 1 + src/General/Settings.coffee | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3e89c4e0..a537bce54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Fix Unread Count taking into account hidden posts. - Fix bug where a thread would freeze on load. ### 3.2.1 - *2013-04-26* diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index cbd1965db..02f7de8ad 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -339,18 +339,18 @@ Settings = input = $ "[name=#{name}]", section items[name] = Conf[name] inputs[name] = input - event = if name in ['favicon', 'usercss'] - 'change' - else - 'input' - $.on input, event, $.cb.value + $.on input, 'change', $.cb.value $.get items, (items) -> for key, val of items input = inputs[key] input.value = val - unless key in ['usercss'] - $.on input, event, Settings[key] - Settings[key].call input + continue if key is 'usercss' + event = if key in ['favicon', 'usercss'] + 'change' + else + 'input' + $.on input, event, Settings[key] + Settings[key].call input return $.on $('input[name="Custom CSS"]', section), 'change', Settings.togglecss $.on $.id('apply-css'), 'click', Settings.usercss @@ -360,7 +360,7 @@ Settings = funk = Time.createFunc @value @nextElementSibling.textContent = funk Time, new Date() backlink: -> - @nextElementSibling.textContent = Conf['backlink'].replace /%id/, '123456789' + @nextElementSibling.textContent = @value.replace /%id/, '123456789' fileInfo: -> data = isReply: true From babc2414a4b177982f31d5f7bc008fbaaf331be8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 27 Apr 2013 04:43:34 +0200 Subject: [PATCH 5/5] Release 4chan X v3.2.2. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a537bce54..dd6c9ff5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.2.2 - *2013-04-27* + - Fix Unread Count taking into account hidden posts. - Fix bug where a thread would freeze on load. diff --git a/package.json b/package.json index 46cbbe13c..a2e1404df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.2.1", + "version": "3.2.2", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X",