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,7 +4563,20 @@
|
|||||||
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 _i, _len, _ref, _results;
|
||||||
|
_ref = boardnav.match(re);
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
t = _ref[_i];
|
||||||
|
_results.push(Header.mapCustomNavigation(t, as));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
})();
|
||||||
|
$.add(list, nodes);
|
||||||
|
return $.ready(CatalogLinks.initBoardList);
|
||||||
|
},
|
||||||
|
mapCustomNavigation: function(t, as) {
|
||||||
var a, boardID, href, m, text, type, url, _i, _len;
|
var a, boardID, href, m, text, type, url, _i, _len;
|
||||||
if (/^[^\w@]/.test(t)) {
|
if (/^[^\w@]/.test(t)) {
|
||||||
return $.tn(t);
|
return $.tn(t);
|
||||||
@ -4648,9 +4669,6 @@
|
|||||||
$.addClass(a, 'navSmall');
|
$.addClass(a, 'navSmall');
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
});
|
|
||||||
$.add(list, nodes);
|
|
||||||
return $.ready(CatalogLinks.initBoardList);
|
|
||||||
},
|
},
|
||||||
toggleBoardList: function() {
|
toggleBoardList: function() {
|
||||||
var bar, custom, full, showBoardList;
|
var bar, custom, full, showBoardList;
|
||||||
@ -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,7 +4581,20 @@
|
|||||||
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 _i, _len, _ref, _results;
|
||||||
|
_ref = boardnav.match(re);
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
t = _ref[_i];
|
||||||
|
_results.push(Header.mapCustomNavigation(t, as));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
})();
|
||||||
|
$.add(list, nodes);
|
||||||
|
return $.ready(CatalogLinks.initBoardList);
|
||||||
|
},
|
||||||
|
mapCustomNavigation: function(t, as) {
|
||||||
var a, boardID, href, m, text, type, url, _i, _len;
|
var a, boardID, href, m, text, type, url, _i, _len;
|
||||||
if (/^[^\w@]/.test(t)) {
|
if (/^[^\w@]/.test(t)) {
|
||||||
return $.tn(t);
|
return $.tn(t);
|
||||||
@ -4674,9 +4687,6 @@
|
|||||||
$.addClass(a, 'navSmall');
|
$.addClass(a, 'navSmall');
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
});
|
|
||||||
$.add(list, nodes);
|
|
||||||
return $.ready(CatalogLinks.initBoardList);
|
|
||||||
},
|
},
|
||||||
toggleBoardList: function() {
|
toggleBoardList: function() {
|
||||||
var bar, custom, full, showBoardList;
|
var bar, custom, full, showBoardList;
|
||||||
@ -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,7 +160,11 @@ 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)
|
||||||
|
$.add list, nodes
|
||||||
|
$.ready CatalogLinks.initBoardList
|
||||||
|
|
||||||
|
mapCustomNavigation: (t, as) ->
|
||||||
if /^[^\w@]/.test t
|
if /^[^\w@]/.test t
|
||||||
return $.tn t
|
return $.tn t
|
||||||
|
|
||||||
@ -231,9 +235,6 @@ Header =
|
|||||||
$.addClass a, 'navSmall' if boardID is '@'
|
$.addClass a, 'navSmall' if boardID is '@'
|
||||||
a
|
a
|
||||||
|
|
||||||
$.add list, nodes
|
|
||||||
$.ready CatalogLinks.initBoardList
|
|
||||||
|
|
||||||
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