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