From 010618a6efb2582b919a501589137f9a9895adb7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 27 Apr 2013 04:30:31 +0200 Subject: [PATCH] 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. +

+ 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.
+ + 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. -

- + <%= 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.
- - + <%= 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