Kill some more [].map
This commit is contained in:
parent
653a7e96fa
commit
0f36424a61
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.44 - 2015-01-12
|
* appchan x - Version 2.9.44 - 2015-01-13
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.44 - 2015-01-12
|
* appchan x - Version 2.9.44 - 2015-01-13
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -3087,9 +3087,17 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
$.clear = function(cb) {
|
$.clear = function(cb) {
|
||||||
$["delete"](GM_listValues().map(function(key) {
|
var key;
|
||||||
return key.replace(g.NAMESPACE, '');
|
$["delete"]((function() {
|
||||||
}));
|
var _i, _len, _ref, _results;
|
||||||
|
_ref = GM_listValues();
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
key = _ref[_i];
|
||||||
|
_results.push(key.replace(g.NAMESPACE, ''));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
})());
|
||||||
return typeof cb === "function" ? cb() : void 0;
|
return typeof cb === "function" ? cb() : void 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4546,7 +4554,7 @@
|
|||||||
return $.sync('boardnav', Header.generateBoardList);
|
return $.sync('boardnav', Header.generateBoardList);
|
||||||
},
|
},
|
||||||
generateBoardList: function(boardnav) {
|
generateBoardList: function(boardnav) {
|
||||||
var as, list, nodes, re;
|
var as, list, nodes, re, t;
|
||||||
list = $('#custom-board-list', Header.boardList);
|
list = $('#custom-board-list', Header.boardList);
|
||||||
$.rmAll(list);
|
$.rmAll(list);
|
||||||
if (!boardnav) {
|
if (!boardnav) {
|
||||||
@ -4555,103 +4563,113 @@
|
|||||||
boardnav = boardnav.replace(/(\r\n|\n|\r)/g, ' ');
|
boardnav = boardnav.replace(/(\r\n|\n|\r)/g, ' ');
|
||||||
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 = boardnav.match(re).map(function(t) {
|
nodes = (function() {
|
||||||
var a, boardID, href, m, text, type, url, _i, _len;
|
var _i, _len, _ref, _results;
|
||||||
if (/^[^\w@]/.test(t)) {
|
_ref = boardnav.match(re);
|
||||||
return $.tn(t);
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
t = _ref[_i];
|
||||||
|
_results.push(Header.mapCustomNavigation(t, as));
|
||||||
}
|
}
|
||||||
text = url = null;
|
return _results;
|
||||||
t = t.replace(/-text:"([^"]+)"(?:,"([^"]+)")?/g, function(m0, m1, m2) {
|
})();
|
||||||
text = m1;
|
|
||||||
url = m2;
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
if (/^toggle-all/.test(t)) {
|
|
||||||
a = $.el('a', {
|
|
||||||
className: 'show-board-list-button',
|
|
||||||
textContent: text || '+',
|
|
||||||
href: 'javascript:;'
|
|
||||||
});
|
|
||||||
$.on(a, 'click', Header.toggleBoardList);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
if (/^external/.test(t)) {
|
|
||||||
a = $.el('a', {
|
|
||||||
href: url || 'javascript:;',
|
|
||||||
textContent: text || '+',
|
|
||||||
className: 'external'
|
|
||||||
});
|
|
||||||
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
|
||||||
a.className += ' current';
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
boardID = t.split('-')[0];
|
|
||||||
if (boardID === 'current') {
|
|
||||||
boardID = g.BOARD.ID;
|
|
||||||
}
|
|
||||||
for (_i = 0, _len = as.length; _i < _len; _i++) {
|
|
||||||
a = as[_i];
|
|
||||||
if (!(a.textContent === boardID)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
a = a.cloneNode();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (Conf['JSON Navigation']) {
|
|
||||||
$.on(a, 'click', Navigate.navigate);
|
|
||||||
}
|
|
||||||
a.textContent = /-title/.test(t) || /-replace/.test(t) && boardID === g.BOARD.ID ? a.title : /-full/.test(t) ? "/" + boardID + "/ - " + a.title : (m = t.match(/-text:"([^"]+)"/)) ? m[1] : boardID;
|
|
||||||
if (/-archive/.test(t)) {
|
|
||||||
if (href = Redirect.to('board', {
|
|
||||||
boardID: boardID
|
|
||||||
})) {
|
|
||||||
a.href = href;
|
|
||||||
} else {
|
|
||||||
return a.firstChild;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m = t.match(/-mode:"([^"]+)"/)) {
|
|
||||||
type = m[1].toLowerCase();
|
|
||||||
a.dataset.indexMode = (function() {
|
|
||||||
switch (type) {
|
|
||||||
case 'all threads':
|
|
||||||
return 'all pages';
|
|
||||||
case 'paged':
|
|
||||||
case 'catalog':
|
|
||||||
return type;
|
|
||||||
default:
|
|
||||||
return 'paged';
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
if (m = t.match(/-sort:"([^"]+)"/)) {
|
|
||||||
type = m[1].toLowerCase();
|
|
||||||
a.dataset.indexSort = (function() {
|
|
||||||
switch (type) {
|
|
||||||
case 'bump order':
|
|
||||||
return 'bump';
|
|
||||||
case 'last reply':
|
|
||||||
return 'lastreply';
|
|
||||||
case 'creation date':
|
|
||||||
return 'birth';
|
|
||||||
case 'reply count':
|
|
||||||
return 'replycount';
|
|
||||||
case 'file count':
|
|
||||||
return 'filecount';
|
|
||||||
default:
|
|
||||||
return 'bump';
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
if (boardID === '@') {
|
|
||||||
$.addClass(a, 'navSmall');
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
});
|
|
||||||
$.add(list, nodes);
|
$.add(list, nodes);
|
||||||
return $.ready(CatalogLinks.initBoardList);
|
return $.ready(CatalogLinks.initBoardList);
|
||||||
},
|
},
|
||||||
|
mapCustomNavigation: function(t, as) {
|
||||||
|
var a, boardID, href, m, text, type, url, _i, _len;
|
||||||
|
if (/^[^\w@]/.test(t)) {
|
||||||
|
return $.tn(t);
|
||||||
|
}
|
||||||
|
text = url = null;
|
||||||
|
t = t.replace(/-text:"([^"]+)"(?:,"([^"]+)")?/g, function(m0, m1, m2) {
|
||||||
|
text = m1;
|
||||||
|
url = m2;
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
if (/^toggle-all/.test(t)) {
|
||||||
|
a = $.el('a', {
|
||||||
|
className: 'show-board-list-button',
|
||||||
|
textContent: text || '+',
|
||||||
|
href: 'javascript:;'
|
||||||
|
});
|
||||||
|
$.on(a, 'click', Header.toggleBoardList);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (/^external/.test(t)) {
|
||||||
|
a = $.el('a', {
|
||||||
|
href: url || 'javascript:;',
|
||||||
|
textContent: text || '+',
|
||||||
|
className: 'external'
|
||||||
|
});
|
||||||
|
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
||||||
|
a.className += ' current';
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
boardID = t.split('-')[0];
|
||||||
|
if (boardID === 'current') {
|
||||||
|
boardID = g.BOARD.ID;
|
||||||
|
}
|
||||||
|
for (_i = 0, _len = as.length; _i < _len; _i++) {
|
||||||
|
a = as[_i];
|
||||||
|
if (!(a.textContent === boardID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
a = a.cloneNode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Conf['JSON Navigation']) {
|
||||||
|
$.on(a, 'click', Navigate.navigate);
|
||||||
|
}
|
||||||
|
a.textContent = /-title/.test(t) || /-replace/.test(t) && boardID === g.BOARD.ID ? a.title : /-full/.test(t) ? "/" + boardID + "/ - " + a.title : (m = t.match(/-text:"([^"]+)"/)) ? m[1] : boardID;
|
||||||
|
if (/-archive/.test(t)) {
|
||||||
|
if (href = Redirect.to('board', {
|
||||||
|
boardID: boardID
|
||||||
|
})) {
|
||||||
|
a.href = href;
|
||||||
|
} else {
|
||||||
|
return a.firstChild;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m = t.match(/-mode:"([^"]+)"/)) {
|
||||||
|
type = m[1].toLowerCase();
|
||||||
|
a.dataset.indexMode = (function() {
|
||||||
|
switch (type) {
|
||||||
|
case 'all threads':
|
||||||
|
return 'all pages';
|
||||||
|
case 'paged':
|
||||||
|
case 'catalog':
|
||||||
|
return type;
|
||||||
|
default:
|
||||||
|
return 'paged';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
if (m = t.match(/-sort:"([^"]+)"/)) {
|
||||||
|
type = m[1].toLowerCase();
|
||||||
|
a.dataset.indexSort = (function() {
|
||||||
|
switch (type) {
|
||||||
|
case 'bump order':
|
||||||
|
return 'bump';
|
||||||
|
case 'last reply':
|
||||||
|
return 'lastreply';
|
||||||
|
case 'creation date':
|
||||||
|
return 'birth';
|
||||||
|
case 'reply count':
|
||||||
|
return 'replycount';
|
||||||
|
case 'file count':
|
||||||
|
return 'filecount';
|
||||||
|
default:
|
||||||
|
return 'bump';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
if (boardID === '@') {
|
||||||
|
$.addClass(a, 'navSmall');
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
},
|
||||||
toggleBoardList: function() {
|
toggleBoardList: function() {
|
||||||
var bar, custom, full, showBoardList;
|
var bar, custom, full, showBoardList;
|
||||||
bar = Header.bar;
|
bar = Header.bar;
|
||||||
@ -14172,7 +14190,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
sendEvent = function() {
|
sendEvent = function() {
|
||||||
var ipCountEl;
|
var ipCountEl, post;
|
||||||
if ((OP.unique_ips != null) && (ipCountEl = $.id('unique-ips'))) {
|
if ((OP.unique_ips != null) && (ipCountEl = $.id('unique-ips'))) {
|
||||||
ipCountEl.textContent = OP.unique_ips;
|
ipCountEl.textContent = OP.unique_ips;
|
||||||
ipCountEl.previousSibling.textContent = ipCountEl.previousSibling.textContent.replace(/\b(?:is|are)\b/, OP.unique_ips === 1 ? 'is' : 'are');
|
ipCountEl.previousSibling.textContent = ipCountEl.previousSibling.textContent.replace(/\b(?:is|are)\b/, OP.unique_ips === 1 ? 'is' : 'are');
|
||||||
@ -14182,9 +14200,15 @@
|
|||||||
return $.event('ThreadUpdate', {
|
return $.event('ThreadUpdate', {
|
||||||
404: false,
|
404: false,
|
||||||
threadID: ThreadUpdater.thread.fullID,
|
threadID: ThreadUpdater.thread.fullID,
|
||||||
newPosts: posts.map(function(post) {
|
newPosts: (function() {
|
||||||
return post.fullID;
|
var _j, _len1, _results;
|
||||||
}),
|
_results = [];
|
||||||
|
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
||||||
|
post = posts[_j];
|
||||||
|
_results.push(post.fullID);
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
})(),
|
||||||
postCount: OP.replies + 1,
|
postCount: OP.replies + 1,
|
||||||
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead),
|
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead),
|
||||||
ipCount: OP.unique_ips
|
ipCount: OP.unique_ips
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.44 - 2015-01-12
|
* appchan x - Version 2.9.44 - 2015-01-13
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -4572,7 +4572,7 @@
|
|||||||
return $.sync('boardnav', Header.generateBoardList);
|
return $.sync('boardnav', Header.generateBoardList);
|
||||||
},
|
},
|
||||||
generateBoardList: function(boardnav) {
|
generateBoardList: function(boardnav) {
|
||||||
var as, list, nodes, re;
|
var as, list, nodes, re, t;
|
||||||
list = $('#custom-board-list', Header.boardList);
|
list = $('#custom-board-list', Header.boardList);
|
||||||
$.rmAll(list);
|
$.rmAll(list);
|
||||||
if (!boardnav) {
|
if (!boardnav) {
|
||||||
@ -4581,103 +4581,113 @@
|
|||||||
boardnav = boardnav.replace(/(\r\n|\n|\r)/g, ' ');
|
boardnav = boardnav.replace(/(\r\n|\n|\r)/g, ' ');
|
||||||
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 = boardnav.match(re).map(function(t) {
|
nodes = (function() {
|
||||||
var a, boardID, href, m, text, type, url, _i, _len;
|
var _i, _len, _ref, _results;
|
||||||
if (/^[^\w@]/.test(t)) {
|
_ref = boardnav.match(re);
|
||||||
return $.tn(t);
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
t = _ref[_i];
|
||||||
|
_results.push(Header.mapCustomNavigation(t, as));
|
||||||
}
|
}
|
||||||
text = url = null;
|
return _results;
|
||||||
t = t.replace(/-text:"([^"]+)"(?:,"([^"]+)")?/g, function(m0, m1, m2) {
|
})();
|
||||||
text = m1;
|
|
||||||
url = m2;
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
if (/^toggle-all/.test(t)) {
|
|
||||||
a = $.el('a', {
|
|
||||||
className: 'show-board-list-button',
|
|
||||||
textContent: text || '+',
|
|
||||||
href: 'javascript:;'
|
|
||||||
});
|
|
||||||
$.on(a, 'click', Header.toggleBoardList);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
if (/^external/.test(t)) {
|
|
||||||
a = $.el('a', {
|
|
||||||
href: url || 'javascript:;',
|
|
||||||
textContent: text || '+',
|
|
||||||
className: 'external'
|
|
||||||
});
|
|
||||||
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
|
||||||
a.className += ' current';
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
boardID = t.split('-')[0];
|
|
||||||
if (boardID === 'current') {
|
|
||||||
boardID = g.BOARD.ID;
|
|
||||||
}
|
|
||||||
for (_i = 0, _len = as.length; _i < _len; _i++) {
|
|
||||||
a = as[_i];
|
|
||||||
if (!(a.textContent === boardID)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
a = a.cloneNode();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (Conf['JSON Navigation']) {
|
|
||||||
$.on(a, 'click', Navigate.navigate);
|
|
||||||
}
|
|
||||||
a.textContent = /-title/.test(t) || /-replace/.test(t) && boardID === g.BOARD.ID ? a.title : /-full/.test(t) ? "/" + boardID + "/ - " + a.title : (m = t.match(/-text:"([^"]+)"/)) ? m[1] : boardID;
|
|
||||||
if (/-archive/.test(t)) {
|
|
||||||
if (href = Redirect.to('board', {
|
|
||||||
boardID: boardID
|
|
||||||
})) {
|
|
||||||
a.href = href;
|
|
||||||
} else {
|
|
||||||
return a.firstChild;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m = t.match(/-mode:"([^"]+)"/)) {
|
|
||||||
type = m[1].toLowerCase();
|
|
||||||
a.dataset.indexMode = (function() {
|
|
||||||
switch (type) {
|
|
||||||
case 'all threads':
|
|
||||||
return 'all pages';
|
|
||||||
case 'paged':
|
|
||||||
case 'catalog':
|
|
||||||
return type;
|
|
||||||
default:
|
|
||||||
return 'paged';
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
if (m = t.match(/-sort:"([^"]+)"/)) {
|
|
||||||
type = m[1].toLowerCase();
|
|
||||||
a.dataset.indexSort = (function() {
|
|
||||||
switch (type) {
|
|
||||||
case 'bump order':
|
|
||||||
return 'bump';
|
|
||||||
case 'last reply':
|
|
||||||
return 'lastreply';
|
|
||||||
case 'creation date':
|
|
||||||
return 'birth';
|
|
||||||
case 'reply count':
|
|
||||||
return 'replycount';
|
|
||||||
case 'file count':
|
|
||||||
return 'filecount';
|
|
||||||
default:
|
|
||||||
return 'bump';
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
if (boardID === '@') {
|
|
||||||
$.addClass(a, 'navSmall');
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
});
|
|
||||||
$.add(list, nodes);
|
$.add(list, nodes);
|
||||||
return $.ready(CatalogLinks.initBoardList);
|
return $.ready(CatalogLinks.initBoardList);
|
||||||
},
|
},
|
||||||
|
mapCustomNavigation: function(t, as) {
|
||||||
|
var a, boardID, href, m, text, type, url, _i, _len;
|
||||||
|
if (/^[^\w@]/.test(t)) {
|
||||||
|
return $.tn(t);
|
||||||
|
}
|
||||||
|
text = url = null;
|
||||||
|
t = t.replace(/-text:"([^"]+)"(?:,"([^"]+)")?/g, function(m0, m1, m2) {
|
||||||
|
text = m1;
|
||||||
|
url = m2;
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
if (/^toggle-all/.test(t)) {
|
||||||
|
a = $.el('a', {
|
||||||
|
className: 'show-board-list-button',
|
||||||
|
textContent: text || '+',
|
||||||
|
href: 'javascript:;'
|
||||||
|
});
|
||||||
|
$.on(a, 'click', Header.toggleBoardList);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (/^external/.test(t)) {
|
||||||
|
a = $.el('a', {
|
||||||
|
href: url || 'javascript:;',
|
||||||
|
textContent: text || '+',
|
||||||
|
className: 'external'
|
||||||
|
});
|
||||||
|
if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) {
|
||||||
|
a.className += ' current';
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
boardID = t.split('-')[0];
|
||||||
|
if (boardID === 'current') {
|
||||||
|
boardID = g.BOARD.ID;
|
||||||
|
}
|
||||||
|
for (_i = 0, _len = as.length; _i < _len; _i++) {
|
||||||
|
a = as[_i];
|
||||||
|
if (!(a.textContent === boardID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
a = a.cloneNode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Conf['JSON Navigation']) {
|
||||||
|
$.on(a, 'click', Navigate.navigate);
|
||||||
|
}
|
||||||
|
a.textContent = /-title/.test(t) || /-replace/.test(t) && boardID === g.BOARD.ID ? a.title : /-full/.test(t) ? "/" + boardID + "/ - " + a.title : (m = t.match(/-text:"([^"]+)"/)) ? m[1] : boardID;
|
||||||
|
if (/-archive/.test(t)) {
|
||||||
|
if (href = Redirect.to('board', {
|
||||||
|
boardID: boardID
|
||||||
|
})) {
|
||||||
|
a.href = href;
|
||||||
|
} else {
|
||||||
|
return a.firstChild;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m = t.match(/-mode:"([^"]+)"/)) {
|
||||||
|
type = m[1].toLowerCase();
|
||||||
|
a.dataset.indexMode = (function() {
|
||||||
|
switch (type) {
|
||||||
|
case 'all threads':
|
||||||
|
return 'all pages';
|
||||||
|
case 'paged':
|
||||||
|
case 'catalog':
|
||||||
|
return type;
|
||||||
|
default:
|
||||||
|
return 'paged';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
if (m = t.match(/-sort:"([^"]+)"/)) {
|
||||||
|
type = m[1].toLowerCase();
|
||||||
|
a.dataset.indexSort = (function() {
|
||||||
|
switch (type) {
|
||||||
|
case 'bump order':
|
||||||
|
return 'bump';
|
||||||
|
case 'last reply':
|
||||||
|
return 'lastreply';
|
||||||
|
case 'creation date':
|
||||||
|
return 'birth';
|
||||||
|
case 'reply count':
|
||||||
|
return 'replycount';
|
||||||
|
case 'file count':
|
||||||
|
return 'filecount';
|
||||||
|
default:
|
||||||
|
return 'bump';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
if (boardID === '@') {
|
||||||
|
$.addClass(a, 'navSmall');
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
},
|
||||||
toggleBoardList: function() {
|
toggleBoardList: function() {
|
||||||
var bar, custom, full, showBoardList;
|
var bar, custom, full, showBoardList;
|
||||||
bar = Header.bar;
|
bar = Header.bar;
|
||||||
@ -14196,7 +14206,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
sendEvent = function() {
|
sendEvent = function() {
|
||||||
var ipCountEl;
|
var ipCountEl, post;
|
||||||
if ((OP.unique_ips != null) && (ipCountEl = $.id('unique-ips'))) {
|
if ((OP.unique_ips != null) && (ipCountEl = $.id('unique-ips'))) {
|
||||||
ipCountEl.textContent = OP.unique_ips;
|
ipCountEl.textContent = OP.unique_ips;
|
||||||
ipCountEl.previousSibling.textContent = ipCountEl.previousSibling.textContent.replace(/\b(?:is|are)\b/, OP.unique_ips === 1 ? 'is' : 'are');
|
ipCountEl.previousSibling.textContent = ipCountEl.previousSibling.textContent.replace(/\b(?:is|are)\b/, OP.unique_ips === 1 ? 'is' : 'are');
|
||||||
@ -14206,9 +14216,15 @@
|
|||||||
return $.event('ThreadUpdate', {
|
return $.event('ThreadUpdate', {
|
||||||
404: false,
|
404: false,
|
||||||
threadID: ThreadUpdater.thread.fullID,
|
threadID: ThreadUpdater.thread.fullID,
|
||||||
newPosts: posts.map(function(post) {
|
newPosts: (function() {
|
||||||
return post.fullID;
|
var _j, _len1, _results;
|
||||||
}),
|
_results = [];
|
||||||
|
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
||||||
|
post = posts[_j];
|
||||||
|
_results.push(post.fullID);
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
})(),
|
||||||
postCount: OP.replies + 1,
|
postCount: OP.replies + 1,
|
||||||
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead),
|
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead),
|
||||||
ipCount: OP.unique_ips
|
ipCount: OP.unique_ips
|
||||||
|
|||||||
@ -160,80 +160,81 @@ Header =
|
|||||||
boardnav = boardnav.replace /(\r\n|\n|\r)/g, ' '
|
boardnav = boardnav.replace /(\r\n|\n|\r)/g, ' '
|
||||||
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 = boardnav.match(re).map (t) ->
|
nodes = (Header.mapCustomNavigation t, as for t in boardnav.match re)
|
||||||
if /^[^\w@]/.test t
|
|
||||||
return $.tn t
|
|
||||||
|
|
||||||
text = url = null
|
|
||||||
t = t.replace /-text:"([^"]+)"(?:,"([^"]+)")?/g, (m0, m1, m2) ->
|
|
||||||
text = m1
|
|
||||||
url = m2
|
|
||||||
''
|
|
||||||
|
|
||||||
if /^toggle-all/.test t
|
|
||||||
a = $.el 'a',
|
|
||||||
className: 'show-board-list-button'
|
|
||||||
textContent: text or '+'
|
|
||||||
href: 'javascript:;'
|
|
||||||
$.on a, 'click', Header.toggleBoardList
|
|
||||||
return a
|
|
||||||
|
|
||||||
if /^external/.test t
|
|
||||||
a = $.el 'a',
|
|
||||||
href: url or 'javascript:;'
|
|
||||||
textContent: text or '+'
|
|
||||||
className: 'external'
|
|
||||||
if a.hostname is 'boards.4chan.org' and a.pathname.split('/')[1] is g.BOARD.ID
|
|
||||||
a.className += ' current'
|
|
||||||
return a
|
|
||||||
|
|
||||||
boardID = t.split('-')[0]
|
|
||||||
boardID = g.BOARD.ID if boardID is 'current'
|
|
||||||
for a in as when a.textContent is boardID
|
|
||||||
a = a.cloneNode()
|
|
||||||
break
|
|
||||||
|
|
||||||
if Conf['JSON Navigation']
|
|
||||||
$.on a, 'click', Navigate.navigate
|
|
||||||
|
|
||||||
a.textContent = if /-title/.test(t) or /-replace/.test(t) and boardID is g.BOARD.ID
|
|
||||||
a.title
|
|
||||||
else if /-full/.test t
|
|
||||||
"/#{boardID}/ - #{a.title}"
|
|
||||||
else if m = t.match /-text:"([^"]+)"/
|
|
||||||
m[1]
|
|
||||||
else
|
|
||||||
boardID
|
|
||||||
|
|
||||||
if /-archive/.test t
|
|
||||||
if href = Redirect.to 'board', {boardID}
|
|
||||||
a.href = href
|
|
||||||
else
|
|
||||||
return a.firstChild # Its text node.
|
|
||||||
|
|
||||||
if m = t.match /-mode:"([^"]+)"/
|
|
||||||
type = m[1].toLowerCase()
|
|
||||||
a.dataset.indexMode = switch type
|
|
||||||
when 'all threads' then 'all pages'
|
|
||||||
when 'paged', 'catalog' then type
|
|
||||||
else 'paged'
|
|
||||||
|
|
||||||
if m = t.match /-sort:"([^"]+)"/
|
|
||||||
type = m[1].toLowerCase()
|
|
||||||
a.dataset.indexSort = switch type
|
|
||||||
when 'bump order' then 'bump'
|
|
||||||
when 'last reply' then 'lastreply'
|
|
||||||
when 'creation date' then 'birth'
|
|
||||||
when 'reply count' then 'replycount'
|
|
||||||
when 'file count' then 'filecount'
|
|
||||||
else 'bump'
|
|
||||||
|
|
||||||
$.addClass a, 'navSmall' if boardID is '@'
|
|
||||||
a
|
|
||||||
|
|
||||||
$.add list, nodes
|
$.add list, nodes
|
||||||
$.ready CatalogLinks.initBoardList
|
$.ready CatalogLinks.initBoardList
|
||||||
|
|
||||||
|
mapCustomNavigation: (t, as) ->
|
||||||
|
if /^[^\w@]/.test t
|
||||||
|
return $.tn t
|
||||||
|
|
||||||
|
text = url = null
|
||||||
|
t = t.replace /-text:"([^"]+)"(?:,"([^"]+)")?/g, (m0, m1, m2) ->
|
||||||
|
text = m1
|
||||||
|
url = m2
|
||||||
|
''
|
||||||
|
|
||||||
|
if /^toggle-all/.test t
|
||||||
|
a = $.el 'a',
|
||||||
|
className: 'show-board-list-button'
|
||||||
|
textContent: text or '+'
|
||||||
|
href: 'javascript:;'
|
||||||
|
$.on a, 'click', Header.toggleBoardList
|
||||||
|
return a
|
||||||
|
|
||||||
|
if /^external/.test t
|
||||||
|
a = $.el 'a',
|
||||||
|
href: url or 'javascript:;'
|
||||||
|
textContent: text or '+'
|
||||||
|
className: 'external'
|
||||||
|
if a.hostname is 'boards.4chan.org' and a.pathname.split('/')[1] is g.BOARD.ID
|
||||||
|
a.className += ' current'
|
||||||
|
return a
|
||||||
|
|
||||||
|
boardID = t.split('-')[0]
|
||||||
|
boardID = g.BOARD.ID if boardID is 'current'
|
||||||
|
for a in as when a.textContent is boardID
|
||||||
|
a = a.cloneNode()
|
||||||
|
break
|
||||||
|
|
||||||
|
if Conf['JSON Navigation']
|
||||||
|
$.on a, 'click', Navigate.navigate
|
||||||
|
|
||||||
|
a.textContent = if /-title/.test(t) or /-replace/.test(t) and boardID is g.BOARD.ID
|
||||||
|
a.title
|
||||||
|
else if /-full/.test t
|
||||||
|
"/#{boardID}/ - #{a.title}"
|
||||||
|
else if m = t.match /-text:"([^"]+)"/
|
||||||
|
m[1]
|
||||||
|
else
|
||||||
|
boardID
|
||||||
|
|
||||||
|
if /-archive/.test t
|
||||||
|
if href = Redirect.to 'board', {boardID}
|
||||||
|
a.href = href
|
||||||
|
else
|
||||||
|
return a.firstChild # Its text node.
|
||||||
|
|
||||||
|
if m = t.match /-mode:"([^"]+)"/
|
||||||
|
type = m[1].toLowerCase()
|
||||||
|
a.dataset.indexMode = switch type
|
||||||
|
when 'all threads' then 'all pages'
|
||||||
|
when 'paged', 'catalog' then type
|
||||||
|
else 'paged'
|
||||||
|
|
||||||
|
if m = t.match /-sort:"([^"]+)"/
|
||||||
|
type = m[1].toLowerCase()
|
||||||
|
a.dataset.indexSort = switch type
|
||||||
|
when 'bump order' then 'bump'
|
||||||
|
when 'last reply' then 'lastreply'
|
||||||
|
when 'creation date' then 'birth'
|
||||||
|
when 'reply count' then 'replycount'
|
||||||
|
when 'file count' then 'filecount'
|
||||||
|
else 'bump'
|
||||||
|
|
||||||
|
$.addClass a, 'navSmall' if boardID is '@'
|
||||||
|
a
|
||||||
|
|
||||||
toggleBoardList: ->
|
toggleBoardList: ->
|
||||||
{bar} = Header
|
{bar} = Header
|
||||||
custom = $ '#custom-board-list', bar
|
custom = $ '#custom-board-list', bar
|
||||||
|
|||||||
@ -476,7 +476,7 @@ $.set = do ->
|
|||||||
set key, val
|
set key, val
|
||||||
return
|
return
|
||||||
$.clear = (cb) ->
|
$.clear = (cb) ->
|
||||||
$.delete GM_listValues().map (key) -> key.replace g.NAMESPACE, ''
|
$.delete (key.replace g.NAMESPACE, '' for key in GM_listValues())
|
||||||
cb?()
|
cb?()
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|||||||
@ -357,7 +357,7 @@ ThreadUpdater =
|
|||||||
$.event 'ThreadUpdate',
|
$.event 'ThreadUpdate',
|
||||||
404: false
|
404: false
|
||||||
threadID: ThreadUpdater.thread.fullID
|
threadID: ThreadUpdater.thread.fullID
|
||||||
newPosts: posts.map (post) -> post.fullID
|
newPosts: (post.fullID for post in posts)
|
||||||
postCount: OP.replies + 1
|
postCount: OP.replies + 1
|
||||||
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
||||||
ipCount: OP.unique_ips
|
ipCount: OP.unique_ips
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user