diff --git a/CHANGELOG.md b/CHANGELOG.md index 26df90f25..a1bfb5aaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ -## v2.8.0 -*2014-01-11* +**seaweeedchan**: +- Turn infinite scrolling into new index mode +**Zixaphir**: +- Fix an issue where changing the current archive would crash the redirect features. + +*2014-01-11* **seaweedchan**: - Various fixes and improvements for the JSONified index diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js deleted file mode 100755 index 37469de03..000000000 --- a/builds/4chan-X.meta.js +++ /dev/null @@ -1,21 +0,0 @@ -// ==UserScript== -// @name 4chan X -// @version 1.3.0 -// @minGMVer 1.13 -// @minFFVer 26 -// @namespace 4chan-X -// @description Cross-browser userscript for maximum lurking on 4chan. -// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE -// @match *://boards.4chan.org/* -// @match *://sys.4chan.org/* -// @match *://a.4cdn.org/* -// @match *://i.4cdn.org/* -// @grant GM_getValue -// @grant GM_setValue -// @grant GM_deleteValue -// @grant GM_openInTab -// @run-at document-start -// @updateURL https://github.com/seaweedchan/4chan-x/raw/stable/builds/4chan-X.meta.js -// @downloadURL https://github.com/seaweedchan/4chan-x/raw/stable/builds/4chan-X.user.js -// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC -// ==/UserScript== diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 653b70adc..0abfdff5a 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -4470,6 +4470,10 @@ el: $.el('label', { innerHTML: ' Paged' }) + }, { + el: $.el('label', { + innerHTML: ' Infinite scrolling' + }) }, { el: $.el('label', { innerHTML: ' All threads' @@ -4614,7 +4618,7 @@ }, scroll: $.debounce(100, function() { var nodes, nodesPerPage, pageNum; - if (Index.req || Conf['Index Mode'] !== 'paged' || (doc.scrollTop <= doc.scrollHeight - (300 + window.innerHeight)) || g.VIEW === 'thread') { + if (Index.req || Conf['Index Mode'] !== 'infinite' || ((d.body.scrollTop || doc.scrollTop) <= doc.scrollHeight - (300 + window.innerHeight)) || g.VIEW === 'thread') { return; } pageNum = Index.getCurrentPage() + 1; @@ -4696,7 +4700,7 @@ return +window.location.pathname.split('/')[2]; }, userPageNav: function(pageNum) { - if (Conf['Refreshed Navigation'] && Conf['Index Mode'] === 'paged') { + if (Conf['Refreshed Navigation'] && Conf['Index Mode'] !== 'all pages') { return Index.update(pageNum); } else { return Index.pageNav(pageNum); @@ -4711,7 +4715,7 @@ }, pageLoad: function(pageNum) { Index.currentPage = pageNum; - if (Conf['Index Mode'] !== 'paged') { + if (Conf['Index Mode'] === 'all pages') { return; } Index.buildIndex(); @@ -4729,7 +4733,7 @@ return Math.max(0, Index.getPagesNum() - 1); }, togglePagelist: function() { - return Index.pagelist.hidden = Conf['Index Mode'] !== 'paged'; + return Index.pagelist.hidden = Conf['Index Mode'] === 'all pages'; }, buildPagelist: function() { var a, i, maxPageNum, nodes, pagesRoot, _i; @@ -5049,7 +5053,7 @@ }, buildIndex: function() { var nodes, nodesPerPage, pageNum; - if (Conf['Index Mode'] === 'paged') { + if (Conf['Index Mode'] !== 'all pages') { pageNum = Index.getCurrentPage(); nodesPerPage = Index.threadsNumPerPage * 2; nodes = Index.sortedNodes.slice(nodesPerPage * pageNum, nodesPerPage * (pageNum + 1)); @@ -5086,7 +5090,7 @@ Index.searchInput.removeAttribute('data-searching'); } Index.sort(); - if (Conf['Index Mode'] === 'paged') { + if (Conf['Index Mode'] !== 'all pages') { pageNum = Math.min(pageNum, Index.getMaxPageNum()); } Index.buildPagelist(); @@ -15102,13 +15106,13 @@ $.open("/" + g.BOARD + "/"); break; case Conf['Next page']: - if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { + if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) { return; } $('.next button', Index.pagelist).click(); break; case Conf['Previous page']: - if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { + if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) { return; } $('.prev button', Index.pagelist).click(); diff --git a/builds/crx/script.js b/builds/crx/script.js index f97317ee2..83bdf7610 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -4481,6 +4481,10 @@ el: $.el('label', { innerHTML: ' Paged' }) + }, { + el: $.el('label', { + innerHTML: ' Infinite scrolling' + }) }, { el: $.el('label', { innerHTML: ' All threads' @@ -4625,7 +4629,7 @@ }, scroll: $.debounce(100, function() { var nodes, nodesPerPage, pageNum; - if (Index.req || Conf['Index Mode'] !== 'paged' || (doc.scrollTop <= doc.scrollHeight - (300 + window.innerHeight)) || g.VIEW === 'thread') { + if (Index.req || Conf['Index Mode'] !== 'infinite' || ((d.body.scrollTop || doc.scrollTop) <= doc.scrollHeight - (300 + window.innerHeight)) || g.VIEW === 'thread') { return; } pageNum = Index.getCurrentPage() + 1; @@ -4707,7 +4711,7 @@ return +window.location.pathname.split('/')[2]; }, userPageNav: function(pageNum) { - if (Conf['Refreshed Navigation'] && Conf['Index Mode'] === 'paged') { + if (Conf['Refreshed Navigation'] && Conf['Index Mode'] !== 'all pages') { return Index.update(pageNum); } else { return Index.pageNav(pageNum); @@ -4722,7 +4726,7 @@ }, pageLoad: function(pageNum) { Index.currentPage = pageNum; - if (Conf['Index Mode'] !== 'paged') { + if (Conf['Index Mode'] === 'all pages') { return; } Index.buildIndex(); @@ -4740,7 +4744,7 @@ return Math.max(0, Index.getPagesNum() - 1); }, togglePagelist: function() { - return Index.pagelist.hidden = Conf['Index Mode'] !== 'paged'; + return Index.pagelist.hidden = Conf['Index Mode'] === 'all pages'; }, buildPagelist: function() { var a, i, maxPageNum, nodes, pagesRoot, _i; @@ -5060,7 +5064,7 @@ }, buildIndex: function() { var nodes, nodesPerPage, pageNum; - if (Conf['Index Mode'] === 'paged') { + if (Conf['Index Mode'] !== 'all pages') { pageNum = Index.getCurrentPage(); nodesPerPage = Index.threadsNumPerPage * 2; nodes = Index.sortedNodes.slice(nodesPerPage * pageNum, nodesPerPage * (pageNum + 1)); @@ -5097,7 +5101,7 @@ delete Index.searchInput.dataset.searching; } Index.sort(); - if (Conf['Index Mode'] === 'paged') { + if (Conf['Index Mode'] !== 'all pages') { pageNum = Math.min(pageNum, Index.getMaxPageNum()); } Index.buildPagelist(); @@ -15098,13 +15102,13 @@ $.open("/" + g.BOARD + "/"); break; case Conf['Next page']: - if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { + if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) { return; } $('.next button', Index.pagelist).click(); break; case Conf['Previous page']: - if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { + if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) { return; } $('.prev button', Index.pagelist).click(); diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 137711e4e..034fe6757 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -14,6 +14,7 @@ Index = el: $.el 'span', textContent: 'Index mode' subEntries: [ { el: $.el 'label', innerHTML: ' Paged' } + { el: $.el 'label', innerHTML: ' Infinite scrolling' } { el: $.el 'label', innerHTML: ' All threads' } ] for label in modeEntry.subEntries @@ -109,7 +110,7 @@ Index = $.after $.id('delform'), Index.pagelist scroll: $.debounce 100, -> - return if Index.req or Conf['Index Mode'] isnt 'paged' or (doc.scrollTop <= doc.scrollHeight - (300 + window.innerHeight)) or g.VIEW is 'thread' + return if Index.req or Conf['Index Mode'] isnt 'infinite' or ((d.body.scrollTop or doc.scrollTop) <= doc.scrollHeight - (300 + window.innerHeight)) or g.VIEW is 'thread' pageNum = Index.getCurrentPage() + 1 return Index.endNotice() if pageNum >= Index.pagesNum nodesPerPage = Index.threadsNumPerPage * 2 @@ -163,7 +164,7 @@ Index = getCurrentPage: -> +window.location.pathname.split('/')[2] userPageNav: (pageNum) -> - if Conf['Refreshed Navigation'] and Conf['Index Mode'] is 'paged' + if Conf['Refreshed Navigation'] and Conf['Index Mode'] isnt 'all pages' Index.update pageNum else Index.pageNav pageNum @@ -173,7 +174,7 @@ Index = Index.pageLoad pageNum pageLoad: (pageNum) -> Index.currentPage = pageNum - return if Conf['Index Mode'] isnt 'paged' + return if Conf['Index Mode'] is 'all pages' Index.buildIndex() Index.setPage() Index.scrollToIndex() @@ -186,7 +187,7 @@ Index = getMaxPageNum: -> Math.max 0, Index.getPagesNum() - 1 togglePagelist: -> - Index.pagelist.hidden = Conf['Index Mode'] isnt 'paged' + Index.pagelist.hidden = Conf['Index Mode'] is 'all pages' buildPagelist: -> pagesRoot = $ '.pages', Index.pagelist maxPageNum = Index.getMaxPageNum() @@ -406,7 +407,7 @@ Index = return buildIndex: -> - if Conf['Index Mode'] is 'paged' + if Conf['Index Mode'] isnt 'all pages' pageNum = Index.getCurrentPage() nodesPerPage = Index.threadsNumPerPage * 2 nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)] @@ -444,7 +445,7 @@ Index = <% } %> Index.sort() # Go to the last available page if we were past the limit. - pageNum = Math.min pageNum, Index.getMaxPageNum() if Conf['Index Mode'] is 'paged' + pageNum = Math.min pageNum, Index.getMaxPageNum() if Conf['Index Mode'] isnt 'all pages' Index.buildPagelist() if Index.currentPage is pageNum Index.buildIndex() diff --git a/src/General/css/burichan.css b/src/General/css/burichan.css index 976a043bc..8f4350347 100755 --- a/src/General/css/burichan.css +++ b/src/General/css/burichan.css @@ -18,10 +18,10 @@ :root.burichan #header-bar a, :root.burichan #header-bar #notifications a { color: #34345C; } -:root.burichan #custom-board-list .current { +:root.burichan.fixed #custom-board-list .current { border-bottom: 1px solid rgba(30, 30, 255, 0.2); } -:root.burichan #custom-board-list .current:hover { +:root.burichan.fixed #custom-board-list .current:hover { border-bottom-color: rgba(255,0,0,0.2); } diff --git a/src/General/css/futaba.css b/src/General/css/futaba.css index b50e52f11..845d948b2 100755 --- a/src/General/css/futaba.css +++ b/src/General/css/futaba.css @@ -18,10 +18,10 @@ :root.futaba #header-bar a, :root.futaba #notifications a { color: #800000; } -:root.futaba #custom-board-list a.current { +:root.futaba.fixed #custom-board-list a.current { border-bottom: 1px solid rgba(178,0,0,0.2); } -:root.futaba #custom-board-list .current:hover { +:root.futaba.fixed #custom-board-list .current:hover { border-bottom-color: rgba(255,0,0,0.2); } diff --git a/src/General/css/photon.css b/src/General/css/photon.css index 709166bae..0feb8a3ec 100755 --- a/src/General/css/photon.css +++ b/src/General/css/photon.css @@ -18,10 +18,10 @@ :root.photon #header-bar a, :root.photon #notifications a { color: #FF6600; } -:root.photon #custom-board-list a.current { +:root.photon.fixed #custom-board-list a.current { border-bottom: 1px solid rgba(0,74,153,0.2); } -:root.photon #custom-board-list .current:hover { +:root.photon.fixed #custom-board-list .current:hover { border-bottom-color: rgba(255,51,0,0.2); } diff --git a/src/General/css/style.css b/src/General/css/style.css index 4f9708b58..0dfb44d7d 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -164,6 +164,8 @@ div.center:not(.ad-cnt) { #header-bar { border-width: 0; transition: all .1s .05s ease-in-out; +} +:root.fixed #header-bar { box-shadow: -5px 1px 10px rgba(0, 0, 0, 0.20); } #custom-board-list .current { diff --git a/src/General/css/tomorrow.css b/src/General/css/tomorrow.css index 3acd7d4ca..3485475f6 100755 --- a/src/General/css/tomorrow.css +++ b/src/General/css/tomorrow.css @@ -15,10 +15,10 @@ :root.tomorrow #header-bar a, :root.tomorrow #notifications a { color: #81A2BE; } -:root.tomorrow #custom-board-list a.current { +:root.tomorrow.fixed #custom-board-list a.current { border-bottom: 1px solid rgba(83,124,160,0.4); } -:root.tomorrow #custom-board-list .current:hover { +:root.tomorrow.fixed #custom-board-list .current:hover { border-bottom-color: rgba(95,137,172,0.4); } diff --git a/src/General/css/yotsuba-b.css b/src/General/css/yotsuba-b.css index 2301743ef..c3cf4c8ee 100755 --- a/src/General/css/yotsuba-b.css +++ b/src/General/css/yotsuba-b.css @@ -18,10 +18,10 @@ :root.yotsuba-b #board-list a, :root.yotsuba-b #shortcuts a { color: #34345C; } -:root.yotsuba-b #custom-board-list .current { +:root.yotsuba-b.fixed #custom-board-list .current { border-bottom: 1px solid rgba(30, 30, 255, 0.2); } -:root.yotsuba-b #custom-board-list .current:hover { +:root.yotsuba-b.fixed #custom-board-list .current:hover { border-bottom-color: rgba(255,0,0,0.2); } diff --git a/src/General/css/yotsuba.css b/src/General/css/yotsuba.css index cd88892e8..0fd7b1c82 100755 --- a/src/General/css/yotsuba.css +++ b/src/General/css/yotsuba.css @@ -18,10 +18,10 @@ :root.yotsuba #board-list a, :root.yotsuba #shortcuts a { color: #800000; } -:root.yotsuba #custom-board-list a.current { +:root.yotsuba.fixed #custom-board-list a.current { border-bottom: 1px solid rgba(178,0,0,0.2); } -:root.yotsuba #custom-board-list .current:hover { +:root.yotsuba.fixed #custom-board-list .current:hover { border-bottom-color: rgba(255,0,0,0.2); } diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 18e59f2ed..ca385b223 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -97,10 +97,10 @@ Keybinds = when Conf['Open front page'] $.open "/#{g.BOARD}/" when Conf['Next page'] - return unless g.VIEW is 'index' and Conf['Index Mode'] is 'paged' + return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'all pages' $('.next button', Index.pagelist).click() when Conf['Previous page'] - return unless g.VIEW is 'index' and Conf['Index Mode'] is 'paged' + return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'all pages' $('.prev button', Index.pagelist).click() when Conf['Search form'] Index.searchInput.focus()