[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 matches.forEach(function(m) 2 { 3 // Linkify the trimmed URL 4 linkifyUrl(m[0][1], trimUrl(m[0][0])); 5 }); 6 7 /** 8 * Linkify given URL at given position 9 * 10 * @param {!number} tagPos URL's position in the text 11 * @param {!string} url URL 12 */ 13 function linkifyUrl(tagPos, url) 14 { 15 // Ensure that the anchor (scheme/www) is still there 16 if (!/^www\.|^[^:]+:/i.test(url)) 17 { 18 return; 19 } 20 21 // Create a zero-width end tag right after the URL 22 var endTag = addEndTag(config.tagName, tagPos + url.length, 0); 23 24 // If the URL starts with "www." we prepend "http://" 25 if (url[3] === '.') 26 { 27 url = 'http://' + url; 28 } 29 30 // Create a zero-width start tag right before the URL, with a slightly worse priority to 31 // allow specialized plugins to use the URL instead 32 var startTag = addStartTag(config.tagName, tagPos, 0, 1); 33 startTag.setAttribute(config.attrName, url); 34 35 // Pair the tags together 36 startTag.pairWith(endTag); 37 }; 38 39 /** 40 * Remove trailing punctuation from given URL 41 * 42 * We remove most ASCII non-letters from the end of the string. 43 * Exceptions: 44 * - dashes (some YouTube URLs end with a dash due to the video ID) 45 * - equal signs (because of "foo?bar="), 46 * - trailing slashes, 47 * - closing parentheses are balanced separately. 48 * 49 * @param {!string} url Original URL 50 * @return {!string} Trimmed URL 51 */ 52 function trimUrl(url) 53 { 54 return url.replace(/(?![-=\/)])[\s!-.:-@[-`{-~]+$/, ''); 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |