Remove Archive section, put back into Advanced

This commit is contained in:
Jordan Bates 2013-05-13 07:17:19 -07:00
parent c9858fe863
commit f4e3629b4c
9 changed files with 232 additions and 355 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.2.2 - 2013-05-12
* 4chan X - Version 1.2.2 - 2013-05-13
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,109 +0,0 @@
[{
"uid": 0,
"name": "Foolz",
"domain": "archive.foolz.us",
"http": true,
"https": true,
"software": "foolfuuka",
"boards": ["a", "co", "gd", "jp", "m", "q", "sp", "tg", "tv", "vp", "vr", "wsg"],
"files": ["a", "gd", "jp", "m", "q", "tg", "vp", "vr", "wsg"]
}, {
"uid": 1,
"name": "NSFW Foolz",
"domain": "nsfw.foolz.us",
"http": true,
"https": true,
"software": "foolfuuka",
"boards": ["u"],
"files": ["u"]
}, {
"uid": 2,
"name": "The Dark Cave",
"domain": "archive.thedarkcave.org",
"http": true,
"https": true,
"software": "foolfuuka",
"boards": ["c", "int", "out", "po"],
"files": ["c", "po"]
}, {
"uid": 3,
"name": "4plebs",
"domain": "archive.4plebs.org",
"http": true,
"https": false,
"software": "foolfuuka",
"boards": ["hr", "tg", "tv", "x"],
"files": ["hr", "tg", "tv", "x"]
}, {
"uid": 4,
"name": "Nyafuu",
"domain": "archive.nyafuu.org",
"http": true,
"https": true,
"software": "foolfuuka",
"boards": ["c", "w", "wg"],
"files": ["c", "w", "wg"]
}, {
"uid": 5,
"name": "Love is Over",
"domain": "loveisover.me",
"http": true,
"https": true,
"software": "foolfuuka",
"boards": ["d", "h", "v"],
"files": ["d", "h", "v"]
}, {
"uid": 6,
"name": "nth-chan",
"domain": "nth.pensivenonsen.se",
"http": true,
"https": false,
"software": "foolfuuka",
"boards": ["vg"],
"files": ["vg"]
}, {
"uid": 11,
"name": "Foolz a Shit",
"domain": "archive.foolzashit.com",
"http": true,
"https": true,
"software": "foolfuuka",
"boards": ["adv", "asp", "cm", "e", "i", "lgbt", "n", "o", "p", "s", "s4s", "t", "trv", "y"],
"files": ["adv", "asp", "cm", "e", "i", "lgbt", "n", "o", "p", "s", "s4s", "t", "trv", "y"]
}, {
"uid": 7,
"name": "Install Gentoo",
"domain": "archive.installgentoo.net",
"http": true,
"https": true,
"software": "fuuka",
"boards": ["diy", "g", "sci"],
"files": []
}, {
"uid": 8,
"name": "Rebecca Black Tech",
"domain": "rbt.asia",
"http": true,
"https": true,
"software": "fuuka",
"boards": ["cgl", "g", "mu", "w"],
"files": ["cgl", "g", "mu", "w"]
}, {
"uid": 9,
"name": "Heinessen",
"domain": "archive.heinessen.com",
"http": true,
"https": false,
"software": "fuuka",
"boards": ["an", "fit", "k", "mlp", "r9k", "toy", "x"],
"files": ["an", "k", "toy", "x"]
}, {
"uid": 10,
"name": "warosu",
"domain": "fuuka.warosu.org",
"http": true,
"https": true,
"software": "fuuka",
"boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "s4s", "tg", "vr"],
"files": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "s4s", "vr"]
}]

View File

@ -27,7 +27,6 @@ Settings =
Settings.addSection 'Filter', Settings.filter
Settings.addSection 'Sauce', Settings.sauce
Settings.addSection 'Advanced', Settings.advanced
Settings.addSection 'Archives', Settings.archives
Settings.addSection 'Keybinds', Settings.keybinds
$.on d, 'AddSettingsSection', Settings.addSection
@ -343,6 +342,39 @@ Settings =
$.on $('input[name=Interval]', section), 'change', ThreadUpdater.cb.interval
$.on $('input[name="Custom CSS"]', section), 'change', Settings.togglecss
$.on $.id('apply-css'), 'click', Settings.usercss
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
rows = []
for boardID in Object.keys(boards).sort() # Alphabetical order
row = $.el 'tr'
rows.push row
data = boards[boardID]
Settings.addArchiveCell row, boardID, data, 'thread'
Settings.addArchiveCell row, boardID, data, 'post'
Settings.addArchiveCell row, boardID, data, 'file'
$.add $('tbody', section), rows
$.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
boardnav: ->
Header.generateBoardList @value
time: ->
@ -385,51 +417,14 @@ Settings =
usercss: ->
CustomCSS.update()
archives: (section) ->
section.innerHTML = """
<%= grunt.file.read('src/General/html/Settings/Archives.html').replace(/>\s+</g, '><').trim() %>
"""
boards = {}
for name, archive of Redirect.archives
for boardID in archive.boards
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
rows = []
for boardID in Object.keys(boards).sort() # Alphabetical order
row = $.el 'tr'
rows.push row
$.add row, $.el 'th',
textContent: "/#{boardID}/"
className: if boardID is g.BOARD.ID then 'warning' else ''
data = boards[boardID]
Settings.addArchiveCell row, boardID, data, 'thread'
Settings.addArchiveCell row, boardID, data, 'post'
Settings.addArchiveCell row, boardID, data, 'file'
$.add $('tbody', section), rows
$.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
addArchiveCell: (row, boardID, data, type) ->
options = []
for archive in data[type]
options.push $.el 'option',
textContent: archive
value: archive
td = $.el 'td'
td = $.el 'td',
className: 'archive-cell'
{length} = options
if length
td.innerHTML = '<select></select>'
@ -441,7 +436,7 @@ Settings =
$.on select, 'change', Settings.saveSelectedArchive
$.add select, options
else
td.textContent = 'N/A'
td.textContent = '--'
$.add row, td
saveSelectedArchive: ->
$.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) =>

View File

@ -378,6 +378,13 @@ a {
.section-advanced textarea {
height: 150px;
}
.section-advanced #archive-table {
margin-left: 0px;
text-align: left;
}
.section-advanced .archive-cell {
min-width: 160px;
}
.section-advanced .note {
font-size: 0.8em;
font-style: italic;

View File

@ -1,3 +1,17 @@
<fieldset>
<legend>Archiver</legend>
<div class="warning" #{if Conf['404 Redirect'] then 'hidden' else ''}><code>404 Redirect</code> is disabled.</div>
<table id='archive-table'>
<thead>
<th>Thread redirection</th>
<th>Post fetching</th>
<th>File redirection</th>
</thead>
<tbody></tbody>
</table>
<span class=note>Disabled selections indicate that only one archive is available for that board and redirection type.</span>
</fieldset>
<fieldset>
<legend>Custom Board Navigation</span></legend>
<div><textarea name=boardnav class=field spellcheck=false></textarea></div>

View File

@ -1,12 +0,0 @@
<div class="warning" #{if Conf['404 Redirect'] then 'hidden' else ''}><code>404 Redirect</code> is disabled.</div>
<p>Disabled selections indicate that only one archive is available for that board and redirection type.</p>
<table>
<caption>Archived boards</caption>
<thead>
<th>Board</th>
<th>Thread redirection</th>
<th>Post fetching</th>
<th>File redirection</th>
</thead>
<tbody></tbody>
</table>