h2. mps
*mps* ist ein TC-Kommando, mit dem ein Snippet-Link zum Anwendungsthema Mathematische Physik erzeugt werden kann. TC macht mit dem Kommando:
* Einen Link zu einem Snippet (für Mathematische Physik) generieren.
* Alle Path-Elemente hinzufügen, die als +_root_+ definiert sind (in der aktuellen Implementierung ist das +_media:snippets:mp_+.)
h3. Syntax
bc(tc3-panel tc3-light-grey tc3-round-large). "(mps)$":{Snippet-Element}
oder
bc(tc3-panel tc3-light-grey tc3-round-large). "(mps)$":{Snippet-Path}{Snippet-Element}
Parameter:
* Snippet-Element: Ein Seitennahme im Snippet workspace
* Snippet-Path: Ein workspace path
h3. Beispiel:
bc(tc3-panel tc3-light-grey tc3-round-large). "(mps)$":vektor-raum
h3. Ergebnis
"(mps)$":vektor-raum
h2. Technische Informationen
h3. Selector
bc(tc3-panel tc3-light-grey tc3-round-large). querySelectorAll("a.mps")
h3. Implementierug in JavaScript
bc(tc3-panel tc3-light-grey tc3-round-large)..
function mpSnippetLink() {
pageLinkGeneric(
"a.mps",
`
→ {{link-label}}`,
"media:snippets:mp:",
"",
"Mathematische Physik Snippet"
);
}
//+-----:----------------------------------------------------------------------:
//+-----:
//+-----: Function pageLinkGeneric()
//+-----:
//+-----: Parameters:
//+-----:
//+-----: selector: Used selector to find the DOM elements for the generic link function
//+-----: linkTemplate: Template used to create the new element
//+-----: linkPre: Pre-Content (random String)
//+-----: linkPost: Post-Content (random String)
//+-----: mouseOverLabel: Mouse over Text (random String)
//+-----:
//+-----:
//+-----: Modification History:
//+-----: 16.6.2024 - Added class properties
//+-----: (wpLink() [see page/file tc/rel-0.6/toolbox/links/wp/js] keeps given class list on target element)
//+-----:
//+-----:----------------------------------------------------------------------:
function pageLinkGeneric(selector, linkTemplate, linkPre = "", linkPost = "", mouseOverLabel = "") {
//const linkTemplate = `
→ {{link-label}}`;
// elementText is the changed string value of the const linkTemplate;
let elementText = "";
let titleText = "";
let footerText = "";
let innerText = "";
const nodeList = document.querySelectorAll("a." + selector);
let mouseOverLabeSeperator = " - " ;
for (let i = 0; i < nodeList.length; i++) {
innerText = nodeList[i].innerText;
titleText = nodeList[i].getAttribute("title");
hrefText = nodeList[i].getAttribute("href");
// Die Replacement-Logik kann nicht pauschal für alle Selektoren verwendet werden
//hrefText = nodeList[i].getAttribute("href").replaceAll("#","%20");
elementText = linkTemplate.replace("{{link-target}}", linkPre + hrefText + linkPost);
// add the additional class-list-entries to the target class-list.
nodeList[i].classList.remove(selector);
elementText = elementText.replace("{{class-list}}", nodeList[i].classList.value);
elementText = elementText.replace("{{link-mouse-over-text}}", mouseOverLabel + mouseOverLabeSeperator + innerText);
elementText = elementText.replace("{{link-label}}", innerText);
nodeList[i].outerHTML = elementText;
}
}
h2. Elemente bearbeiten ...
*(tc3-ul tc3-card).
* "(page)Javascript":e&dit=tc:rel-0.6:toolbox:links:page:js
* "(page)Doku":e&dit=tc:rel-0.6:toolbox:links:page:doku:mps
h2. Documentation ... Path
* Development & Usage
* Toolbox (TC functions)
* Page links
* mps
h2. Kategorien
*(tc-wiki-cat tc3-ul tc3-card).
* "(cat-page)TC Dokumentation":tc-doku&title=TC%20Dokumentation
* "(page)$":tc:cat-created:2024-04
* "(page)$":tc:cat-created:2024-03
* "(page)$":tc:cat-changed:2024-99
*(tc-silent) Reminder: Please use cat supercat on category pages only!!!
* "(cat)$":supercat
* "(cat)$":superdailycat
* "(page)TC Rel 0.6":tc:category:tc:rel-0.6
h2. Seiten-Links
* "(page)Startseite TC-Dokumentation":tc:current:docu:start
h2. External-Links
* "Textile":https://textile-lang.com/