Merge branch 'v3'
Conflicts: builds/appchan-x.user.js builds/crx/script.js src/General/Header.coffee
This commit is contained in:
commit
073f69d804
@ -4036,7 +4036,7 @@
|
|||||||
$.on(d, 'CreateNotification', this.createNotification);
|
$.on(d, 'CreateNotification', this.createNotification);
|
||||||
this.enableDesktopNotifications();
|
this.enableDesktopNotifications();
|
||||||
this.addShortcut(menuButton, true);
|
this.addShortcut(menuButton, true);
|
||||||
return $.asap((function() {
|
$.asap((function() {
|
||||||
return d.body;
|
return d.body;
|
||||||
}), function() {
|
}), function() {
|
||||||
if (!Main.isThisPageLegit()) {
|
if (!Main.isThisPageLegit()) {
|
||||||
@ -4049,6 +4049,13 @@
|
|||||||
$.add(d.body, Header.hover);
|
$.add(d.body, Header.hover);
|
||||||
return _this.setBarPosition(Conf['Bottom Header']);
|
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', {
|
bar: $.el('div', {
|
||||||
id: 'header-bar'
|
id: 'header-bar'
|
||||||
@ -4071,13 +4078,14 @@
|
|||||||
setBoardList: function() {
|
setBoardList: function() {
|
||||||
var a, boardList, btn, fourchannav, fullBoardList, shortcuts;
|
var a, boardList, btn, fourchannav, fullBoardList, shortcuts;
|
||||||
fourchannav = $.id('boardNavDesktop');
|
fourchannav = $.id('boardNavDesktop');
|
||||||
if (a = $("a[href*='/" + g.BOARD + "/']", fourchannav)) {
|
|
||||||
a.className = 'current';
|
|
||||||
}
|
|
||||||
boardList = $.el('span', {
|
boardList = $.el('span', {
|
||||||
id: 'board-list',
|
id: 'board-list',
|
||||||
innerHTML: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'> - </a></span> " + fourchannav.innerHTML + "</span>"
|
innerHTML: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'> - </a></span> " + fourchannav.innerHTML + "</span>"
|
||||||
});
|
});
|
||||||
|
if (a = $("a[href*='/" + g.BOARD + "/']", boardList)) {
|
||||||
|
a.className = 'current';
|
||||||
|
$.on(a, 'click', Index.cb.link);
|
||||||
|
}
|
||||||
fullBoardList = $('#full-board-list', boardList);
|
fullBoardList = $('#full-board-list', boardList);
|
||||||
btn = $('.hide-board-list-button', fullBoardList);
|
btn = $('.hide-board-list-button', fullBoardList);
|
||||||
$.on(btn, 'click', Header.toggleBoardList);
|
$.on(btn, 'click', Header.toggleBoardList);
|
||||||
@ -4103,7 +4111,7 @@
|
|||||||
}
|
}
|
||||||
as = $$('#full-board-list a[title]', Header.bar);
|
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) {
|
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)) {
|
if (/^[^\w@]/.test(t)) {
|
||||||
return $.tn(t);
|
return $.tn(t);
|
||||||
}
|
}
|
||||||
@ -4129,7 +4137,11 @@
|
|||||||
a = as[_i];
|
a = as[_i];
|
||||||
if (a.textContent === board) {
|
if (a.textContent === board) {
|
||||||
a = a.cloneNode(true);
|
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)/)) {
|
if (m = t.match(/-(index|catalog)/)) {
|
||||||
a.dataset.only = m[1];
|
a.dataset.only = m[1];
|
||||||
a.href = "//boards.4chan.org/" + board + "/";
|
a.href = "//boards.4chan.org/" + board + "/";
|
||||||
@ -4546,6 +4558,13 @@
|
|||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return Index.userPageNav(+a.pathname.split('/')[2]);
|
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() {
|
scrollToIndex: function() {
|
||||||
|
|||||||
@ -4047,7 +4047,7 @@
|
|||||||
$.on(d, 'CreateNotification', this.createNotification);
|
$.on(d, 'CreateNotification', this.createNotification);
|
||||||
this.enableDesktopNotifications();
|
this.enableDesktopNotifications();
|
||||||
this.addShortcut(menuButton, true);
|
this.addShortcut(menuButton, true);
|
||||||
return $.asap((function() {
|
$.asap((function() {
|
||||||
return d.body;
|
return d.body;
|
||||||
}), function() {
|
}), function() {
|
||||||
if (!Main.isThisPageLegit()) {
|
if (!Main.isThisPageLegit()) {
|
||||||
@ -4060,6 +4060,13 @@
|
|||||||
$.add(d.body, Header.hover);
|
$.add(d.body, Header.hover);
|
||||||
return _this.setBarPosition(Conf['Bottom Header']);
|
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', {
|
bar: $.el('div', {
|
||||||
id: 'header-bar'
|
id: 'header-bar'
|
||||||
@ -4082,13 +4089,14 @@
|
|||||||
setBoardList: function() {
|
setBoardList: function() {
|
||||||
var a, boardList, btn, fourchannav, fullBoardList, shortcuts;
|
var a, boardList, btn, fourchannav, fullBoardList, shortcuts;
|
||||||
fourchannav = $.id('boardNavDesktop');
|
fourchannav = $.id('boardNavDesktop');
|
||||||
if (a = $("a[href*='/" + g.BOARD + "/']", fourchannav)) {
|
|
||||||
a.className = 'current';
|
|
||||||
}
|
|
||||||
boardList = $.el('span', {
|
boardList = $.el('span', {
|
||||||
id: 'board-list',
|
id: 'board-list',
|
||||||
innerHTML: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'> - </a></span> " + fourchannav.innerHTML + "</span>"
|
innerHTML: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'> - </a></span> " + fourchannav.innerHTML + "</span>"
|
||||||
});
|
});
|
||||||
|
if (a = $("a[href*='/" + g.BOARD + "/']", boardList)) {
|
||||||
|
a.className = 'current';
|
||||||
|
$.on(a, 'click', Index.cb.link);
|
||||||
|
}
|
||||||
fullBoardList = $('#full-board-list', boardList);
|
fullBoardList = $('#full-board-list', boardList);
|
||||||
btn = $('.hide-board-list-button', fullBoardList);
|
btn = $('.hide-board-list-button', fullBoardList);
|
||||||
$.on(btn, 'click', Header.toggleBoardList);
|
$.on(btn, 'click', Header.toggleBoardList);
|
||||||
@ -4114,7 +4122,7 @@
|
|||||||
}
|
}
|
||||||
as = $$('#full-board-list a[title]', Header.bar);
|
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) {
|
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)) {
|
if (/^[^\w@]/.test(t)) {
|
||||||
return $.tn(t);
|
return $.tn(t);
|
||||||
}
|
}
|
||||||
@ -4140,7 +4148,11 @@
|
|||||||
a = as[_i];
|
a = as[_i];
|
||||||
if (a.textContent === board) {
|
if (a.textContent === board) {
|
||||||
a = a.cloneNode(true);
|
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)/)) {
|
if (m = t.match(/-(index|catalog)/)) {
|
||||||
a.dataset.only = m[1];
|
a.dataset.only = m[1];
|
||||||
a.href = "//boards.4chan.org/" + board + "/";
|
a.href = "//boards.4chan.org/" + board + "/";
|
||||||
@ -4557,6 +4569,13 @@
|
|||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return Index.userPageNav(+a.pathname.split('/')[2]);
|
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() {
|
scrollToIndex: function() {
|
||||||
|
|||||||
@ -80,6 +80,12 @@ Header =
|
|||||||
$.add d.body, Header.hover
|
$.add d.body, Header.hover
|
||||||
@setBarPosition Conf['Bottom Header']
|
@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',
|
bar: $.el 'div',
|
||||||
id: 'header-bar'
|
id: 'header-bar'
|
||||||
|
|
||||||
@ -100,12 +106,12 @@ Header =
|
|||||||
|
|
||||||
setBoardList: ->
|
setBoardList: ->
|
||||||
fourchannav = $.id 'boardNavDesktop'
|
fourchannav = $.id 'boardNavDesktop'
|
||||||
|
|
||||||
if a = $ "a[href*='/#{g.BOARD}/']", fourchannav
|
|
||||||
a.className = 'current'
|
|
||||||
boardList = $.el 'span',
|
boardList = $.el 'span',
|
||||||
id: 'board-list'
|
id: 'board-list'
|
||||||
innerHTML: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'> - </a></span> #{fourchannav.innerHTML}</span>"
|
innerHTML: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'> - </a></span> #{fourchannav.innerHTML}</span>"
|
||||||
|
if a = $ "a[href*='/#{g.BOARD}/']", boardList
|
||||||
|
a.className = 'current'
|
||||||
|
$.on a, 'click', Index.cb.link
|
||||||
fullBoardList = $ '#full-board-list', boardList
|
fullBoardList = $ '#full-board-list', boardList
|
||||||
btn = $ '.hide-board-list-button', fullBoardList
|
btn = $ '.hide-board-list-button', fullBoardList
|
||||||
$.on btn, 'click', Header.toggleBoardList
|
$.on btn, 'click', Header.toggleBoardList
|
||||||
@ -157,7 +163,11 @@ Header =
|
|||||||
if a.textContent is board
|
if a.textContent is board
|
||||||
a = a.cloneNode true
|
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
|
a.title
|
||||||
else if /-full/.test t
|
else if /-full/.test t
|
||||||
"/#{board}/ - #{a.title}"
|
"/#{board}/ - #{a.title}"
|
||||||
|
|||||||
@ -127,6 +127,10 @@ Index =
|
|||||||
return if a.textContent is 'Catalog'
|
return if a.textContent is 'Catalog'
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
Index.userPageNav +a.pathname.split('/')[2]
|
Index.userPageNav +a.pathname.split('/')[2]
|
||||||
|
link: (e) ->
|
||||||
|
return if g.VIEW isnt 'index' or /catalog/.test @href
|
||||||
|
e.preventDefault()
|
||||||
|
Index.update()
|
||||||
|
|
||||||
scrollToIndex: ->
|
scrollToIndex: ->
|
||||||
Header.scrollToIfNeeded Index.root
|
Header.scrollToIfNeeded Index.root
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user