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
*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

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', {
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'
@ -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();

View File

@ -4481,6 +4481,10 @@
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'
@ -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();

View File

@ -14,6 +14,7 @@ Index =
el: $.el 'span', textContent: 'Index mode'
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="infinite"> Infinite scrolling' }
{ el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="all pages"> 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()

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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()