diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index bc1261fc1..97d62cb3c 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -1,6 +1,6 @@ ThreadHiding = init: -> - return if g.VIEW not in ['index', 'catalog'] or !Conf['Thread Hiding Buttons'] and !(Conf['Menu'] and Conf['Thread Hiding Link']) and !Conf['JSON Navigation'] + return if g.VIEW not in ['index', 'catalog'] or !Conf['Thread Hiding Buttons'] and !(Conf['Menu'] and Conf['Thread Hiding Link']) and !Conf['JSON Index'] @db = new DataBoard 'hiddenThreads' return @catalogWatch() if g.VIEW is 'catalog' @catalogSet g.BOARD @@ -74,7 +74,7 @@ ThreadHiding = el: div order: 20 open: ({thread, isReply}) -> - if isReply or thread.isHidden or Conf['JSON Navigation'] and Conf['Index Mode'] is 'catalog' + if isReply or thread.isHidden or Conf['JSON Index'] and Conf['Index Mode'] is 'catalog' return false ThreadHiding.menu.thread = thread true @@ -90,7 +90,7 @@ ThreadHiding = el: div order: 20 open: ({thread, isReply}) -> - if isReply or !thread.isHidden or Conf['JSON Navigation'] and Conf['Index Mode'] is 'catalog' + if isReply or !thread.isHidden or Conf['JSON Index'] and Conf['Index Mode'] is 'catalog' return false ThreadHiding.menu.thread = thread true @@ -104,7 +104,7 @@ ThreadHiding = el: hideStubLink order: 15 open: ({thread, isReply}) -> - if isReply or !thread.isHidden or Conf['JSON Navigation'] and Conf['Index Mode'] is 'catalog' + if isReply or !thread.isHidden or Conf['JSON Index'] and Conf['Index Mode'] is 'catalog' return false ThreadHiding.menu.thread = thread @@ -176,7 +176,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true - Index.updateHideLabel() if Conf['JSON Navigation'] + Index.updateHideLabel() if Conf['JSON Index'] return threadRoot.hidden = true unless makeStub @@ -188,4 +188,4 @@ ThreadHiding = delete thread.stub threadRoot = thread.OP.nodes.root.parentNode threadRoot.hidden = thread.isHidden = false - Index.updateHideLabel() if Conf['JSON Navigation'] + Index.updateHideLabel() if Conf['JSON Index'] diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 1e72ea411..a715f63cb 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -1,7 +1,7 @@ Config = main: 'Miscellaneous': - 'JSON Navigation': [ + 'JSON Index': [ true 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.' ] @@ -66,7 +66,7 @@ Config = ] 'Comment Expansion': [ true - 'Expand comments that are too long to display on the index. Not applicable with JSON Navigation.' + 'Expand comments that are too long to display on the index. Not applicable with JSON Index.' ] 'File Info Formatting': [ true diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 815be20bb..8b11e8e1d 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -3,7 +3,7 @@ Index = changed: {} init: -> - return if g.BOARD.ID is 'f' or !Conf['JSON Navigation'] or g.VIEW isnt 'index' + return if g.BOARD.ID is 'f' or !Conf['JSON Index'] or g.VIEW isnt 'index' CatalogThread.callbacks.push name: 'Catalog Features' @@ -150,7 +150,7 @@ Index = menu: init: -> - return if g.VIEW isnt 'index' or !Conf['JSON Navigation'] or !Conf['Menu'] or !Conf['Thread Hiding Link'] or g.BOARD.ID is 'f' + return if g.VIEW isnt 'index' or !Conf['JSON Index'] or !Conf['Menu'] or !Conf['Thread Hiding Link'] or g.BOARD.ID is 'f' Menu.menu.addEntry el: $.el 'a', diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 25ac4d6aa..7db610394 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -219,7 +219,7 @@ Main = new Notice 'warning', msg # Parse HTML or skip it and start building from JSON. - unless Conf['JSON Navigation'] and g.VIEW is 'index' + unless Conf['JSON Index'] and g.VIEW is 'index' Main.initThread() else Main.expectInitFinished = true diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 2c1b417f8..a28f04dbf 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -348,6 +348,9 @@ Settings = if compareString < '00001.00011.00022.00002' if not data['Use Recaptcha v1 in Reports']? and data['Use Recaptcha v1'] and not data['Use Recaptcha v2 in Reports'] set 'Use Recaptcha v1 in Reports', true + if compareString < '00001.00011.00024.00000' + if data['JSON Navigation']? and not data['JSON Index']? + set 'JSON Index', data['JSON Navigation'] changes loadSettings: (data, cb) -> if data.version.split('.')[0] is '2' # https://github.com/loadletter/4chan-x diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index 7ca8d04d9..dbc05a05a 100644 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -1,6 +1,6 @@ CatalogLinks = init: -> - if (Conf['External Catalog'] or Conf['JSON Navigation']) and !(Conf['JSON Navigation'] and g.VIEW is 'index') + if (Conf['External Catalog'] or Conf['JSON Index']) and !(Conf['JSON Index'] and g.VIEW is 'index') selector = switch g.VIEW when 'thread', 'archive' then '.navLinks.desktop > a' when 'catalog' then '.navLinks > :first-child > a' @@ -9,18 +9,18 @@ CatalogLinks = for link in $$ selector switch link.pathname.replace /\/+/g, '/' when "/#{g.BOARD}/" - link.textContent = 'Index' if Conf['JSON Navigation'] + link.textContent = 'Index' if Conf['JSON Index'] link.href = CatalogLinks.index() when "/#{g.BOARD}/catalog" link.href = CatalogLinks.catalog() - if g.VIEW is 'catalog' and Conf['JSON Navigation'] and Conf['Use <%= meta.name %> Catalog'] + if g.VIEW is 'catalog' and Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog'] catalogLink = link.parentNode.cloneNode true catalogLink.firstElementChild.textContent = '<%= meta.name %> Catalog' catalogLink.firstElementChild.href = CatalogLinks.catalog() $.after link.parentNode, [$.tn(' '), catalogLink] return - if Conf['JSON Navigation'] and Conf['Use <%= meta.name %> Catalog'] + if Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog'] Post.callbacks.push name: 'Catalog Link Rewrite' cb: @node @@ -73,13 +73,13 @@ CatalogLinks = catalog: (board=g.BOARD.ID) -> if Conf['External Catalog'] and board in ['a', 'c', 'g', 'biz', 'k', 'm', 'o', 'p', 'v', 'vg', 'vr', 'w', 'wg', 'cm', '3', 'adv', 'an', 'asp', 'cgl', 'ck', 'co', 'diy', 'fa', 'fit', 'gd', 'int', 'jp', 'lit', 'mlp', 'mu', 'n', 'out', 'po', 'sci', 'sp', 'tg', 'toy', 'trv', 'tv', 'vp', 'wsg', 'x', 'f', 'pol', 's4s', 'lgbt'] "http://catalog.neet.tv/#{board}/" - else if Conf['JSON Navigation'] and Conf['Use <%= meta.name %> Catalog'] + else if Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog'] if g.BOARD.ID is board and g.VIEW is 'index' then '#catalog' else "/#{board}/#catalog" else "/#{board}/catalog" index: (board=g.BOARD.ID) -> - if Conf['JSON Navigation'] and board isnt 'f' + if Conf['JSON Index'] and board isnt 'f' if g.BOARD.ID is board and g.VIEW is 'index' then '#index' else "/#{board}/#index" else "/#{board}/" diff --git a/src/Miscellaneous/ExpandComment.coffee b/src/Miscellaneous/ExpandComment.coffee index b179132a8..736168a86 100644 --- a/src/Miscellaneous/ExpandComment.coffee +++ b/src/Miscellaneous/ExpandComment.coffee @@ -1,6 +1,6 @@ ExpandComment = init: -> - return if g.VIEW isnt 'index' or !Conf['Comment Expansion'] or Conf['JSON Navigation'] + return if g.VIEW isnt 'index' or !Conf['Comment Expansion'] or Conf['JSON Index'] @callbacks.push Fourchan.code if g.BOARD.ID is 'g' @callbacks.push Fourchan.math if g.BOARD.ID is 'sci' diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index d41585c32..d36ff6e41 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -2,7 +2,7 @@ ExpandThread = statuses: {} init: -> return if g.VIEW is 'thread' or !Conf['Thread Expansion'] - if Conf['JSON Navigation'] + if Conf['JSON Index'] $.on d, 'IndexRefresh', @onIndexRefresh else Thread.callbacks.push @@ -62,7 +62,7 @@ ExpandThread = return replies = $$ '.thread > .replyContainer', threadRoot - if !Conf['JSON Navigation'] or Conf['Show Replies'] + if !Conf['JSON Index'] or Conf['Show Replies'] num = if thread.isSticky 1 else switch g.BOARD.ID diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 60165764a..2520e135f 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -23,7 +23,7 @@ Keybinds = return unless /(Esc|Alt|Ctrl|Meta|Shift\+\w{2,})/.test(key) and not /^Alt\+(\d|Up|Down|Left|Right)$/.test(key) unless ( g.VIEW not in ['index', 'thread'] or - g.VIEW is 'index' and Conf['JSON Navigation'] and Conf['Index Mode'] is 'catalog' or + g.VIEW is 'index' and Conf['JSON Index'] and Conf['Index Mode'] is 'catalog' or g.VIEW is 'index' and g.BOARD.ID is 'f' ) threadRoot = Nav.getThread() @@ -87,7 +87,7 @@ Keybinds = return unless Conf['Thread Updater'] ThreadUpdater.update() when 'index' - return unless Conf['JSON Navigation'] and g.BOARD.ID isnt 'f' + return unless Conf['JSON Index'] and g.BOARD.ID isnt 'f' Index.update() else return @@ -112,7 +112,7 @@ Keybinds = FappeTyme.toggle 'werk' # Board Navigation when Conf['Front page'] - if Conf['JSON Navigation'] and g.VIEW is 'index' and g.BOARD.ID isnt 'f' + if Conf['JSON Index'] and g.VIEW is 'index' and g.BOARD.ID isnt 'f' Index.userPageNav 1 else window.location = "/#{g.BOARD}/" @@ -120,7 +120,7 @@ Keybinds = $.open "/#{g.BOARD}/" when Conf['Next page'] return unless g.VIEW is 'index' and g.BOARD.ID isnt 'f' - if Conf['JSON Navigation'] + if Conf['JSON Index'] return unless Conf['Index Mode'] in ['paged', 'infinite'] $('.next button', Index.pagelist).click() else @@ -128,7 +128,7 @@ Keybinds = window.location = form.action when Conf['Previous page'] return unless g.VIEW is 'index' and g.BOARD.ID isnt 'f' - if Conf['JSON Navigation'] + if Conf['JSON Index'] return unless Conf['Index Mode'] in ['paged', 'infinite'] $('.prev button', Index.pagelist).click() else @@ -136,23 +136,23 @@ Keybinds = window.location = form.action when Conf['Search form'] return unless g.VIEW is 'index' and g.BOARD.ID isnt 'f' - searchInput = if Conf['JSON Navigation'] then Index.searchInput else $.id('search-box') + searchInput = if Conf['JSON Index'] then Index.searchInput else $.id('search-box') Header.scrollToIfNeeded searchInput searchInput.focus() when Conf['Paged mode'] - return unless Conf['JSON Navigation'] and g.BOARD.ID isnt 'f' + return unless Conf['JSON Index'] and g.BOARD.ID isnt 'f' window.location = if g.VIEW is 'index' then '#paged' else "/#{g.BOARD}/#paged" when Conf['Infinite scrolling mode'] - return unless Conf['JSON Navigation'] and g.BOARD.ID isnt 'f' + return unless Conf['JSON Index'] and g.BOARD.ID isnt 'f' window.location = if g.VIEW is 'index' then '#infinite' else "/#{g.BOARD}/#infinite" when Conf['All pages mode'] - return unless Conf['JSON Navigation'] and g.BOARD.ID isnt 'f' + return unless Conf['JSON Index'] and g.BOARD.ID isnt 'f' window.location = if g.VIEW is 'index' then '#all-pages' else "/#{g.BOARD}/#all-pages" when Conf['Open catalog'] return if g.BOARD.ID is 'f' window.location = CatalogLinks.catalog() when Conf['Cycle sort type'] - return unless Conf['JSON Navigation'] and g.VIEW is 'index' and g.BOARD.ID isnt 'f' + return unless Conf['JSON Index'] and g.VIEW is 'index' and g.BOARD.ID isnt 'f' Index.cycleSortType() # Thread Navigation when Conf['Next thread'] diff --git a/src/Miscellaneous/RelativeDates.coffee b/src/Miscellaneous/RelativeDates.coffee index 960a9ec75..353442239 100644 --- a/src/Miscellaneous/RelativeDates.coffee +++ b/src/Miscellaneous/RelativeDates.coffee @@ -3,7 +3,7 @@ RelativeDates = init: -> if ( g.VIEW in ['index', 'thread'] and Conf['Relative Post Dates'] and !Conf['Relative Date Title'] or - g.VIEW is 'index' and Conf['JSON Navigation'] and g.BOARD.ID isnt 'f' + g.VIEW is 'index' and Conf['JSON Index'] and g.BOARD.ID isnt 'f' ) @flush() $.on d, 'visibilitychange ThreadUpdate', @flush diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 8f591165d..28ac1e682 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -41,7 +41,7 @@ ThreadWatcher = ThreadWatcher.fetchAuto() - if g.VIEW is 'index' and Conf['JSON Navigation'] and Conf['Menu'] and g.BOARD.ID isnt 'f' + if g.VIEW is 'index' and Conf['JSON Index'] and Conf['Menu'] and g.BOARD.ID isnt 'f' Menu.menu.addEntry el: $.el 'a', href: 'javascript:;'