Merge branch 'v3'

Conflicts:
	CHANGELOG.md
	LICENSE
	builds/appchan-x.user.js
	builds/crx/manifest.json
	builds/crx/script.js
	latest.js
	package.json
This commit is contained in:
Zixaphir 2014-01-12 14:56:32 -07:00
commit aa48ee519c
13 changed files with 53 additions and 59 deletions

View File

@ -1,6 +1,10 @@
## v2.8.0 **seaweeedchan**:
*2014-01-11* - 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**: **seaweedchan**:
- Various fixes and improvements for the JSONified index - Various fixes and improvements for the JSONified index

View File

@ -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==

View File

@ -4470,6 +4470,10 @@
el: $.el('label', { el: $.el('label', {
innerHTML: '<input type=radio name="Index Mode" value="paged"> Paged' innerHTML: '<input type=radio name="Index Mode" value="paged"> Paged'
}) })
}, {
el: $.el('label', {
innerHTML: '<input type=radio name="Index Mode" value="infinite"> Infinite scrolling'
})
}, { }, {
el: $.el('label', { el: $.el('label', {
innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads' innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads'
@ -4614,7 +4618,7 @@
}, },
scroll: $.debounce(100, function() { scroll: $.debounce(100, function() {
var nodes, nodesPerPage, pageNum; 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; return;
} }
pageNum = Index.getCurrentPage() + 1; pageNum = Index.getCurrentPage() + 1;
@ -4696,7 +4700,7 @@
return +window.location.pathname.split('/')[2]; return +window.location.pathname.split('/')[2];
}, },
userPageNav: function(pageNum) { userPageNav: function(pageNum) {
if (Conf['Refreshed Navigation'] && Conf['Index Mode'] === 'paged') { if (Conf['Refreshed Navigation'] && Conf['Index Mode'] !== 'all pages') {
return Index.update(pageNum); return Index.update(pageNum);
} else { } else {
return Index.pageNav(pageNum); return Index.pageNav(pageNum);
@ -4711,7 +4715,7 @@
}, },
pageLoad: function(pageNum) { pageLoad: function(pageNum) {
Index.currentPage = pageNum; Index.currentPage = pageNum;
if (Conf['Index Mode'] !== 'paged') { if (Conf['Index Mode'] === 'all pages') {
return; return;
} }
Index.buildIndex(); Index.buildIndex();
@ -4729,7 +4733,7 @@
return Math.max(0, Index.getPagesNum() - 1); return Math.max(0, Index.getPagesNum() - 1);
}, },
togglePagelist: function() { togglePagelist: function() {
return Index.pagelist.hidden = Conf['Index Mode'] !== 'paged'; return Index.pagelist.hidden = Conf['Index Mode'] === 'all pages';
}, },
buildPagelist: function() { buildPagelist: function() {
var a, i, maxPageNum, nodes, pagesRoot, _i; var a, i, maxPageNum, nodes, pagesRoot, _i;
@ -5049,7 +5053,7 @@
}, },
buildIndex: function() { buildIndex: function() {
var nodes, nodesPerPage, pageNum; var nodes, nodesPerPage, pageNum;
if (Conf['Index Mode'] === 'paged') { if (Conf['Index Mode'] !== 'all pages') {
pageNum = Index.getCurrentPage(); pageNum = Index.getCurrentPage();
nodesPerPage = Index.threadsNumPerPage * 2; nodesPerPage = Index.threadsNumPerPage * 2;
nodes = Index.sortedNodes.slice(nodesPerPage * pageNum, nodesPerPage * (pageNum + 1)); nodes = Index.sortedNodes.slice(nodesPerPage * pageNum, nodesPerPage * (pageNum + 1));
@ -5086,7 +5090,7 @@
Index.searchInput.removeAttribute('data-searching'); Index.searchInput.removeAttribute('data-searching');
} }
Index.sort(); Index.sort();
if (Conf['Index Mode'] === 'paged') { if (Conf['Index Mode'] !== 'all pages') {
pageNum = Math.min(pageNum, Index.getMaxPageNum()); pageNum = Math.min(pageNum, Index.getMaxPageNum());
} }
Index.buildPagelist(); Index.buildPagelist();
@ -15102,13 +15106,13 @@
$.open("/" + g.BOARD + "/"); $.open("/" + g.BOARD + "/");
break; break;
case Conf['Next page']: case Conf['Next page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
return; return;
} }
$('.next button', Index.pagelist).click(); $('.next button', Index.pagelist).click();
break; break;
case Conf['Previous page']: case Conf['Previous page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
return; return;
} }
$('.prev button', Index.pagelist).click(); $('.prev button', Index.pagelist).click();

View File

@ -4481,6 +4481,10 @@
el: $.el('label', { el: $.el('label', {
innerHTML: '<input type=radio name="Index Mode" value="paged"> Paged' innerHTML: '<input type=radio name="Index Mode" value="paged"> Paged'
}) })
}, {
el: $.el('label', {
innerHTML: '<input type=radio name="Index Mode" value="infinite"> Infinite scrolling'
})
}, { }, {
el: $.el('label', { el: $.el('label', {
innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads' innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads'
@ -4625,7 +4629,7 @@
}, },
scroll: $.debounce(100, function() { scroll: $.debounce(100, function() {
var nodes, nodesPerPage, pageNum; 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; return;
} }
pageNum = Index.getCurrentPage() + 1; pageNum = Index.getCurrentPage() + 1;
@ -4707,7 +4711,7 @@
return +window.location.pathname.split('/')[2]; return +window.location.pathname.split('/')[2];
}, },
userPageNav: function(pageNum) { userPageNav: function(pageNum) {
if (Conf['Refreshed Navigation'] && Conf['Index Mode'] === 'paged') { if (Conf['Refreshed Navigation'] && Conf['Index Mode'] !== 'all pages') {
return Index.update(pageNum); return Index.update(pageNum);
} else { } else {
return Index.pageNav(pageNum); return Index.pageNav(pageNum);
@ -4722,7 +4726,7 @@
}, },
pageLoad: function(pageNum) { pageLoad: function(pageNum) {
Index.currentPage = pageNum; Index.currentPage = pageNum;
if (Conf['Index Mode'] !== 'paged') { if (Conf['Index Mode'] === 'all pages') {
return; return;
} }
Index.buildIndex(); Index.buildIndex();
@ -4740,7 +4744,7 @@
return Math.max(0, Index.getPagesNum() - 1); return Math.max(0, Index.getPagesNum() - 1);
}, },
togglePagelist: function() { togglePagelist: function() {
return Index.pagelist.hidden = Conf['Index Mode'] !== 'paged'; return Index.pagelist.hidden = Conf['Index Mode'] === 'all pages';
}, },
buildPagelist: function() { buildPagelist: function() {
var a, i, maxPageNum, nodes, pagesRoot, _i; var a, i, maxPageNum, nodes, pagesRoot, _i;
@ -5060,7 +5064,7 @@
}, },
buildIndex: function() { buildIndex: function() {
var nodes, nodesPerPage, pageNum; var nodes, nodesPerPage, pageNum;
if (Conf['Index Mode'] === 'paged') { if (Conf['Index Mode'] !== 'all pages') {
pageNum = Index.getCurrentPage(); pageNum = Index.getCurrentPage();
nodesPerPage = Index.threadsNumPerPage * 2; nodesPerPage = Index.threadsNumPerPage * 2;
nodes = Index.sortedNodes.slice(nodesPerPage * pageNum, nodesPerPage * (pageNum + 1)); nodes = Index.sortedNodes.slice(nodesPerPage * pageNum, nodesPerPage * (pageNum + 1));
@ -5097,7 +5101,7 @@
delete Index.searchInput.dataset.searching; delete Index.searchInput.dataset.searching;
} }
Index.sort(); Index.sort();
if (Conf['Index Mode'] === 'paged') { if (Conf['Index Mode'] !== 'all pages') {
pageNum = Math.min(pageNum, Index.getMaxPageNum()); pageNum = Math.min(pageNum, Index.getMaxPageNum());
} }
Index.buildPagelist(); Index.buildPagelist();
@ -15098,13 +15102,13 @@
$.open("/" + g.BOARD + "/"); $.open("/" + g.BOARD + "/");
break; break;
case Conf['Next page']: case Conf['Next page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
return; return;
} }
$('.next button', Index.pagelist).click(); $('.next button', Index.pagelist).click();
break; break;
case Conf['Previous page']: case Conf['Previous page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] === 'paged')) { if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
return; return;
} }
$('.prev button', Index.pagelist).click(); $('.prev button', Index.pagelist).click();

View File

@ -14,6 +14,7 @@ Index =
el: $.el 'span', textContent: 'Index mode' el: $.el 'span', textContent: 'Index mode'
subEntries: [ subEntries: [
{ el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="paged"> Paged' } { el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="paged"> Paged' }
{ el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="infinite"> Infinite scrolling' }
{ el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads' } { el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads' }
] ]
for label in modeEntry.subEntries for label in modeEntry.subEntries
@ -109,7 +110,7 @@ Index =
$.after $.id('delform'), Index.pagelist $.after $.id('delform'), Index.pagelist
scroll: $.debounce 100, -> 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 pageNum = Index.getCurrentPage() + 1
return Index.endNotice() if pageNum >= Index.pagesNum return Index.endNotice() if pageNum >= Index.pagesNum
nodesPerPage = Index.threadsNumPerPage * 2 nodesPerPage = Index.threadsNumPerPage * 2
@ -163,7 +164,7 @@ Index =
getCurrentPage: -> getCurrentPage: ->
+window.location.pathname.split('/')[2] +window.location.pathname.split('/')[2]
userPageNav: (pageNum) -> 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 Index.update pageNum
else else
Index.pageNav pageNum Index.pageNav pageNum
@ -173,7 +174,7 @@ Index =
Index.pageLoad pageNum Index.pageLoad pageNum
pageLoad: (pageNum) -> pageLoad: (pageNum) ->
Index.currentPage = pageNum Index.currentPage = pageNum
return if Conf['Index Mode'] isnt 'paged' return if Conf['Index Mode'] is 'all pages'
Index.buildIndex() Index.buildIndex()
Index.setPage() Index.setPage()
Index.scrollToIndex() Index.scrollToIndex()
@ -186,7 +187,7 @@ Index =
getMaxPageNum: -> getMaxPageNum: ->
Math.max 0, Index.getPagesNum() - 1 Math.max 0, Index.getPagesNum() - 1
togglePagelist: -> togglePagelist: ->
Index.pagelist.hidden = Conf['Index Mode'] isnt 'paged' Index.pagelist.hidden = Conf['Index Mode'] is 'all pages'
buildPagelist: -> buildPagelist: ->
pagesRoot = $ '.pages', Index.pagelist pagesRoot = $ '.pages', Index.pagelist
maxPageNum = Index.getMaxPageNum() maxPageNum = Index.getMaxPageNum()
@ -406,7 +407,7 @@ Index =
return return
buildIndex: -> buildIndex: ->
if Conf['Index Mode'] is 'paged' if Conf['Index Mode'] isnt 'all pages'
pageNum = Index.getCurrentPage() pageNum = Index.getCurrentPage()
nodesPerPage = Index.threadsNumPerPage * 2 nodesPerPage = Index.threadsNumPerPage * 2
nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)] nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)]
@ -444,7 +445,7 @@ Index =
<% } %> <% } %>
Index.sort() Index.sort()
# Go to the last available page if we were past the limit. # 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() Index.buildPagelist()
if Index.currentPage is pageNum if Index.currentPage is pageNum
Index.buildIndex() Index.buildIndex()

View File

@ -18,10 +18,10 @@
:root.burichan #header-bar a, :root.burichan #header-bar #notifications a { :root.burichan #header-bar a, :root.burichan #header-bar #notifications a {
color: #34345C; 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); 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); border-bottom-color: rgba(255,0,0,0.2);
} }

View File

@ -18,10 +18,10 @@
:root.futaba #header-bar a, :root.futaba #notifications a { :root.futaba #header-bar a, :root.futaba #notifications a {
color: #800000; 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); 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); border-bottom-color: rgba(255,0,0,0.2);
} }

View File

@ -18,10 +18,10 @@
:root.photon #header-bar a, :root.photon #notifications a { :root.photon #header-bar a, :root.photon #notifications a {
color: #FF6600; 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); 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); border-bottom-color: rgba(255,51,0,0.2);
} }

View File

@ -164,6 +164,8 @@ div.center:not(.ad-cnt) {
#header-bar { #header-bar {
border-width: 0; border-width: 0;
transition: all .1s .05s ease-in-out; transition: all .1s .05s ease-in-out;
}
:root.fixed #header-bar {
box-shadow: -5px 1px 10px rgba(0, 0, 0, 0.20); box-shadow: -5px 1px 10px rgba(0, 0, 0, 0.20);
} }
#custom-board-list .current { #custom-board-list .current {

View File

@ -15,10 +15,10 @@
:root.tomorrow #header-bar a, :root.tomorrow #notifications a { :root.tomorrow #header-bar a, :root.tomorrow #notifications a {
color: #81A2BE; 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); 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); border-bottom-color: rgba(95,137,172,0.4);
} }

View File

@ -18,10 +18,10 @@
:root.yotsuba-b #board-list a, :root.yotsuba-b #shortcuts a { :root.yotsuba-b #board-list a, :root.yotsuba-b #shortcuts a {
color: #34345C; 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); 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); border-bottom-color: rgba(255,0,0,0.2);
} }

View File

@ -18,10 +18,10 @@
:root.yotsuba #board-list a, :root.yotsuba #shortcuts a { :root.yotsuba #board-list a, :root.yotsuba #shortcuts a {
color: #800000; 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); 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); border-bottom-color: rgba(255,0,0,0.2);
} }

View File

@ -97,10 +97,10 @@ Keybinds =
when Conf['Open front page'] when Conf['Open front page']
$.open "/#{g.BOARD}/" $.open "/#{g.BOARD}/"
when Conf['Next page'] 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() $('.next button', Index.pagelist).click()
when Conf['Previous page'] 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() $('.prev button', Index.pagelist).click()
when Conf['Search form'] when Conf['Search form']
Index.searchInput.focus() Index.searchInput.focus()