Come on, I'm smarter than this
This commit is contained in:
parent
68e19a0b2e
commit
fb8a856fba
@ -4525,7 +4525,7 @@
|
|||||||
return range;
|
return range;
|
||||||
},
|
},
|
||||||
makeLink: function(range) {
|
makeLink: function(range) {
|
||||||
var a, char, i, len, text, toggle, trim;
|
var a, char, len, text, trim;
|
||||||
|
|
||||||
text = range.toString();
|
text = range.toString();
|
||||||
trim = function() {
|
trim = function() {
|
||||||
@ -4541,20 +4541,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (/[)\]}>.,]/.test(char = text.charAt((len = text.length) - 1))) {
|
while (/[)\]}>.,]/.test(char = text.charAt((len = text.length) - 1))) {
|
||||||
if (/[.,]/.test(char)) {
|
if (/[.,]/.test(char) || (text.match(/[()\[\]{}<>]/)).length % 2) {
|
||||||
trim();
|
trim();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
i = 0;
|
|
||||||
toggle = false;
|
|
||||||
while (i < len) {
|
|
||||||
if (/[()\[\]{}<>]/.test(text[i++])) {
|
|
||||||
toggle = !toggle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (toggle) {
|
|
||||||
trim();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
text = text.contains(':') ? text : (text.contains('@') ? 'mailto:' : 'http://') + text;
|
text = text.contains(':') ? text : (text.contains('@') ? 'mailto:' : 'http://') + text;
|
||||||
|
|||||||
@ -4531,7 +4531,7 @@
|
|||||||
return range;
|
return range;
|
||||||
},
|
},
|
||||||
makeLink: function(range) {
|
makeLink: function(range) {
|
||||||
var a, char, i, len, text, toggle, trim;
|
var a, char, len, text, trim;
|
||||||
|
|
||||||
text = range.toString();
|
text = range.toString();
|
||||||
trim = function() {
|
trim = function() {
|
||||||
@ -4547,20 +4547,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (/[)\]}>.,]/.test(char = text.charAt((len = text.length) - 1))) {
|
while (/[)\]}>.,]/.test(char = text.charAt((len = text.length) - 1))) {
|
||||||
if (/[.,]/.test(char)) {
|
if (/[.,]/.test(char) || (text.match(/[()\[\]{}<>]/)).length % 2) {
|
||||||
trim();
|
trim();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
i = 0;
|
|
||||||
toggle = false;
|
|
||||||
while (i < len) {
|
|
||||||
if (/[()\[\]{}<>]/.test(text[i++])) {
|
|
||||||
toggle = !toggle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (toggle) {
|
|
||||||
trim();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
text = text.contains(':') ? text : (text.contains('@') ? 'mailto:' : 'http://') + text;
|
text = text.contains(':') ? text : (text.contains('@') ? 'mailto:' : 'http://') + text;
|
||||||
|
|||||||
@ -118,15 +118,9 @@ Linkify =
|
|||||||
|
|
||||||
# Clean hanging brackets, commas, periods
|
# Clean hanging brackets, commas, periods
|
||||||
while /[)\]}>.,]/.test char = text.charAt (len = text.length) - 1
|
while /[)\]}>.,]/.test char = text.charAt (len = text.length) - 1
|
||||||
if /[.,]/.test char
|
if /[.,]/.test(char) or (text.match /[()\[\]{}<>]/).length % 2
|
||||||
trim()
|
trim()
|
||||||
continue
|
continue
|
||||||
i = 0
|
|
||||||
toggle = false
|
|
||||||
while i < len
|
|
||||||
if /[()\[\]{}<>]/.test text[i++] then toggle = !toggle
|
|
||||||
if toggle
|
|
||||||
trim()
|
|
||||||
break
|
break
|
||||||
|
|
||||||
text =
|
text =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user