[ Index ] |
PHP Cross Reference of phpBB-3.3.14-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 // Create a zero-width end tag right after the URL 16 var endPos = tagPos + url.length, 17 endTag = addEndTag(config.tagName, endPos, 0); 18 19 // If the URL starts with "www." we prepend "http://" 20 if (url[3] === '.') 21 { 22 url = 'http://' + url; 23 } 24 25 // Create a zero-width start tag right before the URL, with a slightly worse priority to 26 // allow specialized plugins to use the URL instead 27 var startTag = addStartTag(config.tagName, tagPos, 0, 1); 28 startTag.setAttribute(config.attrName, url); 29 30 // Pair the tags together 31 startTag.pairWith(endTag); 32 33 // Protect the tag's content from partial replacements with a low priority tag 34 var contentTag = addVerbatim(tagPos, endPos - tagPos, 1000); 35 startTag.cascadeInvalidationTo(contentTag); 36 } 37 38 /** 39 * Remove trailing punctuation from given URL 40 * 41 * We remove most ASCII non-letters from the end of the string. 42 * Exceptions: 43 * - dashes and underscores, (base64 IDs could end with one) 44 * - equal signs, (because of "foo?bar=") 45 * - plus signs, (used by some file share services to force download) 46 * - trailing slashes, 47 * - closing parentheses. (they 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: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |