Fix catalog links issues.
This commit is contained in:
parent
305490fc79
commit
9e8e206157
@ -4167,17 +4167,8 @@
|
||||
el: el,
|
||||
order: 95
|
||||
});
|
||||
return $.asap((function() {
|
||||
return d.body;
|
||||
}), function() {
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
return $.asap((function() {
|
||||
return $.id('boardNavMobile');
|
||||
}), function() {
|
||||
return CatalogLinks.set(input.checked);
|
||||
});
|
||||
return $.on(d, '4chanXInitFinished', function() {
|
||||
return CatalogLinks.set(Conf['Header catalog links']);
|
||||
});
|
||||
},
|
||||
toggle: function() {
|
||||
@ -4191,7 +4182,7 @@
|
||||
var a, board, path, _i, _len, _ref;
|
||||
|
||||
path = useCatalog ? 'catalog' : '';
|
||||
_ref = $$('a', $.id('boardNavDesktop'));
|
||||
_ref = $$('a', $.id('board-list'));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
a = _ref[_i];
|
||||
board = a.pathname.split('/')[1];
|
||||
@ -4698,16 +4689,19 @@
|
||||
};
|
||||
},
|
||||
setBoardList: function() {
|
||||
var a, btn, customBoardList, fullBoardList, nav;
|
||||
var a, boardList, btn, customBoardList, fullBoardList, nav;
|
||||
|
||||
Header.nav = nav = $.id('boardNavDesktop');
|
||||
nav.id = 'header-bar';
|
||||
if (a = $("a[href*='/" + g.BOARD + "/']", nav)) {
|
||||
a.className = 'current';
|
||||
}
|
||||
fullBoardList = $.el('span', {
|
||||
id: 'full-board-list'
|
||||
boardList = $.el('span', {
|
||||
id: 'board-list'
|
||||
});
|
||||
$.add(boardList, fullBoardList = $.el('span', {
|
||||
id: 'full-board-list'
|
||||
}));
|
||||
Header.setBarPosition.call({
|
||||
textContent: "" + Conf['Boards Navigation']
|
||||
});
|
||||
@ -4715,13 +4709,13 @@
|
||||
Header.setBarVisibility(Conf['Header auto-hide']);
|
||||
$.sync('Header auto-hide', Header.setBarVisibility);
|
||||
$.add(fullBoardList, __slice.call(nav.childNodes));
|
||||
$.add(nav, [fullBoardList, Header.shortcuts, Header.bar, Header.toggle]);
|
||||
$.add(nav, [boardList, Header.shortcuts, Header.bar, Header.toggle]);
|
||||
if (Conf['Custom Board Navigation']) {
|
||||
fullBoardList.hidden = true;
|
||||
customBoardList = $.el('span', {
|
||||
id: 'custom-board-list'
|
||||
});
|
||||
$.before(fullBoardList, customBoardList);
|
||||
$.add(boardList, customBoardList);
|
||||
Header.generateBoardList(Conf['boardnav']);
|
||||
$.sync('boardnav', Header.generateBoardList);
|
||||
btn = $.el('span', {
|
||||
|
||||
@ -4158,17 +4158,8 @@
|
||||
el: el,
|
||||
order: 95
|
||||
});
|
||||
return $.asap((function() {
|
||||
return d.body;
|
||||
}), function() {
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
return $.asap((function() {
|
||||
return $.id('boardNavMobile');
|
||||
}), function() {
|
||||
return CatalogLinks.set(input.checked);
|
||||
});
|
||||
return $.on(d, '4chanXInitFinished', function() {
|
||||
return CatalogLinks.set(Conf['Header catalog links']);
|
||||
});
|
||||
},
|
||||
toggle: function() {
|
||||
@ -4182,7 +4173,7 @@
|
||||
var a, board, path, _i, _len, _ref;
|
||||
|
||||
path = useCatalog ? 'catalog' : '';
|
||||
_ref = $$('a', $.id('boardNavDesktop'));
|
||||
_ref = $$('a', $.id('board-list'));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
a = _ref[_i];
|
||||
board = a.pathname.split('/')[1];
|
||||
@ -4689,16 +4680,19 @@
|
||||
};
|
||||
},
|
||||
setBoardList: function() {
|
||||
var a, btn, customBoardList, fullBoardList, nav;
|
||||
var a, boardList, btn, customBoardList, fullBoardList, nav;
|
||||
|
||||
Header.nav = nav = $.id('boardNavDesktop');
|
||||
nav.id = 'header-bar';
|
||||
if (a = $("a[href*='/" + g.BOARD + "/']", nav)) {
|
||||
a.className = 'current';
|
||||
}
|
||||
fullBoardList = $.el('span', {
|
||||
id: 'full-board-list'
|
||||
boardList = $.el('span', {
|
||||
id: 'board-list'
|
||||
});
|
||||
$.add(boardList, fullBoardList = $.el('span', {
|
||||
id: 'full-board-list'
|
||||
}));
|
||||
Header.setBarPosition.call({
|
||||
textContent: "" + Conf['Boards Navigation']
|
||||
});
|
||||
@ -4706,13 +4700,13 @@
|
||||
Header.setBarVisibility(Conf['Header auto-hide']);
|
||||
$.sync('Header auto-hide', Header.setBarVisibility);
|
||||
$.add(fullBoardList, __slice.call(nav.childNodes));
|
||||
$.add(nav, [fullBoardList, Header.shortcuts, Header.bar, Header.toggle]);
|
||||
$.add(nav, [boardList, Header.shortcuts, Header.bar, Header.toggle]);
|
||||
if (Conf['Custom Board Navigation']) {
|
||||
fullBoardList.hidden = true;
|
||||
customBoardList = $.el('span', {
|
||||
id: 'custom-board-list'
|
||||
});
|
||||
$.before(fullBoardList, customBoardList);
|
||||
$.add(boardList, customBoardList);
|
||||
Header.generateBoardList(Conf['boardnav']);
|
||||
$.sync('boardnav', Header.generateBoardList);
|
||||
btn = $.el('span', {
|
||||
|
||||
BIN
builds/crx.crx
BIN
builds/crx.crx
Binary file not shown.
@ -4081,17 +4081,8 @@
|
||||
el: el,
|
||||
order: 95
|
||||
});
|
||||
return $.asap((function() {
|
||||
return d.body;
|
||||
}), function() {
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
return $.asap((function() {
|
||||
return $.id('boardNavMobile');
|
||||
}), function() {
|
||||
return CatalogLinks.set(input.checked);
|
||||
});
|
||||
return $.on(d, '4chanXInitFinished', function() {
|
||||
return CatalogLinks.set(Conf['Header catalog links']);
|
||||
});
|
||||
},
|
||||
toggle: function() {
|
||||
@ -4105,7 +4096,7 @@
|
||||
var a, board, path, _i, _len, _ref;
|
||||
|
||||
path = useCatalog ? 'catalog' : '';
|
||||
_ref = $$('a', $.id('boardNavDesktop'));
|
||||
_ref = $$('a', $.id('board-list'));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
a = _ref[_i];
|
||||
board = a.pathname.split('/')[1];
|
||||
@ -4612,16 +4603,19 @@
|
||||
};
|
||||
},
|
||||
setBoardList: function() {
|
||||
var a, btn, customBoardList, fullBoardList, nav;
|
||||
var a, boardList, btn, customBoardList, fullBoardList, nav;
|
||||
|
||||
Header.nav = nav = $.id('boardNavDesktop');
|
||||
nav.id = 'header-bar';
|
||||
if (a = $("a[href*='/" + g.BOARD + "/']", nav)) {
|
||||
a.className = 'current';
|
||||
}
|
||||
fullBoardList = $.el('span', {
|
||||
id: 'full-board-list'
|
||||
boardList = $.el('span', {
|
||||
id: 'board-list'
|
||||
});
|
||||
$.add(boardList, fullBoardList = $.el('span', {
|
||||
id: 'full-board-list'
|
||||
}));
|
||||
Header.setBarPosition.call({
|
||||
textContent: "" + Conf['Boards Navigation']
|
||||
});
|
||||
@ -4629,13 +4623,13 @@
|
||||
Header.setBarVisibility(Conf['Header auto-hide']);
|
||||
$.sync('Header auto-hide', Header.setBarVisibility);
|
||||
$.add(fullBoardList, __slice.call(nav.childNodes));
|
||||
$.add(nav, [fullBoardList, Header.shortcuts, Header.bar, Header.toggle]);
|
||||
$.add(nav, [boardList, Header.shortcuts, Header.bar, Header.toggle]);
|
||||
if (Conf['Custom Board Navigation']) {
|
||||
fullBoardList.hidden = true;
|
||||
customBoardList = $.el('span', {
|
||||
id: 'custom-board-list'
|
||||
});
|
||||
$.before(fullBoardList, customBoardList);
|
||||
$.add(boardList, customBoardList);
|
||||
Header.generateBoardList(Conf['boardnav']);
|
||||
$.sync('boardnav', Header.generateBoardList);
|
||||
btn = $.el('span', {
|
||||
|
||||
@ -6,7 +6,7 @@ CatalogLinks =
|
||||
href: 'javascript:;'
|
||||
innerHTML: "<input type=checkbox #{if Conf['Header catalog links'] then 'checked' else ''}>Catalog"
|
||||
title: "Turn catalog links #{if Conf['Header catalog links'] then 'off' else 'on'}."
|
||||
|
||||
|
||||
input = $ 'input', el
|
||||
$.on input, 'change', @toggle
|
||||
$.sync 'Header catalog links', CatalogLinks.set
|
||||
@ -16,22 +16,18 @@ CatalogLinks =
|
||||
el: el
|
||||
order: 95
|
||||
|
||||
$.asap (-> d.body), ->
|
||||
return unless Main.isThisPageLegit()
|
||||
# Wait for #boardNavMobile instead of #boardNavDesktop,
|
||||
# it might be incomplete otherwise.
|
||||
$.asap (-> $.id 'boardNavMobile'), ->
|
||||
# Set links on load.
|
||||
CatalogLinks.set input.checked
|
||||
$.on d, '4chanXInitFinished', ->
|
||||
# Set links on load.
|
||||
CatalogLinks.set Conf['Header catalog links']
|
||||
|
||||
toggle: ->
|
||||
$.event 'CloseMenu'
|
||||
$.set 'Header catalog links', useCatalog = @checked
|
||||
CatalogLinks.set useCatalog
|
||||
|
||||
|
||||
set: (useCatalog) ->
|
||||
path = if useCatalog then 'catalog' else ''
|
||||
for a in $$ 'a', $.id('boardNavDesktop')
|
||||
for a in $$ 'a', $.id('board-list')
|
||||
board = a.pathname.split('/')[1]
|
||||
continue if ['f', 'status', '4chan'].contains(board) or !board
|
||||
if Conf['External Catalog']
|
||||
|
||||
@ -80,8 +80,11 @@ Header =
|
||||
if a = $ "a[href*='/#{g.BOARD}/']", nav
|
||||
a.className = 'current'
|
||||
|
||||
fullBoardList = $.el 'span',
|
||||
id: 'full-board-list'
|
||||
boardList = $.el 'span',
|
||||
id: 'board-list'
|
||||
|
||||
$.add boardList, fullBoardList = $.el 'span',
|
||||
id: 'full-board-list'
|
||||
|
||||
Header.setBarPosition.call textContent: "#{Conf['Boards Navigation']}"
|
||||
$.sync 'Boards Navigation', Header.changeBarPosition
|
||||
@ -90,13 +93,13 @@ Header =
|
||||
$.sync 'Header auto-hide', Header.setBarVisibility
|
||||
|
||||
$.add fullBoardList, [nav.childNodes...]
|
||||
$.add nav, [fullBoardList, Header.shortcuts, Header.bar, Header.toggle]
|
||||
$.add nav, [boardList, Header.shortcuts, Header.bar, Header.toggle]
|
||||
|
||||
if Conf['Custom Board Navigation']
|
||||
fullBoardList.hidden = true
|
||||
customBoardList = $.el 'span',
|
||||
id: 'custom-board-list'
|
||||
$.before fullBoardList, customBoardList
|
||||
id: 'custom-board-list'
|
||||
$.add boardList, customBoardList
|
||||
|
||||
Header.generateBoardList Conf['boardnav']
|
||||
$.sync 'boardnav', Header.generateBoardList
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user