diff --git a/builds/4chan-X.js b/builds/4chan-X.js index ae7193e91..6a13ab044 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -9762,9 +9762,9 @@ return $.on(ta, 'change', $.cb.value); }, advanced: function(section) { - var archive, boardID, boards, data, event, input, inputs, items, name, row, rows, ta, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; + var archive, boardID, boardOptions, boardSelect, boards, data, event, input, inputs, items, name, row, rows, ta, table, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; - section.innerHTML = "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Disabled selections indicate that only one archive is available for that board and redirection type.
Custom Board Navigation
New lines will be converted into spaces.

In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
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
External link: external-text:\"Google\",\"http://www.google.com\"
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, %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)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; + section.innerHTML = "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Disabled selections indicate that only one archive is available for that board and redirection type.
Custom Board Navigation
New lines will be converted into spaces.

In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
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
External link: external-text:\"Google\",\"http://www.google.com\"
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, %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)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; items = {}; inputs = {}; _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; @@ -9808,35 +9808,47 @@ _ref2 = archive.boards; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { boardID = _ref2[_j]; - if (boardID === g.BOARD.ID) { - data = boards[boardID] || (boards[boardID] = { - thread: [], - post: [], - file: [] - }); - data.thread.push(name); - if (archive.software === 'foolfuuka') { - data.post.push(name); - } - if (archive.files.contains(boardID)) { - data.file.push(name); - } + data = boards[boardID] || (boards[boardID] = { + thread: [], + post: [], + file: [] + }); + data.thread.push(name); + if (archive.software === 'foolfuuka') { + data.post.push(name); + } + if (archive.files.contains(boardID)) { + data.file.push(name); } } } rows = []; + boardOptions = []; _ref3 = Object.keys(boards).sort(); for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { boardID = _ref3[_k]; - row = $.el('tr'); + row = $.el('tr', { + className: "board-" + boardID + }); + row.hidden = boardID !== g.BOARD.ID; rows.push(row); + boardOptions.push($.el('option', { + textContent: "/" + boardID + "/", + value: "board-" + boardID, + selected: boardID === g.BOARD.ID + })); data = boards[boardID]; - Settings.addArchiveCell(row, boardID, data, 'thread'); - Settings.addArchiveCell(row, boardID, data, 'post'); - Settings.addArchiveCell(row, boardID, data, 'file'); + $.add(row, [Settings.addArchiveCell(boardID, data, 'thread'), Settings.addArchiveCell(boardID, data, 'post'), Settings.addArchiveCell(boardID, data, 'file')]); } $.add($('tbody', section), rows); - return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { + boardSelect = $('#archive-board-select', section); + $.add(boardSelect, boardOptions); + table = $.id('archive-table'); + $.on(boardSelect, 'change', function() { + $('tbody > :not([hidden])', table).hidden = true; + return $("tbody > ." + this.value, table).hidden = false; + }); + $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { var option, selectedArchives, type; selectedArchives = _arg.selectedArchives; @@ -9851,6 +9863,47 @@ } }); }, + addArchiveCell: function(boardID, data, type) { + var archive, i, length, options, select, td; + + length = data[type].length; + td = $.el('td', { + className: 'archive-cell' + }); + if (!length) { + td.textContent = '--'; + return td; + } + options = []; + i = 0; + while (i < length) { + archive = data[type][i++]; + options.push($.el('option', { + textContent: archive, + value: archive + })); + } + td.innerHTML = ''; + select = td.firstElementChild; + if (!(select.disabled = length === 1)) { + select.setAttribute('data-boardid', boardID); + select.setAttribute('data-type', type); + $.on(select, 'change', Settings.saveSelectedArchive); + } + $.add(select, options); + return td; + }, + saveSelectedArchive: function() { + var _this = this; + + return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { + var selectedArchives, _name; + + selectedArchives = _arg.selectedArchives; + (selectedArchives[_name = _this.dataset.boardid] || (selectedArchives[_name] = {}))[_this.dataset.type] = _this.value; + return $.set('selectedArchives', selectedArchives); + }); + }, boardnav: function() { return Header.generateBoardList(this.value); }, @@ -9902,47 +9955,6 @@ usercss: function() { return CustomCSS.update(); }, - addArchiveCell: function(row, boardID, data, type) { - var archive, length, options, select, td, _i, _len, _ref; - - options = []; - _ref = data[type]; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - archive = _ref[_i]; - options.push($.el('option', { - textContent: archive, - value: archive - })); - } - td = $.el('td', { - className: 'archive-cell' - }); - length = options.length; - if (length) { - td.innerHTML = ''; - select = td.firstElementChild; - if (!(select.disabled = length === 1)) { - select.setAttribute('data-boardid', boardID); - select.setAttribute('data-type', type); - $.on(select, 'change', Settings.saveSelectedArchive); - } - $.add(select, options); - } else { - td.textContent = '--'; - } - return $.add(row, td); - }, - saveSelectedArchive: function() { - var _this = this; - - return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { - var selectedArchives, _name; - - selectedArchives = _arg.selectedArchives; - (selectedArchives[_name = _this.dataset.boardid] || (selectedArchives[_name] = {}))[_this.dataset.type] = _this.value; - return $.set('selectedArchives', selectedArchives); - }); - }, keybinds: function(section) { var arr, input, inputs, items, key, tbody, tr, _ref; diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 13fac89bf..f01d20da3 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -9773,9 +9773,9 @@ return $.on(ta, 'change', $.cb.value); }, advanced: function(section) { - var archive, boardID, boards, data, event, input, inputs, items, name, row, rows, ta, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; + var archive, boardID, boardOptions, boardSelect, boards, data, event, input, inputs, items, name, row, rows, ta, table, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; - section.innerHTML = "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Disabled selections indicate that only one archive is available for that board and redirection type.
Custom Board Navigation
New lines will be converted into spaces.

In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
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
External link: external-text:\"Google\",\"http://www.google.com\"
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, %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)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; + section.innerHTML = "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Disabled selections indicate that only one archive is available for that board and redirection type.
Custom Board Navigation
New lines will be converted into spaces.

In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
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
External link: external-text:\"Google\",\"http://www.google.com\"
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, %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)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; items = {}; inputs = {}; _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; @@ -9819,35 +9819,47 @@ _ref2 = archive.boards; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { boardID = _ref2[_j]; - if (boardID === g.BOARD.ID) { - data = boards[boardID] || (boards[boardID] = { - thread: [], - post: [], - file: [] - }); - data.thread.push(name); - if (archive.software === 'foolfuuka') { - data.post.push(name); - } - if (archive.files.contains(boardID)) { - data.file.push(name); - } + data = boards[boardID] || (boards[boardID] = { + thread: [], + post: [], + file: [] + }); + data.thread.push(name); + if (archive.software === 'foolfuuka') { + data.post.push(name); + } + if (archive.files.contains(boardID)) { + data.file.push(name); } } } rows = []; + boardOptions = []; _ref3 = Object.keys(boards).sort(); for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { boardID = _ref3[_k]; - row = $.el('tr'); + row = $.el('tr', { + className: "board-" + boardID + }); + row.hidden = boardID !== g.BOARD.ID; rows.push(row); + boardOptions.push($.el('option', { + textContent: "/" + boardID + "/", + value: "board-" + boardID, + selected: boardID === g.BOARD.ID + })); data = boards[boardID]; - Settings.addArchiveCell(row, boardID, data, 'thread'); - Settings.addArchiveCell(row, boardID, data, 'post'); - Settings.addArchiveCell(row, boardID, data, 'file'); + $.add(row, [Settings.addArchiveCell(boardID, data, 'thread'), Settings.addArchiveCell(boardID, data, 'post'), Settings.addArchiveCell(boardID, data, 'file')]); } $.add($('tbody', section), rows); - return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { + boardSelect = $('#archive-board-select', section); + $.add(boardSelect, boardOptions); + table = $.id('archive-table'); + $.on(boardSelect, 'change', function() { + $('tbody > :not([hidden])', table).hidden = true; + return $("tbody > ." + this.value, table).hidden = false; + }); + $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { var option, selectedArchives, type; selectedArchives = _arg.selectedArchives; @@ -9862,6 +9874,47 @@ } }); }, + addArchiveCell: function(boardID, data, type) { + var archive, i, length, options, select, td; + + length = data[type].length; + td = $.el('td', { + className: 'archive-cell' + }); + if (!length) { + td.textContent = '--'; + return td; + } + options = []; + i = 0; + while (i < length) { + archive = data[type][i++]; + options.push($.el('option', { + textContent: archive, + value: archive + })); + } + td.innerHTML = ''; + select = td.firstElementChild; + if (!(select.disabled = length === 1)) { + select.setAttribute('data-boardid', boardID); + select.setAttribute('data-type', type); + $.on(select, 'change', Settings.saveSelectedArchive); + } + $.add(select, options); + return td; + }, + saveSelectedArchive: function() { + var _this = this; + + return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { + var selectedArchives, _name; + + selectedArchives = _arg.selectedArchives; + (selectedArchives[_name = _this.dataset.boardid] || (selectedArchives[_name] = {}))[_this.dataset.type] = _this.value; + return $.set('selectedArchives', selectedArchives); + }); + }, boardnav: function() { return Header.generateBoardList(this.value); }, @@ -9913,47 +9966,6 @@ usercss: function() { return CustomCSS.update(); }, - addArchiveCell: function(row, boardID, data, type) { - var archive, length, options, select, td, _i, _len, _ref; - - options = []; - _ref = data[type]; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - archive = _ref[_i]; - options.push($.el('option', { - textContent: archive, - value: archive - })); - } - td = $.el('td', { - className: 'archive-cell' - }); - length = options.length; - if (length) { - td.innerHTML = ''; - select = td.firstElementChild; - if (!(select.disabled = length === 1)) { - select.setAttribute('data-boardid', boardID); - select.setAttribute('data-type', type); - $.on(select, 'change', Settings.saveSelectedArchive); - } - $.add(select, options); - } else { - td.textContent = '--'; - } - return $.add(row, td); - }, - saveSelectedArchive: function() { - var _this = this; - - return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { - var selectedArchives, _name; - - selectedArchives = _arg.selectedArchives; - (selectedArchives[_name = _this.dataset.boardid] || (selectedArchives[_name] = {}))[_this.dataset.type] = _this.value; - return $.set('selectedArchives', selectedArchives); - }); - }, keybinds: function(section) { var arr, input, inputs, items, key, tbody, tr, _ref; diff --git a/builds/crx/script.js b/builds/crx/script.js index 1c140f334..190d1c601 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -9754,9 +9754,9 @@ return $.on(ta, 'change', $.cb.value); }, advanced: function(section) { - var archive, boardID, boards, data, event, input, inputs, items, name, row, rows, ta, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; + var archive, boardID, boardOptions, boardSelect, boards, data, event, input, inputs, items, name, row, rows, ta, table, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; - section.innerHTML = "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Disabled selections indicate that only one archive is available for that board and redirection type.
Custom Board Navigation
New lines will be converted into spaces.

In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
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
External link: external-text:\"Google\",\"http://www.google.com\"
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, %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)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; + section.innerHTML = "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Disabled selections indicate that only one archive is available for that board and redirection type.
Custom Board Navigation
New lines will be converted into spaces.

In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
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
External link: external-text:\"Google\",\"http://www.google.com\"
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, %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)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; items = {}; inputs = {}; _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; @@ -9800,35 +9800,47 @@ _ref2 = archive.boards; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { boardID = _ref2[_j]; - if (boardID === g.BOARD.ID) { - data = boards[boardID] || (boards[boardID] = { - thread: [], - post: [], - file: [] - }); - data.thread.push(name); - if (archive.software === 'foolfuuka') { - data.post.push(name); - } - if (archive.files.contains(boardID)) { - data.file.push(name); - } + data = boards[boardID] || (boards[boardID] = { + thread: [], + post: [], + file: [] + }); + data.thread.push(name); + if (archive.software === 'foolfuuka') { + data.post.push(name); + } + if (archive.files.contains(boardID)) { + data.file.push(name); } } } rows = []; + boardOptions = []; _ref3 = Object.keys(boards).sort(); for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { boardID = _ref3[_k]; - row = $.el('tr'); + row = $.el('tr', { + className: "board-" + boardID + }); + row.hidden = boardID !== g.BOARD.ID; rows.push(row); + boardOptions.push($.el('option', { + textContent: "/" + boardID + "/", + value: "board-" + boardID, + selected: boardID === g.BOARD.ID + })); data = boards[boardID]; - Settings.addArchiveCell(row, boardID, data, 'thread'); - Settings.addArchiveCell(row, boardID, data, 'post'); - Settings.addArchiveCell(row, boardID, data, 'file'); + $.add(row, [Settings.addArchiveCell(boardID, data, 'thread'), Settings.addArchiveCell(boardID, data, 'post'), Settings.addArchiveCell(boardID, data, 'file')]); } $.add($('tbody', section), rows); - return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { + boardSelect = $('#archive-board-select', section); + $.add(boardSelect, boardOptions); + table = $.id('archive-table'); + $.on(boardSelect, 'change', function() { + $('tbody > :not([hidden])', table).hidden = true; + return $("tbody > ." + this.value, table).hidden = false; + }); + $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { var option, selectedArchives, type; selectedArchives = _arg.selectedArchives; @@ -9843,6 +9855,47 @@ } }); }, + addArchiveCell: function(boardID, data, type) { + var archive, i, length, options, select, td; + + length = data[type].length; + td = $.el('td', { + className: 'archive-cell' + }); + if (!length) { + td.textContent = '--'; + return td; + } + options = []; + i = 0; + while (i < length) { + archive = data[type][i++]; + options.push($.el('option', { + textContent: archive, + value: archive + })); + } + td.innerHTML = ''; + select = td.firstElementChild; + if (!(select.disabled = length === 1)) { + select.setAttribute('data-boardid', boardID); + select.setAttribute('data-type', type); + $.on(select, 'change', Settings.saveSelectedArchive); + } + $.add(select, options); + return td; + }, + saveSelectedArchive: function() { + var _this = this; + + return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { + var selectedArchives, _name; + + selectedArchives = _arg.selectedArchives; + (selectedArchives[_name = _this.dataset.boardid] || (selectedArchives[_name] = {}))[_this.dataset.type] = _this.value; + return $.set('selectedArchives', selectedArchives); + }); + }, boardnav: function() { return Header.generateBoardList(this.value); }, @@ -9894,47 +9947,6 @@ usercss: function() { return CustomCSS.update(); }, - addArchiveCell: function(row, boardID, data, type) { - var archive, length, options, select, td, _i, _len, _ref; - - options = []; - _ref = data[type]; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - archive = _ref[_i]; - options.push($.el('option', { - textContent: archive, - value: archive - })); - } - td = $.el('td', { - className: 'archive-cell' - }); - length = options.length; - if (length) { - td.innerHTML = ''; - select = td.firstElementChild; - if (!(select.disabled = length === 1)) { - select.setAttribute('data-boardid', boardID); - select.setAttribute('data-type', type); - $.on(select, 'change', Settings.saveSelectedArchive); - } - $.add(select, options); - } else { - td.textContent = '--'; - } - return $.add(row, td); - }, - saveSelectedArchive: function() { - var _this = this; - - return $.get('selectedArchives', Conf['selectedArchives'], function(_arg) { - var selectedArchives, _name; - - selectedArchives = _arg.selectedArchives; - (selectedArchives[_name = _this.dataset.boardid] || (selectedArchives[_name] = {}))[_this.dataset.type] = _this.value; - return $.set('selectedArchives', selectedArchives); - }); - }, keybinds: function(section) { var arr, input, inputs, items, key, tbody, tr, _ref; diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 538b018ee..885f67339 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -346,34 +346,83 @@ Settings = boards = {} for name, archive of Redirect.archives for boardID in archive.boards - if boardID is g.BOARD.ID - data = boards[boardID] or= { - thread: [] - post: [] - file: [] - } - data.thread.push name - if archive.software is 'foolfuuka' - data.post.push name - if archive.files.contains boardID - data.file.push name + data = boards[boardID] or= { + thread: [] + post: [] + file: [] + } + data.thread.push name + data.post.push name if archive.software is 'foolfuuka' + data.file.push name if archive.files.contains boardID rows = [] + boardOptions = [] for boardID in Object.keys(boards).sort() # Alphabetical order - row = $.el 'tr' + row = $.el 'tr', + className: "board-#{boardID}" + row.hidden = boardID isnt g.BOARD.ID rows.push row + boardOptions.push $.el 'option', + textContent: "/#{boardID}/" + value: "board-#{boardID}" + selected: boardID is g.BOARD.ID + data = boards[boardID] - Settings.addArchiveCell row, boardID, data, 'thread' - Settings.addArchiveCell row, boardID, data, 'post' - Settings.addArchiveCell row, boardID, data, 'file' + $.add row, [ + Settings.addArchiveCell boardID, data, 'thread' + Settings.addArchiveCell boardID, data, 'post' + Settings.addArchiveCell boardID, data, 'file' + ] $.add $('tbody', section), rows + + boardSelect = $('#archive-board-select', section) + $.add boardSelect, boardOptions + table = $.id 'archive-table' + $.on boardSelect, 'change', -> + $('tbody > :not([hidden])', table).hidden = true + $("tbody > .#{@value}", table).hidden = false + $.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) -> for boardID, data of selectedArchives for type, name of data if option = $ "select[data-boardid='#{boardID}'][data-type='#{type}'] > option[value='#{name}']", section option.selected = true return + return + + addArchiveCell: (boardID, data, type) -> + {length} = data[type] + td = $.el 'td', + className: 'archive-cell' + + unless length + td.textContent = '--' + return td + + options = [] + i = 0 + while i < length + archive = data[type][i++] + options.push $.el 'option', + textContent: archive + value: archive + + td.innerHTML = '' + select = td.firstElementChild + unless select.disabled = length is 1 + # XXX GM can't into datasets + select.setAttribute 'data-boardid', boardID + select.setAttribute 'data-type', type + $.on select, 'change', Settings.saveSelectedArchive + $.add select, options + + td + + saveSelectedArchive: -> + $.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) => + (selectedArchives[@dataset.boardid] or= {})[@dataset.type] = @value + $.set 'selectedArchives', selectedArchives boardnav: -> Header.generateBoardList @value @@ -417,32 +466,6 @@ Settings = usercss: -> CustomCSS.update() - addArchiveCell: (row, boardID, data, type) -> - options = [] - for archive in data[type] - options.push $.el 'option', - textContent: archive - value: archive - td = $.el 'td', - className: 'archive-cell' - {length} = options - if length - td.innerHTML = '' - select = td.firstElementChild - unless select.disabled = length is 1 - # XXX GM can't into datasets - select.setAttribute 'data-boardid', boardID - select.setAttribute 'data-type', type - $.on select, 'change', Settings.saveSelectedArchive - $.add select, options - else - td.textContent = '--' - $.add row, td - saveSelectedArchive: -> - $.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) => - (selectedArchives[@dataset.boardid] or= {})[@dataset.type] = @value - $.set 'selectedArchives', selectedArchives - keybinds: (section) -> section.innerHTML = """ <%= grunt.file.read('src/General/html/Settings/Keybinds.html').replace(/>\s+<').trim() %> diff --git a/src/General/html/Settings/Advanced.html b/src/General/html/Settings/Advanced.html index 47859f8fc..136e215ff 100644 --- a/src/General/html/Settings/Advanced.html +++ b/src/General/html/Settings/Advanced.html @@ -1,6 +1,7 @@
Archiver
404 Redirect is disabled.
+
Thread redirection