Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 427759
Collapse All | Expand All

(-)../../../org.eclipse.orion.client.ui/web/terminal/term.js (+35 lines)
Lines 1289-1294 Link Here
1289
    if (attr !== this.defAttr) {
1289
    if (attr !== this.defAttr) {
1290
      out += '</span>';
1290
      out += '</span>';
1291
    }
1291
    }
1292
    
1293
    // BEGIN GODEV CUSTOMIZATION
1294
    
1295
    // The html spaces and ampersands make it difficult to match URL's with query paramters in it
1296
    // Pull them out for now and then we will put them back after if there is a hyperlink match
1297
    out = out.replace(/\&nbsp;/g, "\t \r\t \r\t \r");
1298
    out = out.replace(/\&amp;/g, "&=-&=-&=-");
1299
   
1300
    // Check for hyperlinks (ssh, ftp, telnet, and http(s))
1301
    // HTML tags, such as the span tag for the blinking cursor can appear in between any character
1302
    // This will match a beginning or end tag
1303
    var tagMatch = "(<[^>]+?>)?";
1304
    var protos = ["http", "https", "ftp", "sftp", "telnet"]; // Match http(s), (s)ftp and telnet protocols
1305
    // An html tag can occur in between any two characters in the protocol (e.g. the cursor span)
1306
    for (var protoIdx = 0; protoIdx < protos.length; protoIdx++) {
1307
    	protos[protoIdx] = protos[protoIdx].split("").join(tagMatch);
1308
    }
1309
    var protoMatch = "((" + protos.join(")|(") + "))";
1310
    // Protocol separator
1311
    var separatorMatch = "://";
1312
    separatorMatch = separatorMatch.split("").join(tagMatch);
1313
    // Match all of the valid characters for the rest of the URL
1314
   	var restMatch = "[a-zA-Z0-9%\\.,:\\/\\?=\\&_\\-\\+#@]";
1315
    // The final URL matcher
1316
    var urlMatch = "(" + protoMatch+tagMatch + separatorMatch+tagMatch + restMatch+"*"+tagMatch + restMatch+"*"+tagMatch + restMatch+"+" + ")";
1317
    
1318
    out = out.replace(new RegExp(urlMatch, "g"), function(match) {
1319
    	return match.replace(match, "<a href=\""+match.replace(new RegExp(tagMatch, "g"), "")+
1320
    										"\" style=\"color: inherit;\" target=\"_blank\">"+match+"</a>");
1321
    });
1322
1323
	out = out.replace(/\t \r\t \r\t \r/g, "&nbsp;");
1324
  	out = out.replace(/\&=-\&=-\&=-/g, "&amp;");
1325
    
1326
    // END GODEV CUSTOMIZATION
1292
1327
1293
    this.children[y].innerHTML = out;
1328
    this.children[y].innerHTML = out;
1294
  }
1329
  }

Return to bug 427759