Lets just build that so that we don't have to do so many logic checks

This commit is contained in:
Zixaphir 2014-03-30 18:24:42 -07:00
parent 393eb3ec22
commit bbc8899cf1
3 changed files with 20 additions and 26 deletions

View File

@ -8494,6 +8494,9 @@
if (Conf['Comment Expansion']) {
ExpandComment.callbacks.push(this.node);
}
if (Conf['Embedding'] || Conf['Link Title']) {
this.embedProcess = Function('link', "var data = this.services(link); if (data) { " + ((Conf['Embedding'] ? 'this.embed(data);\n' : '') + (Conf['Title Link'] ? 'this.title(data);' : '')) + " }");
}
return Post.callbacks.push({
name: 'Linkify',
cb: this.node
@ -8563,17 +8566,7 @@
Linkify.embedProcess(Linkify.makeLink(link, this));
}
},
embedProcess: function(link) {
var data;
if (data = Linkify.services(link)) {
if (Conf['Embedding']) {
Linkify.embed(data);
}
if (Conf['Link Title']) {
return Linkify.title(data);
}
}
},
embedProcess: function() {},
regString: /((https?|mailto|git|magnet|ftp|irc):([a-z\d%\/])|[-a-z\d]+[.](aero|asia|biz|cat|com|coop|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil|[a-z]{2})([:\/]|(?!.))|[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}|[-\w\d.@]+@[a-z\d.-]+\.[a-z\d])/i,
makeRange: function(startNode, endNode, startOffset, endOffset) {
var range;

View File

@ -8511,6 +8511,9 @@
if (Conf['Comment Expansion']) {
ExpandComment.callbacks.push(this.node);
}
if (Conf['Embedding'] || Conf['Link Title']) {
this.embedProcess = Function('link', "var data = this.services(link); if (data) { " + ((Conf['Embedding'] ? 'this.embed(data);\n' : '') + (Conf['Title Link'] ? 'this.title(data);' : '')) + " }");
}
return Post.callbacks.push({
name: 'Linkify',
cb: this.node
@ -8580,17 +8583,7 @@
Linkify.embedProcess(Linkify.makeLink(link, this));
}
},
embedProcess: function(link) {
var data;
if (data = Linkify.services(link)) {
if (Conf['Embedding']) {
Linkify.embed(data);
}
if (Conf['Link Title']) {
return Linkify.title(data);
}
}
},
embedProcess: function() {},
regString: /((https?|mailto|git|magnet|ftp|irc):([a-z\d%\/])|[-a-z\d]+[.](aero|asia|biz|cat|com|coop|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil|[a-z]{2})([:\/]|(?!.))|[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}|[-\w\d.@]+@[a-z\d.-]+\.[a-z\d])/i,
makeRange: function(startNode, endNode, startOffset, endOffset) {
var range;

View File

@ -5,6 +5,17 @@ Linkify =
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
if Conf['Embedding'] or Conf['Link Title']
@embedProcess = Function 'link',
"var data = this.services(link);
if (data) {
#{
(if Conf['Embedding'] then 'this.embed(data);\n' else '') +
if Conf['Title Link'] then 'this.title(data);' else ''
}
}
"
Post.callbacks.push
name: 'Linkify'
cb: @node
@ -63,10 +74,7 @@ Linkify =
Linkify.embedProcess Linkify.makeLink link, @
return
embedProcess: (link) ->
if data = Linkify.services link
Linkify.embed data if Conf['Embedding']
Linkify.title data if Conf['Link Title']
embedProcess: -> return
regString: ///(
# http, magnet, ftp, etc