Fix long-broken CatalogLinks header generation

This commit is contained in:
Zixaphir 2015-01-13 17:24:58 -07:00
parent 4ef2b61c25
commit 6015bfe4a7
5 changed files with 22 additions and 13 deletions

View File

@ -4585,7 +4585,9 @@
return _results;
})();
$.add(list, nodes);
return $.ready(CatalogLinks.initBoardList);
return $.ready(function() {
return CatalogLinks.set(Conf['Header catalog links']);
});
},
mapCustomNavigation: function(t, as) {
var a, boardID, href, m, text, type, url, _i, _len;
@ -15650,19 +15652,20 @@
set: function(useCatalog) {
var a, board, generateURL, path, _i, _len, _ref, _ref1;
path = useCatalog ? 'catalog' : '';
generateURL = useCatalog && Conf['External Catalog'] ? CatalogLinks.external : function(board) {
return a.href = "/" + board + "/" + path;
};
generateURL = useCatalog && Conf['External Catalog'] ? CatalogLinks.external : CatalogLinks.internal;
_ref = $$("#board-list a:not(.catalog), #boardNavDesktopFoot a");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
if (((_ref1 = a.hostname) !== 'boards.4chan.org' && _ref1 !== 'catalog.neet.tv' && _ref1 !== '4index.gropes.us') || !(board = a.pathname.split('/')[1]) || (board === 'f' || board === 'status' || board === '4chan') || $.hasClass(a, 'external')) {
continue;
}
a.href = generateURL(board);
a.href = generateURL(board, path);
}
return CatalogLinks.el.title = "Turn catalog links " + (useCatalog ? 'off' : 'on') + ".";
},
internal: function(board, path) {
return "/" + board + "/" + path;
},
external: function(board) {
if (board === 'a' || board === 'c' || board === 'g' || board === 'co' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'w' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'cgl' || board === 'ck' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'int' || board === 'jp' || board === 'mlp' || board === 'lit' || board === 'mu' || board === 'n' || board === 'po' || board === 'sci' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'x' || board === 'q') {
return "http://catalog.neet.tv/" + board;

View File

@ -4603,7 +4603,9 @@
return _results;
})();
$.add(list, nodes);
return $.ready(CatalogLinks.initBoardList);
return $.ready(function() {
return CatalogLinks.set(Conf['Header catalog links']);
});
},
mapCustomNavigation: function(t, as) {
var a, boardID, href, m, text, type, url, _i, _len;
@ -15665,19 +15667,20 @@
set: function(useCatalog) {
var a, board, generateURL, path, _i, _len, _ref, _ref1;
path = useCatalog ? 'catalog' : '';
generateURL = useCatalog && Conf['External Catalog'] ? CatalogLinks.external : function(board) {
return a.href = "/" + board + "/" + path;
};
generateURL = useCatalog && Conf['External Catalog'] ? CatalogLinks.external : CatalogLinks.internal;
_ref = $$("#board-list a:not(.catalog), #boardNavDesktopFoot a");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
if (((_ref1 = a.hostname) !== 'boards.4chan.org' && _ref1 !== 'catalog.neet.tv' && _ref1 !== '4index.gropes.us') || !(board = a.pathname.split('/')[1]) || (board === 'f' || board === 'status' || board === '4chan') || $.hasClass(a, 'external')) {
continue;
}
a.href = generateURL(board);
a.href = generateURL(board, path);
}
return CatalogLinks.el.title = "Turn catalog links " + (useCatalog ? 'off' : 'on') + ".";
},
internal: function(board, path) {
return "/" + board + "/" + path;
},
external: function(board) {
if (board === 'a' || board === 'c' || board === 'g' || board === 'co' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'w' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'cgl' || board === 'ck' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'int' || board === 'jp' || board === 'mlp' || board === 'lit' || board === 'mu' || board === 'n' || board === 'po' || board === 'sci' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'x' || board === 'q') {
return "http://catalog.neet.tv/" + board;

View File

@ -1,6 +1,7 @@
PostHiding =
init: ->
@db = new DataBoard 'hiddenPosts'
@hideButton = $.el 'a',
className: 'hide-post-button fa'
href: 'javascript:;'
@ -162,6 +163,7 @@ PostHiding =
return
PostHiding.saveHiddenState post, {thisPost: false, hideRecursively: replies, makeStub} unless thisPost
$.event 'CloseMenu'
show: (post) ->
parent = @parentNode
thisPost = $('input[name=thisPost]', parent).checked

View File

@ -163,7 +163,7 @@ Header =
re = /[\w@]+(-(all|title|replace|full|index|catalog|archive|expired|(mode|sort|text|url):"[^"]+"(,"[^"]+")?))*|[^\w@]+/g
nodes = (Header.mapCustomNavigation t, as for t in boardnav.match re)
$.add list, nodes
$.ready CatalogLinks.initBoardList
$.ready -> CatalogLinks.set Conf['Header catalog links']
mapCustomNavigation: (t, as) ->
if /^[^\w@]/.test t

View File

@ -29,7 +29,7 @@ CatalogLinks =
generateURL = if useCatalog and Conf['External Catalog']
CatalogLinks.external
else
(board) -> a.href = "/#{board}/#{path}"
CatalogLinks.internal
for a in $$ """#board-list a:not(.catalog), #boardNavDesktopFoot a"""
continue if a.hostname not in ['boards.4chan.org', 'catalog.neet.tv', '4index.gropes.us'] or
@ -39,10 +39,11 @@ CatalogLinks =
# Href is easier than pathname because then we don't have
# conditions where External Catalog has been disabled between switches.
a.href = generateURL board
a.href = generateURL board, path
CatalogLinks.el.title = "Turn catalog links #{if useCatalog then 'off' else 'on'}."
internal: (board, path) -> "/#{board}/#{path}"
external: (board) ->
if board in ['a', 'c', 'g', 'co', 'k', 'm', 'o', 'p', 'v', 'vg', 'w', 'cm', '3', 'adv', 'an', 'cgl', 'ck', 'diy', 'fa', 'fit', 'int', 'jp', 'mlp', 'lit', 'mu', 'n', 'po', 'sci', 'toy', 'trv', 'tv', 'vp', 'x', 'q']
"http://catalog.neet.tv/#{board}"