Fix an issue where catalog links were affecting external links #773
This commit is contained in:
parent
9d087ef5d6
commit
8ba4898158
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.32 - 2014-07-30
|
* appchan x - Version 2.9.32 - 2014-07-31
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.32 - 2014-07-30
|
* appchan x - Version 2.9.32 - 2014-07-31
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
@ -4309,29 +4309,31 @@
|
|||||||
as = $$('#full-board-list a[title]', Header.boardList);
|
as = $$('#full-board-list a[title]', Header.boardList);
|
||||||
re = /[\w@]+(-(all|title|replace|full|archive|(mode|sort|text|url):"[^"]+"(\,"[^"]+[^"]")?))*|[^\w@]+/g;
|
re = /[\w@]+(-(all|title|replace|full|archive|(mode|sort|text|url):"[^"]+"(\,"[^"]+[^"]")?))*|[^\w@]+/g;
|
||||||
nodes = text.match(re).map(function(t) {
|
nodes = text.match(re).map(function(t) {
|
||||||
var a, board, boardID, href, m, type, _i, _len;
|
var a, board, boardID, href, m, match, type, url, _i, _len;
|
||||||
if (/^[^\w@]/.test(t)) {
|
if (/^[^\w@]/.test(t)) {
|
||||||
return $.tn(t);
|
return $.tn(t);
|
||||||
}
|
}
|
||||||
if (/^toggle-all/.test(t)) {
|
if (/^toggle-all/.test(t)) {
|
||||||
a = $.el('a', {
|
a = $.el('a', {
|
||||||
className: 'show-board-list-button',
|
className: 'show-board-list-button',
|
||||||
textContent: (t.match(/-text:"(.+)"/) || [null, '+'])[1],
|
textContent: (match = t.match(/-text:"(.+)"/)) ? match[1] : '+',
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
});
|
});
|
||||||
$.on(a, 'click', Header.toggleBoardList);
|
$.on(a, 'click', Header.toggleBoardList);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
if (/^external/.test(t)) {
|
if (/^external/.test(t)) {
|
||||||
a = $.el('a', {
|
if (url = t.match(/\,"(.+)"/)) {
|
||||||
href: (t.match(/\,"(.+)"/) || [null, '+'])[1],
|
a = $.el('a', {
|
||||||
textContent: (t.match(/-text:"(.+)"\,/) || [null, '+'])[1],
|
textContent: (match = t.match(/-text:"(.+)"\,/)) ? match[1] : '+',
|
||||||
className: 'external'
|
className: 'external',
|
||||||
});
|
href: url[1]
|
||||||
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
});
|
||||||
a.className += ' current';
|
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
||||||
|
a.className += ' current';
|
||||||
|
}
|
||||||
|
return a;
|
||||||
}
|
}
|
||||||
return a;
|
|
||||||
}
|
}
|
||||||
board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0];
|
board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0];
|
||||||
boardID = t.split('-')[0];
|
boardID = t.split('-')[0];
|
||||||
@ -15048,7 +15050,7 @@
|
|||||||
_ref = $$("#board-list a:not(.catalog), #boardNavDesktopFoot a");
|
_ref = $$("#board-list a:not(.catalog), #boardNavDesktopFoot a");
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
a = _ref[_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')) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
a.href = generateURL(board);
|
a.href = generateURL(board);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.32 - 2014-07-30
|
* appchan x - Version 2.9.32 - 2014-07-31
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
@ -4360,29 +4360,31 @@
|
|||||||
as = $$('#full-board-list a[title]', Header.boardList);
|
as = $$('#full-board-list a[title]', Header.boardList);
|
||||||
re = /[\w@]+(-(all|title|replace|full|archive|(mode|sort|text|url):"[^"]+"(\,"[^"]+[^"]")?))*|[^\w@]+/g;
|
re = /[\w@]+(-(all|title|replace|full|archive|(mode|sort|text|url):"[^"]+"(\,"[^"]+[^"]")?))*|[^\w@]+/g;
|
||||||
nodes = text.match(re).map(function(t) {
|
nodes = text.match(re).map(function(t) {
|
||||||
var a, board, boardID, href, m, type, _i, _len;
|
var a, board, boardID, href, m, match, type, url, _i, _len;
|
||||||
if (/^[^\w@]/.test(t)) {
|
if (/^[^\w@]/.test(t)) {
|
||||||
return $.tn(t);
|
return $.tn(t);
|
||||||
}
|
}
|
||||||
if (/^toggle-all/.test(t)) {
|
if (/^toggle-all/.test(t)) {
|
||||||
a = $.el('a', {
|
a = $.el('a', {
|
||||||
className: 'show-board-list-button',
|
className: 'show-board-list-button',
|
||||||
textContent: (t.match(/-text:"(.+)"/) || [null, '+'])[1],
|
textContent: (match = t.match(/-text:"(.+)"/)) ? match[1] : '+',
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
});
|
});
|
||||||
$.on(a, 'click', Header.toggleBoardList);
|
$.on(a, 'click', Header.toggleBoardList);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
if (/^external/.test(t)) {
|
if (/^external/.test(t)) {
|
||||||
a = $.el('a', {
|
if (url = t.match(/\,"(.+)"/)) {
|
||||||
href: (t.match(/\,"(.+)"/) || [null, '+'])[1],
|
a = $.el('a', {
|
||||||
textContent: (t.match(/-text:"(.+)"\,/) || [null, '+'])[1],
|
textContent: (match = t.match(/-text:"(.+)"\,/)) ? match[1] : '+',
|
||||||
className: 'external'
|
className: 'external',
|
||||||
});
|
href: url[1]
|
||||||
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
});
|
||||||
a.className += ' current';
|
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
||||||
|
a.className += ' current';
|
||||||
|
}
|
||||||
|
return a;
|
||||||
}
|
}
|
||||||
return a;
|
|
||||||
}
|
}
|
||||||
board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0];
|
board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0];
|
||||||
boardID = t.split('-')[0];
|
boardID = t.split('-')[0];
|
||||||
@ -15059,7 +15061,7 @@
|
|||||||
_ref = $$("#board-list a:not(.catalog), #boardNavDesktopFoot a");
|
_ref = $$("#board-list a:not(.catalog), #boardNavDesktopFoot a");
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
a = _ref[_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')) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
a.href = generateURL(board);
|
a.href = generateURL(board);
|
||||||
|
|||||||
@ -151,20 +151,21 @@ Header =
|
|||||||
|
|
||||||
if /^toggle-all/.test t
|
if /^toggle-all/.test t
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
className: 'show-board-list-button'
|
className: 'show-board-list-button'
|
||||||
textContent: (t.match(/-text:"(.+)"/) || [null, '+'])[1]
|
textContent: if match = t.match /-text:"(.+)"/ then match[1] else '+'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.on a, 'click', Header.toggleBoardList
|
$.on a, 'click', Header.toggleBoardList
|
||||||
return a
|
return a
|
||||||
|
|
||||||
if /^external/.test t
|
if /^external/.test t
|
||||||
a = $.el 'a',
|
if url = t.match /\,"(.+)"/
|
||||||
href: (t.match(/\,"(.+)"/) || [null, '+'])[1]
|
a = $.el 'a',
|
||||||
textContent: (t.match(/-text:"(.+)"\,/) || [null, '+'])[1]
|
textContent: if match = t.match /-text:"(.+)"\,/ then match[1] else '+'
|
||||||
className: 'external'
|
className: 'external'
|
||||||
if a.hostname is 'boards.4chan.org' and a.pathname.split('/')[1] is g.BOARD.ID
|
href: url[1]
|
||||||
a.className += ' current'
|
if a.hostname is 'boards.4chan.org' and a.pathname.split('/')[1] is g.BOARD.ID
|
||||||
return a
|
a.className += ' current'
|
||||||
|
return a
|
||||||
|
|
||||||
board = if /^current/.test t
|
board = if /^current/.test t
|
||||||
g.BOARD.ID
|
g.BOARD.ID
|
||||||
|
|||||||
@ -34,7 +34,8 @@ CatalogLinks =
|
|||||||
for a in $$ """#board-list a:not(.catalog), #boardNavDesktopFoot a"""
|
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
|
continue if a.hostname not in ['boards.4chan.org', 'catalog.neet.tv', '4index.gropes.us'] or
|
||||||
!(board = a.pathname.split('/')[1]) or
|
!(board = a.pathname.split('/')[1]) or
|
||||||
board in ['f', 'status', '4chan']
|
board in ['f', 'status', '4chan'] or
|
||||||
|
$.hasClass a, 'external'
|
||||||
|
|
||||||
# Href is easier than pathname because then we don't have
|
# Href is easier than pathname because then we don't have
|
||||||
# conditions where External Catalog has been disabled between switches.
|
# conditions where External Catalog has been disabled between switches.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user