Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Links.js

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 2.83 KiB


001  function parse()
002  {
003      if (text.indexOf('](') !== -1)
004      {
005          parseInlineLinks();
006      }
007      if (text.indexOf('<') !== -1)
008      {
009          parseAutomaticLinks();
010      }
011      if (hasReferences)
012      {
013          parseReferenceLinks();
014      }
015  }
016   
017  /**
018  * Add an image tag for given text span
019  *
020  * @param {number} startPos Start tag position
021  * @param {number} endPos   End tag position
022  * @param {number} endLen   End tag length
023  * @param {string} linkInfo URL optionally followed by space and a title
024  */
025  function addLinkTag(startPos, endPos, endLen, linkInfo)
026  {
027      // Give the link a slightly worse priority if this is a implicit reference and a slightly
028      // better priority if it's an explicit reference or an inline link or to give it precedence
029      // over possible BBCodes such as [b](https://en.wikipedia.org/wiki/B)
030      var priority = (endLen === 1) ? 1 : -1;
031   
032      var tag = addTagPair('URL', startPos, 1, endPos, endLen, priority);
033      setLinkAttributes(tag, linkInfo, 'url');
034   
035      // Overwrite the markup without touching the link's text
036      overwrite(startPos, 1);
037      overwrite(endPos,   endLen);
038  }
039   
040  /**
041  * Capture and return labels used in current text
042  *
043  * @return {!Object} Labels' text position as keys, lowercased text content as values
044  */
045  function getLabels()
046  {
047      var labels = {}, m, regexp = /\[((?:[^\x17[\]]|\[[^\x17[\]]*\])*)\]/g;
048      while (m = regexp.exec(text))
049      {
050          labels[m.index] = m[1].toLowerCase();
051      }
052   
053      return labels;
054  }
055   
056  /**
057  * Parse automatic links markup
058  */
059  function parseAutomaticLinks()
060  {
061      var m, regexp = /<[-+.\w]+([:@])[^\x17\s>]+?(?:>|\x1B7)/g;
062      while (m = regexp.exec(text))
063      {
064          // Re-escape escape sequences in automatic links
065          var content  = decode(m[0].replace(/\x1B/g, "\\\x1B")).replace(/^<(.+)>$/, '$1'),
066              startPos = m.index,
067              endPos   = startPos + m[0].length - 1,
068   
069              tagName  = (m[1] === ':') ? 'URL' : 'EMAIL',
070              attrName = tagName.toLowerCase();
071   
072          addTagPair(tagName, startPos, 1, endPos, 1).setAttribute(attrName, content);
073      }
074  }
075   
076  /**
077  * Parse inline links markup
078  */
079  function parseInlineLinks()
080  {
081      var m, regexp = /\[(?:[^\x17[\]]|\[[^\x17[\]]*\])*\]\(( *(?:\([^\x17\s()]*\)|[^\x17\s)])*(?=[ )]) *(?:"[^\x17]*?"|'[^\x17]*?'|\([^\x17)]*\))? *)\)/g;
082      while (m = regexp.exec(text))
083      {
084          var linkInfo = m[1],
085              startPos = m.index,
086              endLen   = 3 + linkInfo.length,
087              endPos   = startPos + m[0].length - endLen;
088   
089          addLinkTag(startPos, endPos, endLen, linkInfo);
090      }
091  }
092   
093  /**
094  * Parse reference links markup
095  */
096  function parseReferenceLinks()
097  {
098      var labels = getLabels(), startPos;
099      for (startPos in labels)
100      {
101          var id       = labels[startPos],
102              labelPos = +startPos + 2 + id.length,
103              endPos   = labelPos - 1,
104              endLen   = 1;
105   
106          if (text[labelPos] === ' ')
107          {
108              ++labelPos;
109          }
110          if (labels[labelPos] > '' && linkReferences[labels[labelPos]])
111          {
112              id     = labels[labelPos];
113              endLen = labelPos + 2 + id.length - endPos;
114          }
115          if (linkReferences[id])
116          {
117              addLinkTag(+startPos, endPos, endLen, linkReferences[id]);
118          }
119      }
120  }
121