<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.saya.loseyourip.com/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-DynamicCode.js</id>
	<title>MediaWiki:Gadget-DynamicCode.js - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.saya.loseyourip.com/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-DynamicCode.js"/>
	<link rel="alternate" type="text/html" href="https://wiki.saya.loseyourip.com/index.php?title=MediaWiki:Gadget-DynamicCode.js&amp;action=history"/>
	<updated>2026-04-23T12:19:09Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Home Wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.saya.loseyourip.com/index.php?title=MediaWiki:Gadget-DynamicCode.js&amp;diff=77&amp;oldid=prev</id>
		<title>Saya am 14. Februar 2026 um 11:32 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.saya.loseyourip.com/index.php?title=MediaWiki:Gadget-DynamicCode.js&amp;diff=77&amp;oldid=prev"/>
		<updated>2026-02-14T11:32:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wiki.saya.loseyourip.com/index.php?title=MediaWiki:Gadget-DynamicCode.js&amp;amp;diff=77&amp;amp;oldid=66&quot;&gt;Änderungen zeigen&lt;/a&gt;</summary>
		<author><name>Saya</name></author>
	</entry>
	<entry>
		<id>https://wiki.saya.loseyourip.com/index.php?title=MediaWiki:Gadget-DynamicCode.js&amp;diff=66&amp;oldid=prev</id>
		<title>Saya: Die Seite wurde neu angelegt: „mw.loader.using([&#039;mediawiki.util&#039;]).then(function () {      function initDynamicCodeBlock(pre) {          // Nur einmal initialisieren         if (pre.dataset.dynamicInit) return;         pre.dataset.dynamicInit = true;          const codeText = pre.textContent;          // Finde alle Platzhalter {{varname}}         const regex = /{{(\w+)}}/g;         const vars = [];         let match;         while ((match = regex.exec(codeText)) !== null) {…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.saya.loseyourip.com/index.php?title=MediaWiki:Gadget-DynamicCode.js&amp;diff=66&amp;oldid=prev"/>
		<updated>2026-02-14T10:54:39Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „mw.loader.using([&amp;#039;mediawiki.util&amp;#039;]).then(function () {      function initDynamicCodeBlock(pre) {          // Nur einmal initialisieren         if (pre.dataset.dynamicInit) return;         pre.dataset.dynamicInit = true;          const codeText = pre.textContent;          // Finde alle Platzhalter {{varname}}         const regex = /{{(\w+)}}/g;         const vars = [];         let match;         while ((match = regex.exec(codeText)) !== null) {…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;mw.loader.using([&amp;#039;mediawiki.util&amp;#039;]).then(function () {&lt;br /&gt;
&lt;br /&gt;
    function initDynamicCodeBlock(pre) {&lt;br /&gt;
&lt;br /&gt;
        // Nur einmal initialisieren&lt;br /&gt;
        if (pre.dataset.dynamicInit) return;&lt;br /&gt;
        pre.dataset.dynamicInit = true;&lt;br /&gt;
&lt;br /&gt;
        const codeText = pre.textContent;&lt;br /&gt;
&lt;br /&gt;
        // Finde alle Platzhalter {{varname}}&lt;br /&gt;
        const regex = /{{(\w+)}}/g;&lt;br /&gt;
        const vars = [];&lt;br /&gt;
        let match;&lt;br /&gt;
        while ((match = regex.exec(codeText)) !== null) {&lt;br /&gt;
            if (!vars.includes(match[1])) vars.push(match[1]);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (vars.length === 0) return; // nichts zu tun&lt;br /&gt;
&lt;br /&gt;
        // Container für Input-Leiste erstellen&lt;br /&gt;
        const container = document.createElement(&amp;#039;div&amp;#039;);&lt;br /&gt;
        container.style.marginBottom = &amp;#039;6px&amp;#039;;&lt;br /&gt;
        container.style.padding = &amp;#039;6px&amp;#039;;&lt;br /&gt;
        container.style.border = &amp;#039;1px solid #ccc&amp;#039;;&lt;br /&gt;
        container.style.borderRadius = &amp;#039;4px&amp;#039;;&lt;br /&gt;
        container.style.background = &amp;#039;#f9f9f9&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
        vars.forEach(v =&amp;gt; {&lt;br /&gt;
            const lbl = document.createElement(&amp;#039;label&amp;#039;);&lt;br /&gt;
            lbl.textContent = v + &amp;#039;: &amp;#039;;&lt;br /&gt;
            lbl.style.marginRight = &amp;#039;4px&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
            const inp = document.createElement(&amp;#039;input&amp;#039;);&lt;br /&gt;
            inp.type = &amp;#039;text&amp;#039;;&lt;br /&gt;
            inp.value = v; // Standardwert = Platzhaltername&lt;br /&gt;
            inp.dataset.varId = v;&lt;br /&gt;
            inp.style.marginRight = &amp;#039;12px&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
            lbl.appendChild(inp);&lt;br /&gt;
            container.appendChild(lbl);&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
        pre.parentNode.insertBefore(container, pre);&lt;br /&gt;
&lt;br /&gt;
        // Copy Button&lt;br /&gt;
        const btn = document.createElement(&amp;#039;button&amp;#039;);&lt;br /&gt;
        btn.textContent = &amp;#039;📋 Kopieren&amp;#039;;&lt;br /&gt;
        btn.style.marginTop = &amp;#039;4px&amp;#039;;&lt;br /&gt;
        btn.style.padding = &amp;#039;4px 8px&amp;#039;;&lt;br /&gt;
        btn.style.fontSize = &amp;#039;12px&amp;#039;;&lt;br /&gt;
        btn.style.cursor = &amp;#039;pointer&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
        btn.onclick = function () {&lt;br /&gt;
            const textToCopy = pre.textContent;&lt;br /&gt;
            if (navigator.clipboard &amp;amp;&amp;amp; window.isSecureContext) {&lt;br /&gt;
                navigator.clipboard.writeText(textToCopy).then(() =&amp;gt; {&lt;br /&gt;
                    btn.textContent = &amp;quot;✅ Kopiert!&amp;quot;;&lt;br /&gt;
                    setTimeout(() =&amp;gt; btn.textContent = &amp;quot;📋 Kopieren&amp;quot;, 1500);&lt;br /&gt;
                });&lt;br /&gt;
            } else {&lt;br /&gt;
                const textarea = document.createElement(&amp;quot;textarea&amp;quot;);&lt;br /&gt;
                textarea.value = textToCopy;&lt;br /&gt;
                document.body.appendChild(textarea);&lt;br /&gt;
                textarea.select();&lt;br /&gt;
                document.execCommand(&amp;quot;copy&amp;quot;);&lt;br /&gt;
                document.body.removeChild(textarea);&lt;br /&gt;
                btn.textContent = &amp;quot;✅ Kopiert!&amp;quot;;&lt;br /&gt;
                setTimeout(() =&amp;gt; btn.textContent = &amp;quot;📋 Kopieren&amp;quot;, 1500);&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
        pre.parentNode.insertBefore(btn, pre.nextSibling);&lt;br /&gt;
&lt;br /&gt;
        // Update Code bei Eingabe&lt;br /&gt;
        container.querySelectorAll(&amp;#039;input&amp;#039;).forEach(input =&amp;gt; {&lt;br /&gt;
            input.addEventListener(&amp;#039;input&amp;#039;, () =&amp;gt; {&lt;br /&gt;
                let updated = codeText;&lt;br /&gt;
                vars.forEach(v =&amp;gt; {&lt;br /&gt;
                    const val = container.querySelector(`input[data-var-id=&amp;quot;${v}&amp;quot;]`).value;&lt;br /&gt;
                    updated = updated.replace(new RegExp(`{{${v}}}`, &amp;#039;g&amp;#039;), val);&lt;br /&gt;
                });&lt;br /&gt;
                pre.textContent = updated;&lt;br /&gt;
            });&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Alle bestehenden Codeblöcke initialisieren&lt;br /&gt;
    document.querySelectorAll(&amp;#039;pre.dynamic-code&amp;#039;).forEach(initDynamicCodeBlock);&lt;br /&gt;
&lt;br /&gt;
    // Für dynamisch nachgeladene Inhalte&lt;br /&gt;
    mw.hook(&amp;#039;wikipage.content&amp;#039;).add(function (content) {&lt;br /&gt;
        content.querySelectorAll(&amp;#039;pre.dynamic-code&amp;#039;).forEach(initDynamicCodeBlock);&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
});&lt;/div&gt;</summary>
		<author><name>Saya</name></author>
	</entry>
</feed>