Single-handedly one of the most expensive features in 4chan X?

LETS ADD RECURSION!
This commit is contained in:
Zixaphir 2013-08-11 23:31:33 -07:00
parent 708f56c759
commit 045ba42296
3 changed files with 20 additions and 11 deletions

View File

@ -4450,7 +4450,7 @@
}
Linkify.regString.lastIndex = 0;
if (match) {
links.push(Linkify.seek(snapshot, node, match, i));
links.push(Linkify.seek(snapshot, post, node, match, i));
}
_ref = links.reverse();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -4458,8 +4458,8 @@
Linkify.makeLink(range, post);
}
},
seek: function(snapshot, node, match, i) {
var data, link, next, range, result;
seek: function(snapshot, post, node, match, i) {
var data, index, link, next, range, result;
link = match[0];
range = document.createRange();
@ -4468,7 +4468,10 @@
node = next;
data = node.data;
if (result = /[\s'"]/.exec(data)) {
range.setEnd(node, result.index);
index = result.index;
range.setEnd(node, index);
Linkify.regString.lastIndex = index;
Linkify.gatherLinks(snapshot, post, node, i);
}
}
if (range.collapsed) {

View File

@ -4455,7 +4455,7 @@
}
Linkify.regString.lastIndex = 0;
if (match) {
links.push(Linkify.seek(snapshot, node, match, i));
links.push(Linkify.seek(snapshot, post, node, match, i));
}
_ref = links.reverse();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -4463,8 +4463,8 @@
Linkify.makeLink(range, post);
}
},
seek: function(snapshot, node, match, i) {
var data, link, next, range, result;
seek: function(snapshot, post, node, match, i) {
var data, index, link, next, range, result;
link = match[0];
range = document.createRange();
@ -4473,7 +4473,10 @@
node = next;
data = node.data;
if (result = /[\s'"]/.exec(data)) {
range.setEnd(node, result.index);
index = result.index;
range.setEnd(node, index);
Linkify.regString.lastIndex = index;
Linkify.gatherLinks(snapshot, post, node, i);
}
}
if (range.collapsed) {

View File

@ -84,14 +84,14 @@ Linkify =
Linkify.regString.lastIndex = 0
if match
links.push Linkify.seek snapshot, node, match, i
links.push Linkify.seek snapshot, post, node, match, i
for range in links.reverse()
Linkify.makeLink range, post
return
seek: (snapshot, node, match, i) ->
seek: (snapshot, post, node, match, i) ->
link = match[0]
range = document.createRange()
range.setStart node, match.index
@ -100,7 +100,10 @@ Linkify =
node = next
data = node.data
if result = /[\s'"]/.exec data
range.setEnd node, result.index
{index} = result
range.setEnd node, index
Linkify.regString.lastIndex = index
Linkify.gatherLinks snapshot, post, node, i
if range.collapsed
range.setEndAfter node