diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js
index 519d47d44..8a3e05bf7 100644
--- a/builds/appchan-x.user.js
+++ b/builds/appchan-x.user.js
@@ -4036,7 +4036,7 @@
$.on(d, 'CreateNotification', this.createNotification);
this.enableDesktopNotifications();
this.addShortcut(menuButton, true);
- return $.asap((function() {
+ $.asap((function() {
return d.body;
}), function() {
if (!Main.isThisPageLegit()) {
@@ -4049,6 +4049,13 @@
$.add(d.body, Header.hover);
return _this.setBarPosition(Conf['Bottom Header']);
});
+ return $.ready(function() {
+ var a;
+ if (a = $("a[href*='/" + g.BOARD + "/']", $.id('boardNavDesktopFoot'))) {
+ a.className = 'current';
+ return $.on(a, 'click', Index.cb.link);
+ }
+ });
},
bar: $.el('div', {
id: 'header-bar'
@@ -4071,13 +4078,14 @@
setBoardList: function() {
var a, boardList, btn, fourchannav, fullBoardList, shortcuts;
fourchannav = $.id('boardNavDesktop');
- if (a = $("a[href*='/" + g.BOARD + "/']", fourchannav)) {
- a.className = 'current';
- }
boardList = $.el('span', {
id: 'board-list',
innerHTML: " - " + fourchannav.innerHTML + ""
});
+ if (a = $("a[href*='/" + g.BOARD + "/']", boardList)) {
+ a.className = 'current';
+ $.on(a, 'click', Index.cb.link);
+ }
fullBoardList = $('#full-board-list', boardList);
btn = $('.hide-board-list-button', fullBoardList);
$.on(btn, 'click', Header.toggleBoardList);
@@ -4103,7 +4111,7 @@
}
as = $$('#full-board-list a[title]', Header.bar);
nodes = text.match(/[\w@]+((-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+")|\,"[^"]+[^"]"))*|[^\w@]+/g).map(function(t) {
- var a, board, m, _i, _len;
+ var a, board, current, m, _i, _len;
if (/^[^\w@]/.test(t)) {
return $.tn(t);
}
@@ -4129,7 +4137,11 @@
a = as[_i];
if (a.textContent === board) {
a = a.cloneNode(true);
- a.textContent = /-title/.test(t) || /-replace/.test(t) && $.hasClass(a, 'current') ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent;
+ current = $.hasClass(a, 'current');
+ if (current) {
+ $.on(a, 'click', Index.cb.link);
+ }
+ a.textContent = /-title/.test(t) || /-replace/.test(t) && current ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent;
if (m = t.match(/-(index|catalog)/)) {
a.dataset.only = m[1];
a.href = "//boards.4chan.org/" + board + "/";
@@ -4546,6 +4558,13 @@
}
e.preventDefault();
return Index.userPageNav(+a.pathname.split('/')[2]);
+ },
+ link: function(e) {
+ if (g.VIEW !== 'index' || /catalog/.test(this.href)) {
+ return;
+ }
+ e.preventDefault();
+ return Index.update();
}
},
scrollToIndex: function() {
diff --git a/builds/crx/script.js b/builds/crx/script.js
index 658796444..b8ebe4ebb 100644
--- a/builds/crx/script.js
+++ b/builds/crx/script.js
@@ -4047,7 +4047,7 @@
$.on(d, 'CreateNotification', this.createNotification);
this.enableDesktopNotifications();
this.addShortcut(menuButton, true);
- return $.asap((function() {
+ $.asap((function() {
return d.body;
}), function() {
if (!Main.isThisPageLegit()) {
@@ -4060,6 +4060,13 @@
$.add(d.body, Header.hover);
return _this.setBarPosition(Conf['Bottom Header']);
});
+ return $.ready(function() {
+ var a;
+ if (a = $("a[href*='/" + g.BOARD + "/']", $.id('boardNavDesktopFoot'))) {
+ a.className = 'current';
+ return $.on(a, 'click', Index.cb.link);
+ }
+ });
},
bar: $.el('div', {
id: 'header-bar'
@@ -4082,13 +4089,14 @@
setBoardList: function() {
var a, boardList, btn, fourchannav, fullBoardList, shortcuts;
fourchannav = $.id('boardNavDesktop');
- if (a = $("a[href*='/" + g.BOARD + "/']", fourchannav)) {
- a.className = 'current';
- }
boardList = $.el('span', {
id: 'board-list',
innerHTML: " - " + fourchannav.innerHTML + ""
});
+ if (a = $("a[href*='/" + g.BOARD + "/']", boardList)) {
+ a.className = 'current';
+ $.on(a, 'click', Index.cb.link);
+ }
fullBoardList = $('#full-board-list', boardList);
btn = $('.hide-board-list-button', fullBoardList);
$.on(btn, 'click', Header.toggleBoardList);
@@ -4114,7 +4122,7 @@
}
as = $$('#full-board-list a[title]', Header.bar);
nodes = text.match(/[\w@]+((-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+")|\,"[^"]+[^"]"))*|[^\w@]+/g).map(function(t) {
- var a, board, m, _i, _len;
+ var a, board, current, m, _i, _len;
if (/^[^\w@]/.test(t)) {
return $.tn(t);
}
@@ -4140,7 +4148,11 @@
a = as[_i];
if (a.textContent === board) {
a = a.cloneNode(true);
- a.textContent = /-title/.test(t) || /-replace/.test(t) && $.hasClass(a, 'current') ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent;
+ current = $.hasClass(a, 'current');
+ if (current) {
+ $.on(a, 'click', Index.cb.link);
+ }
+ a.textContent = /-title/.test(t) || /-replace/.test(t) && current ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent;
if (m = t.match(/-(index|catalog)/)) {
a.dataset.only = m[1];
a.href = "//boards.4chan.org/" + board + "/";
@@ -4557,6 +4569,13 @@
}
e.preventDefault();
return Index.userPageNav(+a.pathname.split('/')[2]);
+ },
+ link: function(e) {
+ if (g.VIEW !== 'index' || /catalog/.test(this.href)) {
+ return;
+ }
+ e.preventDefault();
+ return Index.update();
}
},
scrollToIndex: function() {
diff --git a/src/General/Header.coffee b/src/General/Header.coffee
index 496ee9618..20cf207de 100644
--- a/src/General/Header.coffee
+++ b/src/General/Header.coffee
@@ -80,6 +80,12 @@ Header =
$.add d.body, Header.hover
@setBarPosition Conf['Bottom Header']
+ $.ready =>
+ if a = $ "a[href*='/#{g.BOARD}/']", $.id 'boardNavDesktopFoot'
+ a.className = 'current'
+ $.on a, 'click', Index.cb.link
+
+
bar: $.el 'div',
id: 'header-bar'
@@ -100,12 +106,12 @@ Header =
setBoardList: ->
fourchannav = $.id 'boardNavDesktop'
-
- if a = $ "a[href*='/#{g.BOARD}/']", fourchannav
- a.className = 'current'
boardList = $.el 'span',
id: 'board-list'
innerHTML: " - #{fourchannav.innerHTML}"
+ if a = $ "a[href*='/#{g.BOARD}/']", boardList
+ a.className = 'current'
+ $.on a, 'click', Index.cb.link
fullBoardList = $ '#full-board-list', boardList
btn = $ '.hide-board-list-button', fullBoardList
$.on btn, 'click', Header.toggleBoardList
@@ -157,7 +163,11 @@ Header =
if a.textContent is board
a = a.cloneNode true
- a.textContent = if /-title/.test(t) or /-replace/.test(t) and $.hasClass a, 'current'
+ current = $.hasClass a, 'current'
+ if current
+ $.on a, 'click', Index.cb.link
+
+ a.textContent = if /-title/.test(t) or /-replace/.test(t) and current
a.title
else if /-full/.test t
"/#{board}/ - #{a.title}"
diff --git a/src/General/Index.coffee b/src/General/Index.coffee
index 705a01f04..128e4a2e6 100644
--- a/src/General/Index.coffee
+++ b/src/General/Index.coffee
@@ -127,6 +127,10 @@ Index =
return if a.textContent is 'Catalog'
e.preventDefault()
Index.userPageNav +a.pathname.split('/')[2]
+ link: (e) ->
+ return if g.VIEW isnt 'index' or /catalog/.test @href
+ e.preventDefault()
+ Index.update()
scrollToIndex: ->
Header.scrollToIfNeeded Index.root