Merge pull request #256 from seaweedchan/v3

Archive change + settings changes
This commit is contained in:
Zixaphir 2013-04-22 21:48:58 -07:00
commit 20ebebb34e
15 changed files with 183 additions and 170 deletions

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

@ -3,7 +3,7 @@ Config =
'Miscellaneous': 'Miscellaneous':
'Catalog Links': [ 'Catalog Links': [
true true
'Turn Navigation links into links to each board\'s catalog.' 'Add toggle link in header menu to turn Navigation links into links to each board\'s catalog.'
] ]
'External Catalog': [ 'External Catalog': [
false false
@ -93,11 +93,11 @@ Config =
true true
'Hide replies of hidden posts, recursively.' 'Hide replies of hidden posts, recursively.'
] ]
'Thread Hiding': [ 'Thread Hiding Buttons': [
true true
'Add buttons to hide entire threads.' 'Add buttons to hide entire threads.'
] ]
'Reply Hiding': [ 'Reply Hiding Buttons': [
true true
'Add buttons to hide single replies.' 'Add buttons to hide single replies.'
] ]
@ -185,7 +185,7 @@ Config =
false false
'Hide the unread posts count when it reaches 0.' 'Hide the unread posts count when it reaches 0.'
] ]
'Unread Tab Icon': [ 'Unread Favicon': [
true true
'Show a different favicon when there are unread posts.' 'Show a different favicon when there are unread posts.'
] ]
@ -388,7 +388,7 @@ http://iqdb.org/?url=%TURL
'Custom CSS': false 'Custom CSS': false
'Boards Navigation': 'sticky top' 'Boards Navigation': 'Sticky top'
'Header auto-hide': false 'Header auto-hide': false
@ -402,7 +402,7 @@ http://iqdb.org/?url=%TURL
backlink: '>>%id' backlink: '>>%id'
fileInfo: '%l (%p%s, %r)' fileInfo: '%L (%p%s, %r)'
favicon: 'ferongr' favicon: 'ferongr'
@ -415,11 +415,11 @@ http://iqdb.org/?url=%TURL
'Toggle the full board list.' 'Toggle the full board list.'
] ]
'Open empty QR': [ 'Open empty QR': [
'q' 'l'
'Open QR without post number inserted.' 'Open QR without post number inserted.'
] ]
'Open QR': [ 'Open QR': [
'Shift+q' 'Shift+l'
'Open QR with post number inserted.' 'Open QR with post number inserted.'
] ]
'Open settings': [ 'Open settings': [

View File

@ -145,22 +145,22 @@ a[href="javascript:;"] {
-webkit-transform: translateY(100%); -webkit-transform: translateY(100%);
transform: translateY(100%); transform: translateY(100%);
} }
#toggle-header-bar { #scroll-marker {
left: 0; left: 0;
right: 0; right: 0;
height: 10px; height: 10px;
position: absolute; position: absolute;
} }
#boardNavDesktop #toggle-header-bar { #header-bar #scroll-marker {
display: none; display: none;
} }
.fixed #boardNavDesktop #toggle-header-bar { .fixed #header-bar #scroll-marker {
display: block; display: block;
} }
.fixed.top boardNavDesktop #toggle-header-bar { .fixed.top #header-bar #scroll-marker {
top: 100%; top: 100%;
} }
.fixed.bottom #boardNavDesktop #toggle-header-bar { .fixed.bottom #header-bar #scroll-marker {
bottom: 100%; bottom: 100%;
} }
#header-bar a:not(.entry) { #header-bar a:not(.entry) {
@ -857,3 +857,15 @@ a:only-of-type > .remove {
.focused .submenu { .focused .submenu {
display: block; display: block;
} }
.imp-exp-result {
position: absolute;
text-align: center;
margin: auto;
right: 0px;
left: 0px;
width: 200px;
}
.export, .import {
cursor: pointer;
text-decoration: none !important;
}

View File

@ -1,6 +1,6 @@
PostHiding = PostHiding =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] return if g.VIEW is 'catalog' or !Conf['Reply Hiding Buttons'] and !Conf['Reply Hiding Link']
@db = new DataBoard 'hiddenPosts' @db = new DataBoard 'hiddenPosts'
Post::callbacks.push Post::callbacks.push
@ -15,7 +15,7 @@ PostHiding =
else else
Recursive.apply PostHiding.hide, @, data.makeStub, true Recursive.apply PostHiding.hide, @, data.makeStub, true
Recursive.add PostHiding.hide, @, data.makeStub, true Recursive.add PostHiding.hide, @, data.makeStub, true
return unless Conf['Reply Hiding'] return unless Conf['Reply Hiding Buttons']
$.replace $('.sideArrows', @nodes.root), PostHiding.makeButton @, 'hide' $.replace $('.sideArrows', @nodes.root), PostHiding.makeButton @, 'hide'
menu: menu:

View File

@ -1,6 +1,6 @@
QuoteStrikeThrough = QuoteStrikeThrough =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] and !Conf['Filter'] return if g.VIEW is 'catalog' or !Conf['Reply Hiding Buttons'] and !Conf['Reply Hiding Link'] and !Conf['Filter']
Post::callbacks.push Post::callbacks.push
name: 'Strike-through Quotes' name: 'Strike-through Quotes'

View File

@ -1,6 +1,6 @@
ThreadHiding = ThreadHiding =
init: -> init: ->
return if g.VIEW isnt 'index' or !Conf['Thread Hiding'] and !Conf['Thread Hiding Link'] return if g.VIEW isnt 'index' or !Conf['Thread Hiding Buttons'] and !Conf['Thread Hiding Link']
@db = new DataBoard 'hiddenThreads' @db = new DataBoard 'hiddenThreads'
@syncCatalog() @syncCatalog()
@ -11,7 +11,7 @@ ThreadHiding =
node: -> node: ->
if data = ThreadHiding.db.get {boardID: @board.ID, threadID: @ID} if data = ThreadHiding.db.get {boardID: @board.ID, threadID: @ID}
ThreadHiding.hide @, data.makeStub ThreadHiding.hide @, data.makeStub
return unless Conf['Thread Hiding'] return unless Conf['Thread Hiding Buttons']
$.prepend @OP.nodes.root, ThreadHiding.makeButton @, 'hide' $.prepend @OP.nodes.root, ThreadHiding.makeButton @, 'hide'
syncCatalog: -> syncCatalog: ->

View File

@ -4,7 +4,7 @@ CatalogLinks =
el = $.el 'label', el = $.el 'label',
id: 'toggleCatalog' id: 'toggleCatalog'
href: 'javascript:;' href: 'javascript:;'
innerHTML: "<input type=checkbox #{if Conf['Header catalog links'] then 'checked' else ''}>Catalog" innerHTML: "<input type=checkbox #{if Conf['Header catalog links'] then 'checked' else ''}>Catalog Links"
title: "Turn catalog links #{if Conf['Header catalog links'] then 'off' else 'on'}." title: "Turn catalog links #{if Conf['Header catalog links'] then 'off' else 'on'}."
input = $ 'input', el input = $ 'input', el

View File

@ -17,7 +17,7 @@ Header =
{createSubEntry} = Header {createSubEntry} = Header
subEntries = [] subEntries = []
for setting in ['sticky top', 'sticky bottom', 'top'] for setting in ['Sticky top', 'Sticky bottom', 'Top']
subEntries.push createSubEntry setting subEntries.push createSubEntry setting
subEntries.push {el: headerToggler} subEntries.push {el: headerToggler}
@ -64,7 +64,7 @@ Header =
id: 'hoverUI' id: 'hoverUI'
toggle: $.el 'div', toggle: $.el 'div',
id: 'toggle-header-bar' id: 'scroll-marker'
createSubEntry: (setting) -> createSubEntry: (setting) ->
label = $.el 'label', label = $.el 'label',
@ -180,15 +180,15 @@ Header =
$.rmClass doc, 'bottom' $.rmClass doc, 'bottom'
$.rmClass Header.nav, 'dialog' $.rmClass Header.nav, 'dialog'
switch setting switch setting
when 'sticky top' when 'Sticky top'
$.addClass doc, 'top' $.addClass doc, 'top'
$.addClass doc, 'fixed' $.addClass doc, 'fixed'
$.addClass Header.nav, 'dialog' $.addClass Header.nav, 'dialog'
when 'sticky bottom' when 'Sticky bottom'
$.addClass doc, 'fixed' $.addClass doc, 'fixed'
$.addClass doc, 'bottom' $.addClass doc, 'bottom'
$.addClass Header.nav, 'dialog' $.addClass Header.nav, 'dialog'
when 'top' when 'Top'
$.addClass doc, 'top' $.addClass doc, 'top'
setBarVisibility: (hide) -> setBarVisibility: (hide) ->
@ -236,7 +236,7 @@ Header =
scrollToPost: (post) -> scrollToPost: (post) ->
{top} = post.getBoundingClientRect() {top} = post.getBoundingClientRect()
if Conf['Boards Navigation'] is 'sticky top' if Conf['Boards Navigation'] is 'Sticky top'
headRect = Header.bar.getBoundingClientRect() headRect = Header.bar.getBoundingClientRect()
top += - headRect.top - headRect.height top += - headRect.top - headRect.height
(if $.engine is 'webkit' then d.body else doc).scrollTop += top (if $.engine is 'webkit' then d.body else doc).scrollTop += top

View File

@ -79,14 +79,14 @@ Redirect =
base: '//fuuka.warosu.org' base: '//fuuka.warosu.org'
boards: ['cgl', 'ck', 'fa', 'jp', 'lit', 's4s', 'q', 'tg'] boards: ['cgl', 'ck', 'fa', 'jp', 'lit', 's4s', 'q', 'tg']
type: 'fuuka' type: 'fuuka'
'RebeccaBlackTech':
base: '//rbt.asia'
boards: ['an', 'cgl', 'g', 'mu', 'w']
type: 'fuuka_mail'
'InstallGentoo': 'InstallGentoo':
base: '//archive.installgentoo.net' base: '//archive.installgentoo.net'
boards: ['diy', 'g', 'sci'] boards: ['diy', 'g', 'sci']
type: 'fuuka' type: 'fuuka'
'RebeccaBlackTech':
base: '//rbt.asia'
boards: ['an', 'cgl', 'g', 'mu', 'w']
type: 'fuuka_mail'
'Heinessen': 'Heinessen':
base: 'http://archive.heinessen.com' base: 'http://archive.heinessen.com'
boards: ['an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x'] boards: ['an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x']

View File

@ -1,6 +1,6 @@
Unread = Unread =
init: -> init: ->
return if g.VIEW isnt 'thread' or !Conf['Unread Count'] and !Conf['Unread Tab Icon'] return if g.VIEW isnt 'thread' or !Conf['Unread Count'] and !Conf['Unread Favicon']
@db = new DataBoard 'lastReadPosts', @sync @db = new DataBoard 'lastReadPosts', @sync
@hr = $.el 'hr', @hr = $.el 'hr',
@ -153,7 +153,7 @@ Unread =
, $.SECOND , $.SECOND
<% } %> <% } %>
return unless Conf['Unread Tab Icon'] return unless Conf['Unread Favicon']
Favicon.el.href = Favicon.el.href =
if g.DEAD if g.DEAD

View File

@ -16,7 +16,7 @@ QuoteThreading =
$.event 'AddMenuEntry', $.event 'AddMenuEntry',
type: 'header' type: 'header'
el: @controls el: @controls
order: 115 order: 98
$.on d, '4chanXInitFinished', @setup $.on d, '4chanXInitFinished', @setup

View File

@ -75,8 +75,8 @@ Main =
'Linkify': Linkify 'Linkify': Linkify
'Resurrect Quotes': Quotify 'Resurrect Quotes': Quotify
'Filter': Filter 'Filter': Filter
'Thread Hiding': ThreadHiding 'Thread Hiding Buttons': ThreadHiding
'Reply Hiding': PostHiding 'Reply Hiding Buttons': PostHiding
'Recursive': Recursive 'Recursive': Recursive
'Strike-through Quotes': QuoteStrikeThrough 'Strike-through Quotes': QuoteStrikeThrough
'Quick Reply': QR 'Quick Reply': QR

View File

@ -49,7 +49,11 @@ Settings =
html = """ html = """
<nav> <nav>
<div class=sections-list></div> <div class=sections-list></div>
<p class='imp-exp-result warning'></p>
<div class=credits> <div class=credits>
<a class=export>Export</a> |
<a class=import>Import</a> |
<input type=file style='display: none;'>
<a href='<%= meta.page %>' target=_blank><%= meta.name %></a> | <a href='<%= meta.page %>' target=_blank><%= meta.name %></a> |
<a href='<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' target=_blank>#{g.VERSION}</a> | <a href='<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' target=_blank>#{g.VERSION}</a> |
<a href='<%= meta.repo %>blob/<%= meta.mainBranch %>/CONTRIBUTING.md#reporting-bugs-and-suggestions' target=_blank>Issues</a> | <a href='<%= meta.repo %>blob/<%= meta.mainBranch %>/CONTRIBUTING.md#reporting-bugs-and-suggestions' target=_blank>Issues</a> |
@ -68,6 +72,10 @@ Settings =
className: 'dialog' className: 'dialog'
innerHTML: html innerHTML: html
$.on $('.export', Settings.dialog), 'click', Settings.export
$.on $('.import', Settings.dialog), 'click', Settings.import
$.on $('input', Settings.dialog), 'change', Settings.onImport
links = [] links = []
for section in Settings.sections for section in Settings.sections
link = $.el 'a', link = $.el 'a',
@ -114,18 +122,6 @@ Settings =
section.scrollTop = 0 section.scrollTop = 0
main: (section) -> main: (section) ->
section.innerHTML = """
<div class=imp-exp>
<button class=export>Export Settings</button>
<button class=import>Import Settings</button>
<input type=file style='visibility:hidden'>
</div>
<p class=imp-exp-result></p>
"""
$.on $('.export', section), 'click', Settings.export
$.on $('.import', section), 'click', Settings.import
$.on $('input', section), 'change', Settings.onImport
items = {} items = {}
inputs = {} inputs = {}
for key, obj of Config.main for key, obj of Config.main
@ -201,7 +197,7 @@ Settings =
@nextElementSibling.click() @nextElementSibling.click()
onImport: -> onImport: ->
return unless file = @files[0] return unless file = @files[0]
output = @parentNode.nextElementSibling output = $('.imp-exp-result')
unless confirm 'Your current settings will be entirely overwritten, are you sure?' unless confirm 'Your current settings will be entirely overwritten, are you sure?'
output.textContent = 'Import aborted.' output.textContent = 'Import aborted.'
return return
@ -227,7 +223,7 @@ Settings =
'Show Stubs': 'Stubs' 'Show Stubs': 'Stubs'
'Image Auto-Gif': 'Auto-GIF' 'Image Auto-Gif': 'Auto-GIF'
'Expand From Current': '' 'Expand From Current': ''
'Unread Favicon': 'Unread Tab Icon' 'Unread Tab Icon': 'Unread Favicon'
'Post in Title': 'Thread Excerpt' 'Post in Title': 'Thread Excerpt'
'Auto Hide QR': '' 'Auto Hide QR': ''
'Open Reply in New Tab': '' 'Open Reply in New Tab': ''
@ -236,6 +232,8 @@ Settings =
'Quote Preview': 'Quote Previewing' 'Quote Preview': 'Quote Previewing'
'Indicate OP quote': 'Mark OP Quotes' 'Indicate OP quote': 'Mark OP Quotes'
'Indicate Cross-thread Quotes': 'Mark Cross-thread Quotes' 'Indicate Cross-thread Quotes': 'Mark Cross-thread Quotes'
'Reply Hiding': 'Reply Hiding Buttons'
'Thread Hiding': 'Thread Hiding Buttons'
# filter # filter
'uniqueid': 'uniqueID' 'uniqueid': 'uniqueID'
'mod': 'capcode' 'mod': 'capcode'
@ -434,7 +432,7 @@ Settings =
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>Unread Tab Icon <span class=warning #{if Conf['Unread Tab Icon'] then 'hidden' else ''}>is disabled.</span></legend> <legend>Unread Favicon <span class=warning #{if Conf['Unread Favicon'] then 'hidden' else ''}>is disabled.</span></legend>
<select name=favicon> <select name=favicon>
<option value=ferongr>ferongr</option> <option value=ferongr>ferongr</option>
<option value=xat->xat-</option> <option value=xat->xat-</option>
@ -510,7 +508,7 @@ Settings =
@nextElementSibling.innerHTML = funk FileInfo, data @nextElementSibling.innerHTML = funk FileInfo, data
favicon: -> favicon: ->
Favicon.switch() Favicon.switch()
Unread.update() if g.VIEW is 'thread' and Conf['Unread Tab Icon'] Unread.update() if g.VIEW is 'thread' and Conf['Unread Favicon']
@nextElementSibling.innerHTML = """ @nextElementSibling.innerHTML = """
<img src=#{Favicon.default}> <img src=#{Favicon.default}>
<img src=#{Favicon.unreadSFW}> <img src=#{Favicon.unreadSFW}>