Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Parser.js
01 matches.forEach(function(m)
02 {
03 // Linkify the trimmed URL
04 linkifyUrl(m[0][1], trimUrl(m[0][0]));
05 });
06
07 /**
08 * Linkify given URL at given position
09 *
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.charAt(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 while (1)
55 {
56 url = url.replace(/(?![-=\/)])[\s!-.:-@[-`{-~]+$/, '');
57 if (url.substr(-1) === ')' && url.replace(/[^(]+/g, '').length < url.replace(/[^)]+/g, '').length)
58 {
59 url = url.substr(0, url.length - 1);
60 continue;
61 }
62 break;
63 }
64
65 return url;
66 }