mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-07 03:17:14 -05:00
Merge pull request #46 from kotarou3/autolinkingFix
Add port number detection to automatic links
This commit is contained in:
@@ -317,13 +317,13 @@ var Tools = {
|
||||
options.hidestrikethrough ? '$1' : '<s>$1</s>');
|
||||
// linking of URIs
|
||||
if (!options.hidelinks) {
|
||||
str = str.replace(/(https?\:\/\/[a-z0-9-.]+(\/([^\s]*[^\s?.,])?)?|[a-z0-9]([a-z0-9-\.]*[a-z0-9])?\.(com|org|net|edu|us)((\/([^\s]*[^\s?.,])?)?|\b))/ig, function(uri) {
|
||||
str = str.replace(/(https?\:\/\/[a-z0-9-.]+(\:[0-9]+)?(\/([^\s]*[^\s?.,])?)?|[a-z0-9]([a-z0-9-\.]*[a-z0-9])?\.(com|org|net|edu|us)(\:[0-9]+)?((\/([^\s]*[^\s?.,])?)?|\b))/ig, function(uri) {
|
||||
// Insert http:// before URIs without a URI scheme specified.
|
||||
var fulluri = uri.replace(/^([a-z]*[^a-z:])/g, 'http://$1');
|
||||
var onclick;
|
||||
var r = new RegExp('^https?://' +
|
||||
document.location.hostname.replace(/\./g, '\\.') +
|
||||
'/([a-zA-Z0-9-]+)$');
|
||||
'(\\:[0-9]+)?/([a-zA-Z0-9-]+)$');
|
||||
var m = r.exec(fulluri);
|
||||
if (m) {
|
||||
onclick = "return selectTab('" + m[1] + "');";
|
||||
@@ -891,4 +891,3 @@ var Tools = {
|
||||
return '<img src="' + Tools.resourcePrefix + 'sprites/types/'+sanitizedType+'.png" alt="'+type+'" height="14" width="32"'+(b?' class="b"':'')+' />';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user