Updated autolink.js and taphold.js to the latest from their upstream repos.
The changes are mainly bugfixes and a few performance improvements. Note that autolink.js is now the minified version from upstream.
This commit is contained in:
34
external/autolink.js
vendored
34
external/autolink.js
vendored
@ -1,33 +1 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
var autoLink,
|
||||
__slice = [].slice;
|
||||
|
||||
autoLink = function() {
|
||||
var callbackThunk, key, link_attributes, option, options, url_pattern, value;
|
||||
options = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
link_attributes = '';
|
||||
option = options[0];
|
||||
url_pattern = /(^|\s)(\b(https?|ftp):\/\/[\-A-Z0-9+\u0026@#\/%?=~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~_|])/gi;
|
||||
if (!(options.length > 0)) {
|
||||
return this.replace(url_pattern, "$1<a href='$2'>$2</a>");
|
||||
}
|
||||
if ((option['callback'] != null) && typeof option['callback'] === 'function') {
|
||||
callbackThunk = option['callback'];
|
||||
delete option['callback'];
|
||||
}
|
||||
for (key in option) {
|
||||
value = option[key];
|
||||
link_attributes += " " + key + "='" + value + "'";
|
||||
}
|
||||
return this.replace(url_pattern, function(match, space, url) {
|
||||
var link, returnCallback;
|
||||
returnCallback = callbackThunk && callbackThunk(url);
|
||||
link = returnCallback || ("<a href='" + url + "'" + link_attributes + ">" + url + "</a>");
|
||||
return "" + space + link;
|
||||
});
|
||||
};
|
||||
|
||||
String.prototype['autoLink'] = autoLink;
|
||||
|
||||
}).call(this);
|
||||
(function(){var f=[].slice;String.prototype.autoLink=function(){var c,e,d,a,b;a=1<=arguments.length?f.call(arguments,0):[];e="";d=a[0];b=/(^|\s)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026@#\/%?=~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~_|])/gi;if(!(0<a.length))return this.replace(b,"$1<a href='$2'>$2</a>");for(c in d)a=d[c],"callback"!==c&&(e+=" "+c+"='"+a+"'");return this.replace(b,function(a,c,b){a=("function"===typeof d.callback?d.callback(b):void 0)||"<a href='"+b+"'"+e+">"+b+"</a>";return""+c+a})}}).call(this);
|
||||
|
Reference in New Issue
Block a user