From e028d30361818571d41db8ea89fef42542827d1e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 14 May 2011 17:47:30 +0200 Subject: [PATCH 1/6] Start cleaning up options' html before reorganization. --- 4chan_x.js | 9 ++------- script.coffee | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index c67b91530..e20135b3b 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -932,16 +932,11 @@ for (name in conf) { title = conf[name][1]; checked = $.config(name) ? "checked" : ""; - html += "
"; + html += "
"; } - html += "
Flavors
"; - html += "
"; hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {}); hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; - html += "
"; - html += "
"; - html += "
support throd
"; - html += '
Donate
'; + html += "
Flavors

support throd
Donate
"; dialog = ui.dialog('options', { top: '25%', left: '50%' diff --git a/script.coffee b/script.coffee index 5ab2639af..4094415b5 100644 --- a/script.coffee +++ b/script.coffee @@ -706,26 +706,31 @@ options = options.dialog() dialog: -> - html = "
Options X
" + html = "
Options X
" + conf = config.main.checkbox for name of conf title = conf[name][1] checked = if $.config name then "checked" else "" - html += "
" - html += "
Flavors
" - html += "
" + html += "
" hiddenThreads = $.getValue "hiddenThreads/#{g.BOARD}/", {} hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length - html += "
" - html += "
" - html += "
support throd
" - html += '
Donate
' + html += " +
Flavors
+
+
+
+
support throd
+
Donate
+ " dialog = ui.dialog 'options', top: '25%', left: '50%', html for input in $$ 'input[type=checkbox]', dialog $.bind input, 'click', $.cb.checked + + $.bind $('input[type=button]', dialog), 'click', options.cb.clearHidden $.bind $('a[name=flavors]', dialog), 'click', options.flavors $.bind $('textarea', dialog), 'change', $.cb.value From 1d52c887d8ac4e5725ae1263fc34900845d9462b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 14 May 2011 17:51:01 +0200 Subject: [PATCH 2/6] Too much. --- script.coffee | 3 --- 1 file changed, 3 deletions(-) diff --git a/script.coffee b/script.coffee index 4094415b5..aadede726 100644 --- a/script.coffee +++ b/script.coffee @@ -707,7 +707,6 @@ options = dialog: -> html = "
Options X
" - conf = config.main.checkbox for name of conf title = conf[name][1] @@ -729,8 +728,6 @@ options = dialog = ui.dialog 'options', top: '25%', left: '50%', html for input in $$ 'input[type=checkbox]', dialog $.bind input, 'click', $.cb.checked - - $.bind $('input[type=button]', dialog), 'click', options.cb.clearHidden $.bind $('a[name=flavors]', dialog), 'click', options.flavors $.bind $('textarea', dialog), 'change', $.cb.value From db53848b19d080e6531ee9e4f707b5f2b53b912a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 15 May 2011 16:07:46 +0200 Subject: [PATCH 3/6] Reorganized, restyled options menu. --- 4chan_x.js | 107 ++++++++++++++++++++++++++++++++---------------- script.coffee | 110 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 147 insertions(+), 70 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 194024d5e..4ebf73e66 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -67,35 +67,45 @@ } config = { main: { - checkbox: { - '404 Redirect': [true, 'Redirect dead threads'], - 'Anonymize': [false, 'Make everybody anonymous'], + monitor: { + 'Thread Updater': [true, 'Update threads'], + 'Unread Count': [true, 'Show unread post count in tab title'], + 'Thread Watcher': [true, 'Bookmark threads'], 'Auto Watch': [true, 'Automatically watch threads that you start'], - 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'], - 'Comment Expansion': [true, 'Expand too long comments'], - 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], + 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] + }, + img: { 'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Expansion': [true, 'Expand images'], 'Image Hover': [false, 'Show full image on mouseover'], 'Image Preloading': [false, 'Preload Images'], - 'Keybinds': [false, 'Binds actions to keys'], - 'Localize Time': [true, 'Show times based on your timezone'], - 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'], - 'Post in Title': [true, 'Show the op\'s post in the tab title'], + 'Sauce': [true, 'Add sauce to images'] + }, + post: { + 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], 'Quick Reply': [true, 'Reply without leaving the page'], + 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] + }, + quote: { 'Quote Backlinks': [false, 'Add quote backlinks'], 'Quote Inline': [false, 'Show quoted post inline on quote click'], - 'Quote Preview': [false, 'Show quote content on hover'], + 'Quote Preview': [false, 'Show quote content on hover'] + }, + filter: { 'Reply Hiding': [true, 'Hide single replies'], - 'Report Button': [true, 'Add report buttons'], - 'Sauce': [true, 'Add sauce to images'], - 'Show Stubs': [true, 'Of hidden threads / replies'], - 'Thread Expansion': [true, 'View all replies'], 'Thread Hiding': [true, 'Hide entire threads'], - 'Thread Navigation': [true, 'Navigate to previous / next thread'], - 'Thread Updater': [true, 'Update threads'], - 'Thread Watcher': [true, 'Bookmark threads'], - 'Unread Count': [true, 'Show unread post count in tab title'] + 'Show Stubs': [true, 'Of hidden threads / replies'] + }, + misc: { + '404 Redirect': [true, 'Redirect dead threads'], + 'Anonymize': [false, 'Make everybody anonymous'], + 'Comment Expansion': [true, 'Expand too long comments'], + 'Keybinds': [false, 'Binds actions to keys'], + 'Localize Time': [true, 'Show times based on your timezone'], + 'Post in Title': [true, 'Show the op\'s post in the tab title'], + 'Report Button': [true, 'Add report buttons'], + 'Thread Expansion': [true, 'View all replies'], + 'Thread Navigation': [true, 'Navigate to previous / next thread'] }, textarea: { flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url='].join('\n') @@ -175,18 +185,18 @@ e.preventDefault(); el = ui.el; left = e.clientX - ui.dx; - if (left < 20) { + if (left < 10) { left = '0px'; - } else if (ui.width - left < 20) { + } else if (ui.width - left < 10) { left = ''; } right = left ? '' : '0px'; el.style.left = left; el.style.right = right; top = e.clientY - ui.dy; - if (top < 20) { + if (top < 10) { top = '0px'; - } else if (ui.height - top < 20) { + } else if (ui.height - top < 10) { top = ''; } bottom = top ? '' : '0px'; @@ -905,21 +915,20 @@ } }, dialog: function() { - var checked, conf, dialog, hiddenNum, hiddenThreads, html, input, name, title, _i, _len, _ref; - html = "
Options X
"; - conf = config.main.checkbox; - for (name in conf) { - title = conf[name][1]; - checked = $.config(name) ? "checked" : ""; - html += "
"; - } + var dialog, hiddenNum, hiddenThreads, html, input, _i, _len, _ref; hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {}); hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; - html += "
Flavors

support throd
Donate
"; + html = "
Options X

  • Monitoring
  • Imaging
  • Posting
  • Quoting
  • Filtering
  • Enhancing


Flavors
support throd
Donate
"; dialog = ui.dialog('options', { top: '25%', - left: '50%' + left: '25%' }, html); + options.append(config.main.monitor, $('#monitor', dialog)); + options.append(config.main.img, $('#img', dialog)); + options.append(config.main.post, $('#post', dialog)); + options.append(config.main.quote, $('#quote', dialog)); + options.append(config.main.filter, $('#filter', dialog)); + options.append(config.main.misc, $('#misc', dialog)); _ref = $$('input[type=checkbox]', dialog); for (_i = 0, _len = _ref.length; _i < _len; _i++) { input = _ref[_i]; @@ -930,6 +939,19 @@ $.bind($('textarea', dialog), 'change', $.cb.value); return $.append(d.body, dialog); }, + append: function(conf, id) { + var checked, li, name, title, _results; + _results = []; + for (name in conf) { + title = conf[name][1]; + checked = $.config(name) ? "checked" : ""; + li = $.el('li', { + innerHTML: "" + }); + _results.push($.append(id, li)); + } + return _results; + }, flavors: function() { var ta; ta = $('#options textarea'); @@ -2469,11 +2491,28 @@ #options {\ position: fixed;\ padding: 5px;\ + }\ + #options .move, #options > div:last-child {\ text-align: right;\ }\ + .column {\ + float: left;\ + margin: 0 10px;\ + }\ + #options ul {\ + list-style: none;\ + margin: 0;\ + padding: 0;\ + }\ + #options li:first-child {\ + text-decoration: underline;\ + }\ + #options > div:nth-last-of-type(2) {\ + float: left;\ + }\ #options textarea {\ height: 100px;\ - width: 500px;\ + width: 450px;\ }\ \ #qr {\ diff --git a/script.coffee b/script.coffee index 1bf9f85e2..a75fba94a 100644 --- a/script.coffee +++ b/script.coffee @@ -11,35 +11,40 @@ if console? config = main: - checkbox: - '404 Redirect': [true, 'Redirect dead threads'] - 'Anonymize': [false, 'Make everybody anonymous'] + monitor: + 'Thread Updater': [true, 'Update threads'] + 'Unread Count': [true, 'Show unread post count in tab title'] + 'Thread Watcher': [true, 'Bookmark threads'] 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] - 'Comment Expansion': [true, 'Expand too long comments'] - 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] + img: 'Image Auto-Gif': [false, 'Animate gif thumbnails'] 'Image Expansion': [true, 'Expand images'] 'Image Hover': [false, 'Show full image on mouseover'] 'Image Preloading': [false, 'Preload Images'] - 'Keybinds': [false, 'Binds actions to keys'] - 'Localize Time': [true, 'Show times based on your timezone'] - 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] - 'Post in Title': [true, 'Show the op\'s post in the tab title'] + 'Sauce': [true, 'Add sauce to images'] + post: + 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] 'Quick Reply': [true, 'Reply without leaving the page'] + 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] + quote: 'Quote Backlinks': [false, 'Add quote backlinks'] 'Quote Inline': [false, 'Show quoted post inline on quote click'] 'Quote Preview': [false, 'Show quote content on hover'] + filter: 'Reply Hiding': [true, 'Hide single replies'] - 'Report Button': [true, 'Add report buttons'] - 'Sauce': [true, 'Add sauce to images'] - 'Show Stubs': [true, 'Of hidden threads / replies'] - 'Thread Expansion': [true, 'View all replies'] 'Thread Hiding': [true, 'Hide entire threads'] + 'Show Stubs': [true, 'Of hidden threads / replies'] + misc: + '404 Redirect': [true, 'Redirect dead threads'] + 'Anonymize': [false, 'Make everybody anonymous'] + 'Comment Expansion': [true, 'Expand too long comments'] + 'Keybinds': [false, 'Binds actions to keys'] + 'Localize Time': [true, 'Show times based on your timezone'] + 'Post in Title': [true, 'Show the op\'s post in the tab title'] + 'Report Button': [true, 'Add report buttons'] + 'Thread Expansion': [true, 'View all replies'] 'Thread Navigation': [true, 'Navigate to previous / next thread'] - 'Thread Updater': [true, 'Update threads'] - 'Thread Watcher': [true, 'Bookmark threads'] - 'Unread Count': [true, 'Show unread post count in tab title'] textarea: flavors: [ 'http://regex.info/exif.cgi?url=' @@ -103,14 +108,14 @@ ui = e.preventDefault() {el} = ui left = e.clientX - ui.dx - if left < 20 then left = '0px' - else if ui.width - left < 20 then left = '' + if left < 10 then left = '0px' + else if ui.width - left < 10 then left = '' right = if left then '' else '0px' el.style.left = left el.style.right = right top = e.clientY - ui.dy - if top < 20 then top = '0px' - else if ui.height - top < 20 then top = '' + if top < 10 then top = '0px' + else if ui.height - top < 10 then top = '' bottom = if top then '' else '0px' el.style.top = top el.style.bottom = bottom @@ -688,26 +693,34 @@ options = options.dialog() dialog: -> - html = "
Options X
" - conf = config.main.checkbox - for name of conf - title = conf[name][1] - checked = if $.config name then "checked" else "" - html += "
" - hiddenThreads = $.getValue "hiddenThreads/#{g.BOARD}/", {} hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length - - html += " -
Flavors
-
-
+ html = " +
Options X

-
support throd
-
Donate
+
  • Monitoring
  • Imaging
+
  • Posting
  • Quoting
  • Filtering
+
  • Enhancing
+
+
+
+
Flavors
+
+
+
+
+
support throd
+
Donate
+
" - dialog = ui.dialog 'options', top: '25%', left: '50%', html + dialog = ui.dialog 'options', top: '25%', left: '25%', html + options.append config.main.monitor, $('#monitor', dialog) + options.append config.main.img, $('#img', dialog) + options.append config.main.post, $('#post', dialog) + options.append config.main.quote, $('#quote', dialog) + options.append config.main.filter, $('#filter', dialog) + options.append config.main.misc, $('#misc', dialog) for input in $$ 'input[type=checkbox]', dialog $.bind input, 'click', $.cb.checked $.bind $('input[type=button]', dialog), 'click', options.cb.clearHidden @@ -715,6 +728,14 @@ options = $.bind $('textarea', dialog), 'change', $.cb.value $.append d.body, dialog + append: (conf, id) -> + for name of conf + title = conf[name][1] + checked = if $.config name then "checked" else "" + li = $.el 'li', + innerHTML: "" + $.append id, li + flavors: -> ta = $ '#options textarea' if ta.style.display then $.show ta else $.hide ta @@ -1938,11 +1959,28 @@ main = #options { position: fixed; padding: 5px; + } + #options .move, #options > div:last-child { text-align: right; } + .column { + float: left; + margin: 0 10px; + } + #options ul { + list-style: none; + margin: 0; + padding: 0; + } + #options li:first-child { + text-decoration: underline; + } + #options > div:nth-last-of-type(2) { + float: left; + } #options textarea { height: 100px; - width: 500px; + width: 450px; } #qr { From e227e64264f40381b995fb2078e6cbcddc4d445e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 15 May 2011 20:49:34 +0200 Subject: [PATCH 4/6] Move post in title in monitoring, add GitHub and uso links, rename flavors into sauce flavors, move the flavors on the bottom so that it can take as much space as possible. --- 4chan_x.js | 10 +++++----- script.coffee | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 4ebf73e66..484094495 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -70,6 +70,7 @@ monitor: { 'Thread Updater': [true, 'Update threads'], 'Unread Count': [true, 'Show unread post count in tab title'], + 'Post in Title': [true, 'Show the op\'s post in the tab title'], 'Thread Watcher': [true, 'Bookmark threads'], 'Auto Watch': [true, 'Automatically watch threads that you start'], 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] @@ -102,7 +103,6 @@ 'Comment Expansion': [true, 'Expand too long comments'], 'Keybinds': [false, 'Binds actions to keys'], 'Localize Time': [true, 'Show times based on your timezone'], - 'Post in Title': [true, 'Show the op\'s post in the tab title'], 'Report Button': [true, 'Add report buttons'], 'Thread Expansion': [true, 'View all replies'], 'Thread Navigation': [true, 'Navigate to previous / next thread'] @@ -918,7 +918,7 @@ var dialog, hiddenNum, hiddenThreads, html, input, _i, _len, _ref; hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {}); hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; - html = "
Options X

  • Monitoring
  • Imaging
  • Posting
  • Quoting
  • Filtering
  • Enhancing


Donate
"; + html = "
Options X

  • Monitoring
  • Imaging
  • Posting
  • Quoting
  • Filtering
  • Enhancing


Donate
Support: GitHub | support throd | uso
"; dialog = ui.dialog('options', { top: '25%', left: '25%' @@ -2492,7 +2492,7 @@ position: fixed;\ padding: 5px;\ }\ - #options .move, #options > div:last-child {\ + #options .move, #options > div:nth-last-of-type(2) {\ text-align: right;\ }\ .column {\ @@ -2507,12 +2507,12 @@ #options li:first-child {\ text-decoration: underline;\ }\ - #options > div:nth-last-of-type(2) {\ + #options > div:nth-last-of-type(3) {\ float: left;\ }\ #options textarea {\ height: 100px;\ - width: 450px;\ + width: 100%;\ }\ \ #qr {\ diff --git a/script.coffee b/script.coffee index a75fba94a..f59a8cc7e 100644 --- a/script.coffee +++ b/script.coffee @@ -14,6 +14,7 @@ config = monitor: 'Thread Updater': [true, 'Update threads'] 'Unread Count': [true, 'Show unread post count in tab title'] + 'Post in Title': [true, 'Show the op\'s post in the tab title'] 'Thread Watcher': [true, 'Bookmark threads'] 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] @@ -41,7 +42,6 @@ config = 'Comment Expansion': [true, 'Expand too long comments'] 'Keybinds': [false, 'Binds actions to keys'] 'Localize Time': [true, 'Show times based on your timezone'] - 'Post in Title': [true, 'Show the op\'s post in the tab title'] 'Report Button': [true, 'Add report buttons'] 'Thread Expansion': [true, 'View all replies'] 'Thread Navigation': [true, 'Navigate to previous / next thread'] @@ -704,14 +704,14 @@ options =

- -
+
-
Donate
+
Support: GitHub | support throd | uso
+
" dialog = ui.dialog 'options', top: '25%', left: '25%', html @@ -1960,7 +1960,7 @@ main = position: fixed; padding: 5px; } - #options .move, #options > div:last-child { + #options .move, #options > div:nth-last-of-type(2) { text-align: right; } .column { @@ -1975,12 +1975,12 @@ main = #options li:first-child { text-decoration: underline; } - #options > div:nth-last-of-type(2) { + #options > div:nth-last-of-type(3) { float: left; } #options textarea { height: 100px; - width: 450px; + width: 100%; } #qr { From 7bde57d2f3cbe66e69186949721f8333d0716a4e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 15 May 2011 20:59:17 +0200 Subject: [PATCH 5/6] Forgot that, expanders should be together. --- 4chan_x.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 484094495..0447e7b78 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -100,10 +100,10 @@ misc: { '404 Redirect': [true, 'Redirect dead threads'], 'Anonymize': [false, 'Make everybody anonymous'], - 'Comment Expansion': [true, 'Expand too long comments'], 'Keybinds': [false, 'Binds actions to keys'], 'Localize Time': [true, 'Show times based on your timezone'], 'Report Button': [true, 'Add report buttons'], + 'Comment Expansion': [true, 'Expand too long comments'], 'Thread Expansion': [true, 'View all replies'], 'Thread Navigation': [true, 'Navigate to previous / next thread'] }, diff --git a/script.coffee b/script.coffee index f59a8cc7e..b00f7f6fa 100644 --- a/script.coffee +++ b/script.coffee @@ -39,10 +39,10 @@ config = misc: '404 Redirect': [true, 'Redirect dead threads'] 'Anonymize': [false, 'Make everybody anonymous'] - 'Comment Expansion': [true, 'Expand too long comments'] 'Keybinds': [false, 'Binds actions to keys'] 'Localize Time': [true, 'Show times based on your timezone'] 'Report Button': [true, 'Add report buttons'] + 'Comment Expansion': [true, 'Expand too long comments'] 'Thread Expansion': [true, 'View all replies'] 'Thread Navigation': [true, 'Navigate to previous / next thread'] textarea: From c15608deb5d0adc1b2b2d588835d888fb2509845 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 15 May 2011 21:38:58 +0200 Subject: [PATCH 6/6] Peasant IDs instead of Master Race selectors. --- 4chan_x.js | 6 +++--- script.coffee | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 0447e7b78..1fe5faf70 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -918,7 +918,7 @@ var dialog, hiddenNum, hiddenThreads, html, input, _i, _len, _ref; hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {}); hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; - html = "
Options X

  • Monitoring
  • Imaging
  • Posting
  • Quoting
  • Filtering
  • Enhancing


Donate
Support: GitHub | support throd | uso
"; + html = "
Options X

  • Monitoring
  • Imaging
  • Posting
  • Quoting
  • Filtering
  • Enhancing


Donate
Support: GitHub | support throd | uso
"; dialog = ui.dialog('options', { top: '25%', left: '25%' @@ -2492,7 +2492,7 @@ position: fixed;\ padding: 5px;\ }\ - #options .move, #options > div:nth-last-of-type(2) {\ + #options .move, #credits {\ text-align: right;\ }\ .column {\ @@ -2507,7 +2507,7 @@ #options li:first-child {\ text-decoration: underline;\ }\ - #options > div:nth-last-of-type(3) {\ + #floaty {\ float: left;\ }\ #options textarea {\ diff --git a/script.coffee b/script.coffee index b00f7f6fa..332870e8e 100644 --- a/script.coffee +++ b/script.coffee @@ -703,11 +703,11 @@ options =
  • Enhancing


-
+ -
+
Donate
Support: GitHub | support throd | uso
@@ -1960,7 +1960,7 @@ main = position: fixed; padding: 5px; } - #options .move, #options > div:nth-last-of-type(2) { + #options .move, #credits { text-align: right; } .column { @@ -1975,7 +1975,7 @@ main = #options li:first-child { text-decoration: underline; } - #options > div:nth-last-of-type(3) { + #floaty { float: left; } #options textarea {