Lets... not store a useless RegExp string in memory.
This commit is contained in:
parent
1151591472
commit
f16cef118f
@ -4107,7 +4107,7 @@
|
|||||||
if (g.VIEW === 'catalog' || !Conf['Linkify']) {
|
if (g.VIEW === 'catalog' || !Conf['Linkify']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.regString = Conf['Allow False Positives'] ? this.regLooseString : this.regStrictString;
|
this.regString = Conf['Allow False Positives'] ? /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi : /(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi;
|
||||||
if (Conf['Comment Expansion']) {
|
if (Conf['Comment Expansion']) {
|
||||||
ExpandComment.callbacks.push(this.node);
|
ExpandComment.callbacks.push(this.node);
|
||||||
}
|
}
|
||||||
@ -4116,8 +4116,6 @@
|
|||||||
cb: this.node
|
cb: this.node
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
regLooseString: /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi,
|
|
||||||
regStrictString: /(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi,
|
|
||||||
cypher: $.el('div'),
|
cypher: $.el('div'),
|
||||||
node: function() {
|
node: function() {
|
||||||
var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2;
|
var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2;
|
||||||
|
|||||||
@ -4103,7 +4103,7 @@
|
|||||||
if (g.VIEW === 'catalog' || !Conf['Linkify']) {
|
if (g.VIEW === 'catalog' || !Conf['Linkify']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.regString = Conf['Allow False Positives'] ? this.regLooseString : this.regStrictString;
|
this.regString = Conf['Allow False Positives'] ? /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi : /(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi;
|
||||||
if (Conf['Comment Expansion']) {
|
if (Conf['Comment Expansion']) {
|
||||||
ExpandComment.callbacks.push(this.node);
|
ExpandComment.callbacks.push(this.node);
|
||||||
}
|
}
|
||||||
@ -4112,8 +4112,6 @@
|
|||||||
cb: this.node
|
cb: this.node
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
regLooseString: /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi,
|
|
||||||
regStrictString: /(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi,
|
|
||||||
cypher: $.el('div'),
|
cypher: $.el('div'),
|
||||||
node: function() {
|
node: function() {
|
||||||
var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2;
|
var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2;
|
||||||
|
|||||||
@ -4105,7 +4105,7 @@
|
|||||||
if (g.VIEW === 'catalog' || !Conf['Linkify']) {
|
if (g.VIEW === 'catalog' || !Conf['Linkify']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.regString = Conf['Allow False Positives'] ? this.regLooseString : this.regStrictString;
|
this.regString = Conf['Allow False Positives'] ? /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi : /(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi;
|
||||||
if (Conf['Comment Expansion']) {
|
if (Conf['Comment Expansion']) {
|
||||||
ExpandComment.callbacks.push(this.node);
|
ExpandComment.callbacks.push(this.node);
|
||||||
}
|
}
|
||||||
@ -4114,8 +4114,6 @@
|
|||||||
cb: this.node
|
cb: this.node
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
regLooseString: /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi,
|
|
||||||
regStrictString: /(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi,
|
|
||||||
cypher: $.el('div'),
|
cypher: $.el('div'),
|
||||||
node: function() {
|
node: function() {
|
||||||
var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2;
|
var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2;
|
||||||
|
|||||||
@ -2,7 +2,25 @@ Linkify =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW is 'catalog' or not Conf['Linkify']
|
return if g.VIEW is 'catalog' or not Conf['Linkify']
|
||||||
|
|
||||||
@regString = if Conf['Allow False Positives'] then @regLooseString else @regStrictString
|
@regString = if Conf['Allow False Positives']
|
||||||
|
///(
|
||||||
|
\b(
|
||||||
|
[a-z]+://
|
||||||
|
|
|
||||||
|
[a-z]{3,}\.[-a-z0-9]+\.[a-z]+
|
||||||
|
|
|
||||||
|
[-a-z0-9]+\.[a-z]
|
||||||
|
|
|
||||||
|
[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+
|
||||||
|
|
|
||||||
|
[a-z]{3,}:[a-z0-9?]
|
||||||
|
|
|
||||||
|
[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9]
|
||||||
|
)
|
||||||
|
[^\s'"]+
|
||||||
|
)///gi
|
||||||
|
else
|
||||||
|
/(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi
|
||||||
|
|
||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
@ -11,25 +29,6 @@ Linkify =
|
|||||||
name: 'Linkify'
|
name: 'Linkify'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
regLooseString: ///(
|
|
||||||
\b(
|
|
||||||
[a-z]+://
|
|
||||||
|
|
|
||||||
[a-z]{3,}\.[-a-z0-9]+\.[a-z]+
|
|
||||||
|
|
|
||||||
[-a-z0-9]+\.[a-z]
|
|
||||||
|
|
|
||||||
[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+
|
|
||||||
|
|
|
||||||
[a-z]{3,}:[a-z0-9?]
|
|
||||||
|
|
|
||||||
[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9]
|
|
||||||
)
|
|
||||||
[^\s'"]+
|
|
||||||
)///gi
|
|
||||||
|
|
||||||
regStrictString: ///(((magnet|mailto)\:|(www\.)|(news|(ht|f)tp(s?))\://){1}\S+)///gi
|
|
||||||
|
|
||||||
cypher: $.el 'div'
|
cypher: $.el 'div'
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user