Spark,
Тады так:
// URI
var regexUrl = /(https?):\/\/((?:[a-z0-9.-]|%[0-9A-F]{2}){3,})(?::(\d+))?((?:\/(?:[a-z0-9-._~!$&'()*+,;=:@]|%[0-9A-F]{2})*)*)(?:\?((?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*))?(?:#((?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*))?/i;
function UriCallback(m,p1,p2,p3,p4,p5,p6,p7,p8,p9)
{
if(m.match(/(http:\/\/[^\s\?]+)\.(?:jpg|jpeg|gif|png)/ig)==null)
{
this.uri_count = ++this.uri_count || 0;
var a_uri = '#uri_' + this.uri_count;
if(opt.images)
{
var ext = m.match(/\.([a-z0-9]+)$/i);
if(ext != null)
var rep = /[?]/;
if (rep.test(value))
{value = value.replace(rep, ''); input.value = value;}
{
if( ext[1] == "jpg" || ext[1] == "jpeg" || ext[1] == "gif" || ext[1] == "png" )
{
var img = new load_image(m);
img.load = function () {
var w = img.width;
var h = img.height;
var max = 300;
if(w > max)
{
w = max;
var p = img.width / max;
h = img.height / p;
}
if(h > max)
{
h = max;
var p = img.height / max;
w = img.width / p;
}
var img_html = '<img src="'+m+'" style="width:'+w+'px; height:'+h+'px;">';
if(images_count++ < opt.max_images)
{
setTimeout(function () {
$(a_uri).html(img_html);
if(opt.scroll)
Messages.scroll(1);
}, 1);
}
}
}
}
}
return '<a id="uri_'+this.uri_count+'" href="'+m+'" target="_blank">'+m+'</a>';
}
msg = msg.replace(regexUrl, UriCallback);
}
}