From 591874dc648bf70ed3d6f8a180ef9e86e81d80b0 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Fri, 26 Apr 2013 12:34:30 -0700 Subject: [PATCH] Fix Advanced Tab. --- builds/4chan-X.js | 18 +++++++++++------- builds/4chan-X.user.js | 18 +++++++++++------- builds/crx/script.js | 18 +++++++++++------- src/features/monitoring/threadupdater.coffee | 3 ++- src/settings.coffee | 10 +++++----- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/builds/4chan-X.js b/builds/4chan-X.js index fbdbf1d74..780892921 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -6354,7 +6354,10 @@ interval: function() { var val; - val = parseInt(this.value, 10); + val = +this.value; + if (val < 1) { + val = 1; + } ThreadUpdater.interval = this.value = val; return $.cb.value.call(this); }, @@ -9334,10 +9337,10 @@ advanced: function(section) { var archiver, event, input, inputs, items, name, toSelect, _i, _j, _len, _len1, _ref; - section.innerHTML = "
\n Archiver\n Select an Archiver for this board:\n \n
\n
\n Custom Board Navigation\n
\n
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n
\n For example:
\n [ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
\n [ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
\n
Board link: board
\n
Title link: board-title
\n
Board link (Replace with title when on that board): board-replace
\n
Full text link: board-full
\n
Custom text link: board-text:\"VIP Board\"
\n
Index-only link: board-index
\n
Catalog-only link: board-catalog
\n
Combinations are possible: board-index-text:\"VIP Index\"
\n
Full board list toggle: toggle-all
\n
\n\n
\n Time Formatting is disabled.\n
:
\n
Supported format specifiers:
\n
Day: %a, %A, %d, %e
\n
Month: %m, %b, %B
\n
Year: %y
\n
Hour: %k, %H, %l, %I, %p, %P
\n
Minute: %M
\n
Second: %S
\n
\n\n
\n Quote Backlinks formatting is disabled.\n
:
\n
\n\n
\n File Info Formatting is disabled.\n
:
\n
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
\n
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
\n
Spoiler indicator: %p
\n
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
\n
Resolution: %r (Displays 'PDF' for PDF files)
\n
\n\n
\n Unread Favicon is disabled.\n \n \n
\n\n
\n Emoji is disabled.\n
\n Sage Icon: \n \n
\n
\n Position: \n
\n
\n\n
\n Thread Updater is disabled.\n
\n Interval: \n
\n\n
\n \n \n \n \n \n
"; + section.innerHTML = "
\n Archiver\n Select an Archiver for this board:\n \n
\n
\n Custom Board Navigation\n
\n
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n
\n For example:
\n [ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
\n [ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
\n
Board link: board
\n
Title link: board-title
\n
Board link (Replace with title when on that board): board-replace
\n
Full text link: board-full
\n
Custom text link: board-text:\"VIP Board\"
\n
Index-only link: board-index
\n
Catalog-only link: board-catalog
\n
Combinations are possible: board-index-text:\"VIP Index\"
\n
Full board list toggle: toggle-all
\n
\n\n
\n Time Formatting is disabled.\n
:
\n
Supported format specifiers:
\n
Day: %a, %A, %d, %e
\n
Month: %m, %b, %B
\n
Year: %y
\n
Hour: %k, %H, %l, %I, %p, %P
\n
Minute: %M
\n
Second: %S
\n
\n\n
\n Quote Backlinks formatting is disabled.\n
:
\n
\n\n
\n File Info Formatting is disabled.\n
:
\n
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
\n
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
\n
Spoiler indicator: %p
\n
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
\n
Resolution: %r (Displays 'PDF' for PDF files)
\n
\n\n
\n Unread Favicon is disabled.\n \n \n
\n\n
\n Emoji is disabled.\n
\n Sage Icon: \n \n
\n
\n Position: \n
\n
\n\n
\n Thread Updater is disabled.\n
\n Interval: \n
\n
\n\n
\n \n \n \n \n \n
"; items = {}; inputs = {}; - _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss', 'Interval']; + _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { name = _ref[_i]; input = $("[name=" + name + "]", section); @@ -9370,12 +9373,13 @@ for (key in items) { val = items[key]; + if (['usercss', 'emojiPos', 'archiver'].contains(key)) { + continue; + } input = inputs[key]; input.value = val; - if (!['usercss', 'emojiPos', 'archiver', 'Interval'].contains(key)) { - $.on(input, event, Settings[key]); - Settings[key].call(input); - } + $.on(input, event, Settings[key]); + Settings[key].call(input); } }); $.on($('input[name=Interval]', section), 'input', ThreadUpdater.cb.interval); diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 29a0ffc53..65f826c99 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -6350,7 +6350,10 @@ interval: function() { var val; - val = parseInt(this.value, 10); + val = +this.value; + if (val < 1) { + val = 1; + } ThreadUpdater.interval = this.value = val; return $.cb.value.call(this); }, @@ -9357,10 +9360,10 @@ advanced: function(section) { var archiver, event, input, inputs, items, name, toSelect, _i, _j, _len, _len1, _ref; - section.innerHTML = "
\n Archiver\n Select an Archiver for this board:\n \n
\n
\n Custom Board Navigation\n
\n
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n
\n For example:
\n [ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
\n [ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
\n
Board link: board
\n
Title link: board-title
\n
Board link (Replace with title when on that board): board-replace
\n
Full text link: board-full
\n
Custom text link: board-text:\"VIP Board\"
\n
Index-only link: board-index
\n
Catalog-only link: board-catalog
\n
Combinations are possible: board-index-text:\"VIP Index\"
\n
Full board list toggle: toggle-all
\n
\n\n
\n Time Formatting is disabled.\n
:
\n
Supported format specifiers:
\n
Day: %a, %A, %d, %e
\n
Month: %m, %b, %B
\n
Year: %y
\n
Hour: %k, %H, %l, %I, %p, %P
\n
Minute: %M
\n
Second: %S
\n
\n\n
\n Quote Backlinks formatting is disabled.\n
:
\n
\n\n
\n File Info Formatting is disabled.\n
:
\n
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
\n
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
\n
Spoiler indicator: %p
\n
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
\n
Resolution: %r (Displays 'PDF' for PDF files)
\n
\n\n
\n Unread Favicon is disabled.\n \n \n
\n\n
\n Emoji is disabled.\n
\n Sage Icon: \n \n
\n
\n Position: \n
\n
\n\n
\n Thread Updater is disabled.\n
\n Interval: \n
\n\n
\n \n \n \n \n \n
"; + section.innerHTML = "
\n Archiver\n Select an Archiver for this board:\n \n
\n
\n Custom Board Navigation\n
\n
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n
\n For example:
\n [ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
\n [ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
\n
Board link: board
\n
Title link: board-title
\n
Board link (Replace with title when on that board): board-replace
\n
Full text link: board-full
\n
Custom text link: board-text:\"VIP Board\"
\n
Index-only link: board-index
\n
Catalog-only link: board-catalog
\n
Combinations are possible: board-index-text:\"VIP Index\"
\n
Full board list toggle: toggle-all
\n
\n\n
\n Time Formatting is disabled.\n
:
\n
Supported format specifiers:
\n
Day: %a, %A, %d, %e
\n
Month: %m, %b, %B
\n
Year: %y
\n
Hour: %k, %H, %l, %I, %p, %P
\n
Minute: %M
\n
Second: %S
\n
\n\n
\n Quote Backlinks formatting is disabled.\n
:
\n
\n\n
\n File Info Formatting is disabled.\n
:
\n
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
\n
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
\n
Spoiler indicator: %p
\n
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
\n
Resolution: %r (Displays 'PDF' for PDF files)
\n
\n\n
\n Unread Favicon is disabled.\n \n \n
\n\n
\n Emoji is disabled.\n
\n Sage Icon: \n \n
\n
\n Position: \n
\n
\n\n
\n Thread Updater is disabled.\n
\n Interval: \n
\n
\n\n
\n \n \n \n \n \n
"; items = {}; inputs = {}; - _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss', 'Interval']; + _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { name = _ref[_i]; input = $("[name=" + name + "]", section); @@ -9393,12 +9396,13 @@ for (key in items) { val = items[key]; + if (['usercss', 'emojiPos', 'archiver'].contains(key)) { + continue; + } input = inputs[key]; input.value = val; - if (!['usercss', 'emojiPos', 'archiver', 'Interval'].contains(key)) { - $.on(input, event, Settings[key]); - Settings[key].call(input); - } + $.on(input, event, Settings[key]); + Settings[key].call(input); } }); $.on($('input[name=Interval]', section), 'input', ThreadUpdater.cb.interval); diff --git a/builds/crx/script.js b/builds/crx/script.js index ed01fa489..1287cdcdd 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -6267,7 +6267,10 @@ interval: function() { var val; - val = parseInt(this.value, 10); + val = +this.value; + if (val < 1) { + val = 1; + } ThreadUpdater.interval = this.value = val; return $.cb.value.call(this); }, @@ -9253,10 +9256,10 @@ advanced: function(section) { var archiver, event, input, inputs, items, name, toSelect, _i, _j, _len, _len1, _ref; - section.innerHTML = "
\n Archiver\n Select an Archiver for this board:\n \n
\n
\n Custom Board Navigation\n
\n
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n
\n For example:
\n [ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
\n [ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
\n
Board link: board
\n
Title link: board-title
\n
Board link (Replace with title when on that board): board-replace
\n
Full text link: board-full
\n
Custom text link: board-text:\"VIP Board\"
\n
Index-only link: board-index
\n
Catalog-only link: board-catalog
\n
Combinations are possible: board-index-text:\"VIP Index\"
\n
Full board list toggle: toggle-all
\n
\n\n
\n Time Formatting is disabled.\n
:
\n
Supported format specifiers:
\n
Day: %a, %A, %d, %e
\n
Month: %m, %b, %B
\n
Year: %y
\n
Hour: %k, %H, %l, %I, %p, %P
\n
Minute: %M
\n
Second: %S
\n
\n\n
\n Quote Backlinks formatting is disabled.\n
:
\n
\n\n
\n File Info Formatting is disabled.\n
:
\n
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
\n
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
\n
Spoiler indicator: %p
\n
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
\n
Resolution: %r (Displays 'PDF' for PDF files)
\n
\n\n
\n Unread Favicon is disabled.\n \n \n
\n\n
\n Emoji is disabled.\n
\n Sage Icon: \n \n
\n
\n Position: \n
\n
\n\n
\n Thread Updater is disabled.\n
\n Interval: \n
\n\n
\n \n \n \n \n \n
"; + section.innerHTML = "
\n Archiver\n Select an Archiver for this board:\n \n
\n
\n Custom Board Navigation\n
\n
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n
\n For example:
\n [ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
\n [ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
\n
Board link: board
\n
Title link: board-title
\n
Board link (Replace with title when on that board): board-replace
\n
Full text link: board-full
\n
Custom text link: board-text:\"VIP Board\"
\n
Index-only link: board-index
\n
Catalog-only link: board-catalog
\n
Combinations are possible: board-index-text:\"VIP Index\"
\n
Full board list toggle: toggle-all
\n
\n\n
\n Time Formatting is disabled.\n
:
\n
Supported format specifiers:
\n
Day: %a, %A, %d, %e
\n
Month: %m, %b, %B
\n
Year: %y
\n
Hour: %k, %H, %l, %I, %p, %P
\n
Minute: %M
\n
Second: %S
\n
\n\n
\n Quote Backlinks formatting is disabled.\n
:
\n
\n\n
\n File Info Formatting is disabled.\n
:
\n
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
\n
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
\n
Spoiler indicator: %p
\n
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
\n
Resolution: %r (Displays 'PDF' for PDF files)
\n
\n\n
\n Unread Favicon is disabled.\n \n \n
\n\n
\n Emoji is disabled.\n
\n Sage Icon: \n \n
\n
\n Position: \n
\n
\n\n
\n Thread Updater is disabled.\n
\n Interval: \n
\n
\n\n
\n \n \n \n \n \n
"; items = {}; inputs = {}; - _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss', 'Interval']; + _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { name = _ref[_i]; input = $("[name=" + name + "]", section); @@ -9289,12 +9292,13 @@ for (key in items) { val = items[key]; + if (['usercss', 'emojiPos', 'archiver'].contains(key)) { + continue; + } input = inputs[key]; input.value = val; - if (!['usercss', 'emojiPos', 'archiver', 'Interval'].contains(key)) { - $.on(input, event, Settings[key]); - Settings[key].call(input); - } + $.on(input, event, Settings[key]); + Settings[key].call(input); } }); $.on($('input[name=Interval]', section), 'input', ThreadUpdater.cb.interval); diff --git a/src/features/monitoring/threadupdater.coffee b/src/features/monitoring/threadupdater.coffee index 213900af8..215e4411b 100644 --- a/src/features/monitoring/threadupdater.coffee +++ b/src/features/monitoring/threadupdater.coffee @@ -107,7 +107,8 @@ ThreadUpdater = else clearTimeout ThreadUpdater.timeoutID interval: -> - val = parseInt @value, 10 + val = +@value + if val < 1 then val = 1 ThreadUpdater.interval = @value = val $.cb.value.call @ load: -> diff --git a/src/settings.coffee b/src/settings.coffee index 71a4142a7..6ffbe4c01 100644 --- a/src/settings.coffee +++ b/src/settings.coffee @@ -461,7 +461,7 @@ Settings =
Thread Updater is disabled.
- Interval:
@@ -475,7 +475,7 @@ Settings = """ items = {} inputs = {} - for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss', 'Interval'] + for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss'] input = $ "[name=#{name}]", section items[name] = Conf[name] inputs[name] = input @@ -501,11 +501,11 @@ Settings = $.get items, (items) -> for key, val of items + continue if ['usercss', 'emojiPos', 'archiver'].contains key input = inputs[key] input.value = val - unless ['usercss', 'emojiPos', 'archiver', 'Interval'].contains key - $.on input, event, Settings[key] - Settings[key].call input + $.on input, event, Settings[key] + Settings[key].call input return $.on $('input[name=Interval]', section), 'input', ThreadUpdater.cb.interval