Fix Navigate.navigate click event being applied to every anchor

... on the entire page.

Thanks #boardNavDesktopFoot.
This commit is contained in:
Zixaphir 2015-01-13 10:12:49 -07:00
parent 41050f516f
commit 9d45b0e5c5
5 changed files with 29 additions and 22 deletions

View File

@ -4388,7 +4388,7 @@
Header = {
init: function() {
var barFixedToggler, barPositionToggler, box, customNavToggler, editCustomNav, headerToggler, menuButton, scrollHeaderToggler;
var barFixedToggler, barPositionToggler, box, customNavToggler, editCustomNav, footer, headerToggler, menuButton, scrollHeaderToggler;
this.menu = new UI.Menu('header');
menuButton = $.el('a', {
className: 'menu-button a-icon',
@ -4464,9 +4464,12 @@
return _this.setBarPosition(Conf['Bottom Header']);
};
})(this));
return $.ready(function() {
var a, footer, _i, _len, _ref, _results;
if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) {
footer = null;
return $.asap((function() {
return footer = $.id('boardNavDesktopFoot');
}), function() {
var a, _i, _len, _ref, _results;
if (a = $("a[href*='/" + g.BOARD + "/']", footer)) {
a.className = 'current';
}
if (Conf['JSON Navigation']) {
@ -5965,10 +5968,10 @@
switch (Conf['Index Mode']) {
case 'paged':
case 'infinite':
pageNum = Index.getCurrentPage() - 1;
pageNum = Index.getCurrentPage();
threadsPerPage = Index.getThreadsNumPerPage();
threads = [];
i = threadsPerPage * pageNum;
i = threadsPerPage * (pageNum - 1);
max = i + threadsPerPage;
while (i < max && (thread = sortedThreads[i++])) {
threads.push(thread);
@ -5976,7 +5979,7 @@
Index.buildReplies(thread);
}
Index.buildPagelist();
Index.setPage();
Index.setPage(pageNum);
break;
case 'catalog':
nodes = Index.buildCatalogViews();
@ -18476,7 +18479,7 @@
if (!(g.VIEW === 'thread' && this.thread.ID === g.THREADID)) {
$.on($('a[title="Link to this post"]', this.nodes.info), 'click', Navigate.navigate);
}
if (!(linktype = Conf['Quote Inlining'] && Conf['Quote Hash Navigation'] ? '.hashlink' : !Conf['Quote Inlining'] ? '.quotelink' : null)) {
if (!(linktype = Conf['Quote Inlining'] && Conf['Quote Hash Navigation'] ? '.hashlink' : !Conf['Quote Inlining'] ? '.quotelink' : false)) {
return;
}
return Navigate.quoteLink($$(linktype, this.nodes.comment));

View File

@ -4406,7 +4406,7 @@
Header = {
init: function() {
var barFixedToggler, barPositionToggler, box, customNavToggler, editCustomNav, headerToggler, menuButton, scrollHeaderToggler;
var barFixedToggler, barPositionToggler, box, customNavToggler, editCustomNav, footer, headerToggler, menuButton, scrollHeaderToggler;
this.menu = new UI.Menu('header');
menuButton = $.el('a', {
className: 'menu-button a-icon',
@ -4482,9 +4482,12 @@
return _this.setBarPosition(Conf['Bottom Header']);
};
})(this));
return $.ready(function() {
var a, footer, _i, _len, _ref, _results;
if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) {
footer = null;
return $.asap((function() {
return footer = $.id('boardNavDesktopFoot');
}), function() {
var a, _i, _len, _ref, _results;
if (a = $("a[href*='/" + g.BOARD + "/']", footer)) {
a.className = 'current';
}
if (Conf['JSON Navigation']) {
@ -5983,10 +5986,10 @@
switch (Conf['Index Mode']) {
case 'paged':
case 'infinite':
pageNum = Index.getCurrentPage() - 1;
pageNum = Index.getCurrentPage();
threadsPerPage = Index.getThreadsNumPerPage();
threads = [];
i = threadsPerPage * pageNum;
i = threadsPerPage * (pageNum - 1);
max = i + threadsPerPage;
while (i < max && (thread = sortedThreads[i++])) {
threads.push(thread);
@ -5994,7 +5997,7 @@
Index.buildReplies(thread);
}
Index.buildPagelist();
Index.setPage();
Index.setPage(pageNum);
break;
case 'catalog':
nodes = Index.buildCatalogViews();
@ -18502,7 +18505,7 @@
if (!(g.VIEW === 'thread' && this.thread.ID === g.THREADID)) {
$.on($('a[title="Link to this post"]', this.nodes.info), 'click', Navigate.navigate);
}
if (!(linktype = Conf['Quote Inlining'] && Conf['Quote Hash Navigation'] ? '.hashlink' : !Conf['Quote Inlining'] ? '.quotelink' : null)) {
if (!(linktype = Conf['Quote Inlining'] && Conf['Quote Hash Navigation'] ? '.hashlink' : !Conf['Quote Inlining'] ? '.quotelink' : false)) {
return;
}
return Navigate.quoteLink($$(linktype, this.nodes.comment));

View File

@ -76,8 +76,9 @@ Header =
$.add d.body, @hover
@setBarPosition Conf['Bottom Header']
$.ready ->
if a = $ "a[href*='/#{g.BOARD}/']", footer = $.id 'boardNavDesktopFoot'
footer = null
$.asap (-> footer = $.id 'boardNavDesktopFoot' ), ->
if a = $ "a[href*='/#{g.BOARD}/']", footer
a.className = 'current'
if Conf['JSON Navigation']
$.on a, 'click', Navigate.navigate for a in $$ 'a', footer

View File

@ -790,11 +790,11 @@ Index =
nodes = []
switch Conf['Index Mode']
when 'paged', 'infinite'
pageNum = Index.getCurrentPage() - 1
pageNum = Index.getCurrentPage()
threadsPerPage = Index.getThreadsNumPerPage()
threads = []
i = threadsPerPage * pageNum
i = threadsPerPage * (pageNum - 1)
max = i + threadsPerPage
while i < max and thread = sortedThreads[i++]
threads.push thread
@ -802,7 +802,7 @@ Index =
Index.buildReplies thread
Index.buildPagelist()
Index.setPage()
Index.setPage pageNum
when 'catalog'
nodes = Index.buildCatalogViews()

View File

@ -46,7 +46,7 @@ Navigate =
else if !Conf['Quote Inlining']
'.quotelink'
else
null
false
)
Navigate.quoteLink $$ linktype, @nodes.comment