OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 395 |
396 /** | 396 /** |
397 * @param {string} string | 397 * @param {string} string |
398 * @param {function(string,string,number=,number=):!Node} linkifier | 398 * @param {function(string,string,number=,number=):!Node} linkifier |
399 * @return {!DocumentFragment} | 399 * @return {!DocumentFragment} |
400 */ | 400 */ |
401 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
fier) { | 401 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
fier) { |
402 var container = createDocumentFragment(); | 402 var container = createDocumentFragment(); |
403 var linkStringRegEx = | 403 var linkStringRegEx = |
404 /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^%
@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; | 404 /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^%
@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; |
405 var pathLineRegex = /(?:\/[\/\w\.-]+)+\:[\d]+/; | 405 var pathLineRegex = /(?:\/[\w\.-]*)+\:[\d]+/; |
406 | 406 |
407 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLinki
fier) { | 407 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLinki
fier) { |
408 var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(string); | 408 var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(string); |
409 if (!linkString) | 409 if (!linkString) |
410 break; | 410 break; |
411 | 411 |
412 linkString = linkString[0]; | 412 linkString = linkString[0]; |
413 var linkIndex = string.indexOf(linkString); | 413 var linkIndex = string.indexOf(linkString); |
414 var nonLink = string.substring(0, linkIndex); | 414 var nonLink = string.substring(0, linkIndex); |
415 container.appendChild(createTextNode(nonLink)); | 415 container.appendChild(createTextNode(nonLink)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 /** | 488 /** |
489 * @param {!WebInspector.NetworkRequest} request | 489 * @param {!WebInspector.NetworkRequest} request |
490 * @return {!Element} | 490 * @return {!Element} |
491 */ | 491 */ |
492 WebInspector.linkifyRequestAsNode = function(request) { | 492 WebInspector.linkifyRequestAsNode = function(request) { |
493 var anchor = WebInspector.linkifyURLAsNode(request.url); | 493 var anchor = WebInspector.linkifyURLAsNode(request.url); |
494 anchor.requestId = request.requestId; | 494 anchor.requestId = request.requestId; |
495 return anchor; | 495 return anchor; |
496 }; | 496 }; |
OLD | NEW |