(function () { if (!location.href.includes('f!!')) return; const iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = location.href.replace('f!!', 'g!!'); document.body.appendChild(iframe); iframe.onload = function () { try { // HASH-DIVs const parentDivs = Array.from(document.querySelectorAll('div[id]')).filter(div => /^[a-f0-9]{32}$/.test(div.id) ); const iframeDivs = Array.from(iframe.contentDocument.querySelectorAll('div[id]')).filter(div => /^[a-f0-9]{32}$/.test(div.id) ); if (parentDivs.length !== iframeDivs.length) { console.warn('Hash-DIV count differing.'); return; } for (let i = 0; i < parentDivs.length; i++) { const parentDiv = parentDivs[i]; const iframeDiv = iframeDivs[i]; const content = iframeDiv?.textContent?.trim(); if (!content) continue; const html = `
` + iframeDiv.innerHTML.replace(/:/g, '') + `
`; parentDiv.insertAdjacentHTML('afterend', html); } // MC-DIVs const parentMCs = Array.from(document.querySelectorAll('div.mc')); const iframeMCs = Array.from(iframe.contentDocument.querySelectorAll('div.mc')); if (parentMCs.length !== iframeMCs.length) { console.warn('mc.div counts divvering.'); return; } for (let i = 0; i < parentMCs.length; i++) { const parentDiv = parentMCs[i]; const iframeDiv = iframeMCs[i]; const content = iframeDiv?.textContent?.trim(); if (!content) continue; const html = `
` + iframeDiv.innerHTML + `

`; parentDiv.insertAdjacentHTML('afterend', html); } } catch (e) { console.error('Could not load iframe:', e); } }; })(); ///////////////////////////////////////////////////////////////////////////////// const body = document.body; let lastOpacity = getComputedStyle(body).opacity; const observer = new MutationObserver(() => { const currentOpacity = getComputedStyle(body).opacity; if (currentOpacity !== lastOpacity && parseFloat(currentOpacity) < 1) { lastOpacity = currentOpacity; setTimeout(() => { body.style.opacity = "1"; lastOpacity = "1"; }, 1000); } else { lastOpacity = currentOpacity; } }); observer.observe(body, { attributes: true, attributeFilter: ['style'] }); ///////////////////////////////////////////////////////////////////////////////// if(location.href.indexOf('f!')>0) { /////// const hrefsToHide = [ "#fd60ff9cf236b3b3a1341a2a18693462", "#91e1ac3557e91a4a2c0d3c46232215db" ]; (function continuouslyCheckLinks() { hrefsToHide.forEach(href => { const links = document.querySelectorAll(`a[href="${href}"]`); links.forEach(link => { if (link.style.display !== "none") { link.style.display = "none"; } }); }); setTimeout(continuouslyCheckLinks, 500); })(); /////// (function waitForAllTargets() { const pairs = [ ["fd60ff9cf236b3b3a1341a2a18693462", "1f853c989e78bf2a8b88a3b9c1377b6f"], ["91e1ac3557e91a4a2c0d3c46232215db", "4f158e7f7196be953f4a8db1a153ad57"] ]; const resolved = pairs.map(([startID, endID]) => ({ start: document.getElementById(startID), end: document.getElementById(endID), startID, endID })); if (resolved.some(pair => !pair.start || !pair.end)) { setTimeout(waitForAllTargets, 200); return; } resolved.forEach(({ start, end, startID, endID }) => { const hiddenDiv = document.createElement("div"); hiddenDiv.style.display = "none"; let current = start; while (current && current !== end) { const next = current.nextSibling; hiddenDiv.appendChild(current); current = next; } end.parentNode.insertBefore(hiddenDiv, end); }); })(); /////// (function replaceDaggers() { const replacements = [ ["†ang", "†en"], ["†fro", "†fr"], ["†goh", "†de"], ["†grc", "†gr"], ["†ita", "†it"], ["†la", "†la"], ["†non", "†no"], ["†sga", "†sg"] ]; function walk(node) { let child, next; switch (node.nodeType) { case Node.ELEMENT_NODE: case Node.DOCUMENT_NODE: case Node.DOCUMENT_FRAGMENT_NODE: child = node.firstChild; while (child) { next = child.nextSibling; walk(child); child = next; } break; case Node.TEXT_NODE: let text = node.nodeValue; for (const [from, to] of replacements) { text = text.replaceAll(from, to); } node.nodeValue = text; break; } } walk(document.body); })(); /////// document.getElementById('centergreen').addEventListener('dblclick', function (event) { if (!event.shiftKey) return; if (!document.forms['form1']) { const form = document.createElement('form'); form.name = 'form1'; form.style.display = 'none'; document.body.appendChild(form); } const currentUrl = window.location.href; const newUrl = currentUrl.replace('f!', 'g!'); const width = window.innerWidth; const height = window.innerHeight; const left = window.screenX; const top = window.screenY; window.open( newUrl, '_blank', `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes` ); }); /////// } if(location.href.indexOf('!!')<0) { if (parent.location.href.indexOf('&j=') > 0) { document.getElementById('defplus').style.display = 'none'; const button = document.createElement('button'); button.id = 'zrb1x'; button.textContent = '\u2630'; button.title = ''; button.onclick = () => top.location.href = '/?c=itextselection'; Object.assign(button.style, { position: 'fixed', top: '12px', right: '12px', zIndex: '222', padding: '6px 10px', fontSize: '18px', fontWeight: 'bold', border: 'none', borderRadius: '8px', background: 'rgba(0, 0, 0, 0.6)', color: 'white', cursor: 'pointer', boxShadow: '0 2px 6px rgba(0,0,0,0.3)', transition: 'background 0.2s, transform 0.2s', }); button.addEventListener('mouseover', () => { button.style.background = 'rgba(0, 0, 0, 0.75)'; button.style.transform = 'scale(1.05)'; }); button.addEventListener('mouseout', () => { button.style.background = 'rgba(0, 0, 0, 0.6)'; button.style.transform = 'scale(1)'; }); document.body.appendChild(button); } (function() { const url = parent.location.href; if (url.includes('WRITERS') || url.includes('80_LANGUAGES')) { const links = document.querySelectorAll('a[href]'); links.forEach(link => { if (url.includes('WRITERS')) { link.href = link.href.replace(/d!!/g, 'e!!'); } else if (url.includes('80_LANGUAGES')) { link.href = link.href.replace(/d!!/g, 'f!!'); } }); } })(); } //////////////////////////////// if (location.href.indexOf('f!!') > 0) { function toClassicalLatinCicero(text) { return text .replace(/ae/g, "\u00E6") .replace(/AE/g, "\u00C6") .replace(/Ae/g, "\u00C6") .replace(/oe/g, "\u0153") .replace(/OE/g, "\u0152") .replace(/Oe/g, "\u0152") .replace(/j/g, "i") .replace(/J/g, "I") .replace(/u/g, "v") .replace(/U/g, "V") .toUpperCase(); } const cyrToLat = { "\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0452":"\u0111","\u0435":"e","\u0436":"\u017e","\u0437":"z","\u0438":"i", "\u0458":"j","\u043a":"k","\u043b":"l","\u0459":"lj","\u043c":"m","\u043d":"n","\u045a":"nj","\u043e":"o","\u043f":"p","\u0440":"r", "\u0441":"s","\u0442":"t","\u045b":"\u0107","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"\u010d","\u045f":"d\u017e","\u0448":"\u0161", "\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0402":"\u0110","\u0415":"E","\u0416":"\u017d","\u0417":"Z","\u0418":"I", "\u0408":"J","\u041a":"K","\u041b":"L","\u0409":"Lj","\u041c":"M","\u041d":"N","\u040a":"Nj","\u041e":"O","\u041f":"P","\u0420":"R", "\u0421":"S","\u0422":"T","\u040b":"\u0106","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"\u010c","\u040f":"D\u017e","\u0428":"\u0160" }; const latToCyr = { "d\u017e":"\u045f","lj":"\u0459","nj":"\u045a","\u0111":"\u0452","\u017e":"\u0436","\u010d":"\u0447","\u0107":"\u045b","\u0161":"\u0448", "D\u017e":"\u040f","Lj":"\u0409","Nj":"\u040a","\u0110":"\u0402","\u017d":"\u0416","\u010c":"\u0427","\u0106":"\u040b","\u0160":"\u0428", "A":"\u0410","B":"\u0411","C":"\u0426","D":"\u0414","E":"\u0415","F":"\u0424","G":"\u0413","H":"\u0425","I":"\u0418", "J":"\u0408","K":"\u041a","L":"\u041b","M":"\u041c","N":"\u041d","O":"\u041e","P":"\u041f","R":"\u0420","S":"\u0421", "T":"\u0422","U":"\u0423","V":"\u0412","Z":"\u0417","Y":"\u0408", "a":"\u0430","b":"\u0431","c":"\u0446","d":"\u0434","e":"\u0435","f":"\u0444","g":"\u0433","h":"\u0445","i":"\u0438", "j":"\u0458","k":"\u043a","l":"\u043b","m":"\u043c","n":"\u043d","o":"\u043e","p":"\u043f","r":"\u0440","s":"\u0441", "t":"\u0442","u":"\u0443","v":"\u0432","z":"\u0437","y":"\u0458" }; function transliterateSerbian(text) { if (/[\u0400-\u04FF]/.test(text)) { return text.replace(/./g, c => cyrToLat[c] || c); } else { return text .replace(/d\u017e|lj|nj|D\u017e|Lj|Nj/g, m => latToCyr[m]) .replace(/./g, c => latToCyr[c] || c); } } const toggles = []; const processedDivs = new WeakSet(); function processMcDiv(div, index) { if (processedDivs.has(div)) return; const nummer = index + 1; processedDivs.add(div); const btn = document.createElement("button"); if (nummer >= 694 && nummer <= 704) { btn.textContent = "\u0436\u017E"; } else if (nummer >= 859 && nummer <= 869) { btn.textContent = "uV"; } else { return; } btn.style.position = "absolute"; btn.style.backgroundColor = "gray"; btn.style.color = "white"; btn.style.fontSize = "12px"; btn.style.padding = "2px 4px"; btn.style.border = "none"; btn.style.borderRadius = "3px"; btn.style.cursor = "pointer"; btn.style.zIndex = "1000"; btn.style.marginTop= "-5px"; btn.style.marginLeft= "13px"; btn.style.opacity = "0"; btn.style.transition = "opacity 1s ease"; setTimeout(() => { btn.style.opacity = "1"; }, 1234); btn.addEventListener("mouseenter", () => { btn.style.backgroundColor = "black"; }); btn.addEventListener("mouseleave", () => { btn.style.backgroundColor = "gray"; }); document.body.appendChild(btn); function reposition() { const rect = div.getBoundingClientRect(); btn.style.top = window.scrollY + rect.top + 5 + "px"; btn.style.left = window.scrollX + rect.right - btn.offsetWidth - 4 + "px"; } const io = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if (entry.isIntersecting) { reposition(); observer.disconnect(); } }); }); io.observe(div); window.addEventListener("scroll", reposition); window.addEventListener("resize", reposition); if (nummer >= 694 && nummer <= 704) { btn.addEventListener("click", (event) => { div.innerText = transliterateSerbian(div.innerText); if (event.isTrusted) { setTimeout(() => { window.scrollTo(window.scrollX, window.scrollY); window.dispatchEvent(new Event('scroll')); }, 0); } else { reposition(); } }); } if (nummer >= 859 && nummer <= 869) { processedDivs.add(div); const btn = document.createElement("button"); btn.textContent = "uV"; btn.style.position = "absolute"; btn.style.backgroundColor = "gray"; btn.style.color = "white"; btn.style.fontSize = "12px"; btn.style.padding = "2px 4px"; btn.style.border = "none"; btn.style.borderRadius = "3px"; btn.style.cursor = "pointer"; btn.style.zIndex = "1000"; btn.style.marginTop = "-5px"; btn.style.marginLeft = "13px"; btn.style.opacity = "0"; btn.style.transition = "opacity 1s ease"; setTimeout(() => { btn.style.opacity = "1"; }, 1234); btn.addEventListener("mouseenter", () => { btn.style.backgroundColor = "black"; }); btn.addEventListener("mouseleave", () => { btn.style.backgroundColor = "gray"; }); document.body.appendChild(btn); const script = document.createElement("script"); script.type = "text/plain"; script.className = "latin-original"; script.style.display = "none"; script.textContent = div.innerHTML; div.insertAdjacentElement("afterend", script); div.setAttribute("data-latin", "human"); function reposition() { const rect = div.getBoundingClientRect(); btn.style.top = window.scrollY + rect.top + 5 + "px"; btn.style.left = window.scrollX + rect.right - btn.offsetWidth - 4 + "px"; } const io = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if (entry.isIntersecting) { reposition(); observer.disconnect(); } }); }); io.observe(div); window.addEventListener("scroll", reposition); window.addEventListener("resize", reposition); btn.addEventListener("click", (event) => { if (div.getAttribute("data-latin") === "human") { const original = script.textContent; div.innerHTML = toClassicalLatinCicero(original); div.setAttribute("data-latin", "classical"); } else { div.innerHTML = script.textContent; div.setAttribute("data-latin", "human"); } if (event.isTrusted) { setTimeout(() => { window.scrollTo(window.scrollX, window.scrollY); window.dispatchEvent(new Event('scroll')); }, 0); } else { reposition(); } }); } toggles.push(btn); } const allDivs = document.querySelectorAll("div.mc"); allDivs.forEach((div, index) => processMcDiv(div, index)); new MutationObserver(mutations => { mutations.forEach(m => { m.addedNodes.forEach(node => { if (node.nodeType === 1 && node.matches && node.matches("div.mc")) { const index = Array.from(document.querySelectorAll("div.mc")).indexOf(node); processMcDiv(node, index); } }); }); }).observe(document.body, { childList: true, subtree: true }); (function () { const QUIET_TIME = 1111; let timeoutId; let alreadyExecuted = false; const observer = new MutationObserver(() => { if (alreadyExecuted) return; clearTimeout(timeoutId); timeoutId = setTimeout(() => { if (alreadyExecuted) return; alreadyExecuted = true; observer.disconnect(); const scrollXBefore = window.scrollX; const scrollYBefore = window.scrollY; setTimeout(() => { const scrollXAfter = window.scrollX; const scrollYAfter = window.scrollY; if (scrollXBefore === scrollXAfter && scrollYBefore === scrollYAfter) { window.scrollTo(window.scrollX, window.scrollY); window.dispatchEvent(new Event('scroll')); } }, 100); let clicked = 0; for (let i = 0; i < toggles.length && clicked < 5; i++) { if ((i + 1) % 2 !== 0) continue; // nur gerade Buttons (i = 1, 3, 5, ...) const btn = toggles[i]; const rect = btn.getBoundingClientRect(); const inViewport = rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth); if (true || inViewport) { btn.click(); clicked++; } } }, QUIET_TIME); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } //VERSION25 ------------------------------------------------------------------- if(location.href.indexOf('f!')>0) { if(document.getElementById('ecbca872e4aa46d42d24a873ae4c2850'))document.getElementById('ecbca872e4aa46d42d24a873ae4c2850').innerHTML=' '; setTimeout("if(document.getElementsByClassName('LG')[12])document.getElementsByClassName('LG')[12].innerHTML=' '",1111); setTimeout("if(document.getElementsByClassName('LG')[12])document.getElementsByClassName('LG')[12].innerHTML=' '",2222); setTimeout("if(document.getElementsByClassName('LG')[12])document.getElementsByClassName('LG')[12].innerHTML=' '",3333); function createVariantLoader(config) { const { referenceIndex, urlPatternFrom, urlPatternTo, buttonText, logSuffix = '', autoActivate = false, isHelpButton = false, helpMessage = '' } = config; setTimeout(() => { const allDivs = document.querySelectorAll('div[id]'); const targetDiv = allDivs[referenceIndex]; if (!targetDiv) return; let container = targetDiv.querySelector('.variant-button-container'); if (!container) { container = document.createElement('div'); container.className = 'variant-button-container'; const rightOffset = screen.availWidth < 1000 ? '-14px' : '-4px'; Object.assign(container.style, { position: 'absolute', top: '4px', right: rightOffset, display: 'flex', gap: '6px', zIndex: '1000' }); targetDiv.style.position = 'relative'; targetDiv.appendChild(container); } const btn = document.createElement("button"); btn.innerHTML= buttonText; btn.className = isHelpButton ? 'help-button' : 'variant-button'; Object.assign(btn.style, { backgroundColor: isHelpButton ? "#666" : "gray", color: "white", fontSize: "13px", padding: "4px 8px", border: "none", borderRadius: "4px", cursor: "pointer", fontFamily: "system-ui, sans-serif", transition: "background-color 0.2s, box-shadow 0.2s", whiteSpace: "pre-line" }); if (isHelpButton) { btn.title = "Hilfe"; btn.addEventListener("click", () => { alert(helpMessage || "Hier kannst du eine Sprachvariante auswählen."); }); btn.addEventListener("mouseenter", () => { btn.style.backgroundColor = "#444"; }); btn.addEventListener("mouseleave", () => { btn.style.backgroundColor = "#666"; }); container.appendChild(btn); return; } const setActiveButton = (activeBtn) => { const all = container.querySelectorAll('.variant-button'); all.forEach(b => { b.dataset.active = "false"; b.style.backgroundColor = "gray"; b.style.boxShadow = ""; }); activeBtn.dataset.active = "true"; activeBtn.style.backgroundColor = "#2a9fd6"; activeBtn.style.boxShadow = "0 0 4px #2a9fd6"; }; const loadVariant = () => { const reference = allDivs[referenceIndex]; let mcDivs = []; let current = reference.nextElementSibling; while (current && mcDivs.length < 11) { if (current.classList.contains('mc')) { mcDivs.push(current); } current = current.nextElementSibling; } const newUrl = location.href.replace(urlPatternFrom, urlPatternTo); const iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = newUrl; document.body.appendChild(iframe); iframe.onload = function () { try { const iframeMcDivs = Array.from( iframe.contentDocument.querySelectorAll('div.mc') ).slice(0, 11); if (iframeMcDivs.length !== mcDivs.length) { console.warn(`div.mc count not matching! ${logSuffix}`); } for (let i = 0; i < Math.min(11, mcDivs.length, iframeMcDivs.length); i++) { mcDivs[i].innerHTML = iframeMcDivs[i].innerHTML; } setActiveButton(btn); console.log(`Did load ${newUrl}. ${logSuffix}`); } catch (e) { console.error(`Could not read: ${logSuffix}`, e); } }; }; btn.addEventListener("mouseenter", () => { if (btn.dataset.active !== "true") { btn.style.backgroundColor = "#444"; } }); btn.addEventListener("mouseleave", () => { if (btn.dataset.active !== "true") { btn.style.backgroundColor = "gray"; } }); btn.addEventListener("click", loadVariant); container.appendChild(btn); if (autoActivate) { setActiveButton(btn); //loadVariant(); } }, 777); } createVariantLoader({ referenceIndex: 7, urlPatternFrom: 'f!', urlPatternTo: 'l!', buttonText: '\u0627\u0644\u0639\u0631\u0628\u064a\u0629 \u0627\u0644\u0641\u0635\u062d\u0649\n(ar\u202FArabisch)', logSuffix: ' (MSA)', autoActivate: true }); createVariantLoader({ referenceIndex: 7, urlPatternFrom: 'f!', urlPatternTo: 'm!', buttonText: '\u0627\u0644\u0645\u0635\u0631\u064a\u0629\n(arz Ägypt.)', logSuffix: ' (EGY)' }); createVariantLoader({ referenceIndex: 7, urlPatternFrom: 'f!', urlPatternTo: 'n!', buttonText: '\u0627\u0644\u0634\u0627\u0645\u064a\u0629\n(apc Levant.)', logSuffix: ' (LEV)' }); createVariantLoader({ referenceIndex: 7, urlPatternFrom: 'f!', urlPatternTo: 'o!', buttonText: '\u0627\u0631\u062f\u0648\n(ur Urdu)', logSuffix: ' (UR)' }); createVariantLoader({ referenceIndex: 7, isHelpButton: true, buttonText: '?', helpMessage: 'Schaltflächen von links nach rechts:\n\nHocharabisch (ar), Ägyptisch (arc), Levantinisch (apc), Urdu (ur).\n\nDie hellblaue Schaltfläche zeigt die gerade angezeigte Sprache.\n\n\n\u1d05\u1d00\u0020\u1d1c\u0280\u1d05\u1d1c\u0020\u026a\u1d0d\u0020\u029c\u1d00\u1d1c\u1d18\u1d1b\u1d0d\u1d07\u0274\u1d1c\u1d07\u0020\u1d05\u1d07\u0280\u0020\u0073\u1d18\u0280\u1d00\u1d04\u029c\u1d07\u0274\u0020\ua730\u1d07\u029c\u029f\u1d1b\u002c\u0020\u029c\u1d00\u0299\u1d07\u0274\u0020\u1d21\u026a\u0280\u0020\u1d07\u0073\u0020\u1d00\u029f\u0073\u0020\u0073\u1d04\u029c\u1d00\u029f\u1d1b\ua730\u029f\u1d00\u1d07\u1d04\u029c\u1d07\u0020\u0299\u1d07\u026a\u1d0d\u0020\u1d00\u0280\u1d00\u0299\u026a\u0073\u1d04\u029c\u1d07\u0274\u0020\u1d18\u029f\u1d00\u1d1b\u1d22\u026a\u1d07\u0280\u1d1b\u0020\u2013\u0020\u1d21\u1d07\u0262\u1d07\u0274\u0020\u1d05\u1d07\u0280\u0020\u1d00\u1d07\u029c\u0274\u029f\u026a\u1d04\u029c\u1d07\u0274\u0020\u0073\u1d04\u029c\u0280\u026a\ua730\u1d1b\u0020\u1d1c\u0274\u1d05\u0020\u1d21\u1d0f\u0280\u1d1b\u1d20\u1d07\u0280\u1d21\u1d00\u0274\u1d05\u1d1b\u0073\u1d04\u029c\u1d00\ua730\u1d1b\u002c\u0020\u1d0f\u0299\u1d21\u1d0f\u029c\u029f\u0020\u1d07\u0073\u0020\u1d22\u1d1c\u0020\u1d07\u026a\u0274\u1d07\u0280\u0020\u1d00\u0274\u1d05\u1d07\u0280\u1d07\u0274\u0020\u0073\u1d18\u0280\u1d00\u1d04\u029c\ua730\u1d00\u1d0d\u026a\u029f\u026a\u1d07\u0020\u0262\u1d07\u029c\u1d0f\u1d07\u0280\u1d1b\u002e'}); ////////////////////////// **************************************************** function createSwitcher(config) { const { referenceIndex, urlPatternFrom, urlPatternTo, buttonTextOn, buttonTextOff, logSuffix = '' } = config; let clickedOnce = false; let originalContents = []; let alternateContents = []; let mcDivs = []; let btn; // für Zugriff in inneren Funktionen function disableBtn() { if (btn) { btn.disabled = true; btn.style.opacity = "0.6"; btn.style.cursor = "default"; } } function enableBtn() { if (btn) { btn.disabled = false; btn.style.opacity = ""; btn.style.cursor = "pointer"; } } function swapToAlternate() { const allDivs = document.querySelectorAll('div[id]'); const reference = allDivs[referenceIndex]; mcDivs = []; let current = reference.nextElementSibling; while (current && mcDivs.length < 11) { if (current.classList.contains('mc')) { mcDivs.push(current); } current = current.nextElementSibling; } originalContents = mcDivs.map(div => div.innerHTML); const newUrl = location.href.replace(urlPatternFrom, urlPatternTo); const iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = newUrl; document.body.appendChild(iframe); disableBtn(); iframe.onload = function () { try { const iframeMcDivs = Array.from( iframe.contentDocument.querySelectorAll('div.mc') ).slice(0, 11); if (iframeMcDivs.length !== mcDivs.length) { console.warn(`div.mc does not match! ${logSuffix}`); } alternateContents = iframeMcDivs.map(div => div.innerHTML); for (let i = 0; i < Math.min(11, mcDivs.length, alternateContents.length); i++) { mcDivs[i].innerHTML = alternateContents[i]; } btn.textContent = buttonTextOff; clickedOnce = true; console.log(`Took contents from ${newUrl}. ${logSuffix}`); } catch (e) { console.error(`Could not read: ${logSuffix}`, e); } finally { enableBtn(); } }; } function swapBackToOriginal() { if (mcDivs.length && originalContents.length) { for (let i = 0; i < mcDivs.length; i++) { mcDivs[i].innerHTML = originalContents[i]; } btn.textContent = buttonTextOn; clickedOnce = false; console.log(`Default contents set. ${logSuffix}`); } } setTimeout(() => { const allDivs = document.querySelectorAll('div[id]'); const targetDiv = allDivs[referenceIndex]; if (targetDiv && !targetDiv.querySelector('button')) { btn = document.createElement("button"); btn.textContent = buttonTextOn; Object.assign(btn.style, { position: "absolute", backgroundColor: "gray", color: "white", fontSize: "12px", padding: "2px 4px", border: "none", borderRadius: "3px", cursor: "pointer", zIndex: "1000", margin: "4px", }); btn.addEventListener("mouseenter", () => { if (!btn.disabled) btn.style.backgroundColor = "black"; }); btn.addEventListener("mouseleave", () => { if (!btn.disabled) btn.style.backgroundColor = "gray"; }); btn.addEventListener("click", () => { if (btn.disabled) return; if (!clickedOnce) { swapToAlternate(); } else { swapBackToOriginal(); } }); targetDiv.appendChild(btn); } }, 777); } createSwitcher({ referenceIndex: 55, urlPatternFrom: 'f!', urlPatternTo: 'h!', buttonTextOn: 'nb › nn', buttonTextOff: 'nn › nb', }); createSwitcher({ referenceIndex: 36, urlPatternFrom: 'f!', urlPatternTo: 'i!', buttonTextOff: 'hyw › hye', buttonTextOn: 'hye › hyw', logSuffix: ' (Y)' }); createSwitcher({ referenceIndex: 77, urlPatternFrom: 'f!', urlPatternTo: 'j!', buttonTextOn: '\u7b80\u4f53 › \u7e41\u9ad4', buttonTextOff: '\u7e41\u9ad4 › \u7b80\u4f53', logSuffix: ' (Z)' }); ///////////////////////////////////////////////////////// function createAlternateSwitcher77() { const referenceIndex = 77; const urlPatternFrom = 'f!'; const urlPatternTo = 'k!'; const buttonTextOff = '\u7cb5 › \u666e'; // 粵 › 普 const buttonTextOn = '\u666e › \u7cb5'; // 普 › 粵 let clickedOnce = false; let mcDivs = []; let originalContents = []; let btn; setTimeout(() => { const allDivs = document.querySelectorAll('div[id]'); const reference = allDivs[referenceIndex]; if (!reference) return; btn = document.createElement('button'); btn.textContent = buttonTextOn; Object.assign(btn.style, { position: "relative", backgroundColor: "#009999", color: "white", fontSize: "12px", padding: "2px 4px", border: "none", borderRadius: "3px", cursor: "pointer", zIndex: "1000", margin: "4px", left: "72px" }); btn.addEventListener("mouseenter", () => { if (!btn.disabled) btn.style.backgroundColor = "#008080"; }); btn.addEventListener("mouseleave", () => { if (!btn.disabled) btn.style.backgroundColor = "#009999"; }); btn.addEventListener("click", () => { if (btn.disabled) return; if (!clickedOnce) { btn.disabled = true; btn.style.opacity = "0.6"; btn.style.cursor = "default"; const allButtons = reference.querySelectorAll("button"); if (allButtons.length > 0) { allButtons[0].style.display = "none"; } mcDivs = []; let current = reference.nextElementSibling; while (current && mcDivs.length < 11) { if (current.classList.contains('mc')) { mcDivs.push(current); } current = current.nextElementSibling; } originalContents = mcDivs.map(div => div.innerHTML); const newUrl = location.href.replace(urlPatternFrom, urlPatternTo); const iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = newUrl; document.body.appendChild(iframe); iframe.onload = function () { try { const iframeMcDivs = Array.from( iframe.contentDocument.querySelectorAll('div.mc') ).slice(0, 11); for (let i = 0; i < Math.min(11, mcDivs.length, iframeMcDivs.length); i++) { mcDivs[i].innerHTML = iframeMcDivs[i].innerHTML; } btn.textContent = buttonTextOff; clickedOnce = true; console.log(`Loaded ${newUrl} (K).`); } catch (e) { console.error(`Error loading iframe (K):`, e); } finally { btn.disabled = false; btn.style.opacity = ""; btn.style.cursor = "pointer"; } }; } else { for (let i = 0; i < mcDivs.length; i++) { mcDivs[i].innerHTML = originalContents[i]; } const allButtons = reference.querySelectorAll("button"); if (allButtons.length > 0) { allButtons[0].style.display = ""; } btn.textContent = buttonTextOn; clickedOnce = false; console.log("Set to default contents (K)."); } }); reference.appendChild(btn); }, 777); } createAlternateSwitcher77(); ///////////////////////////////////////////////////////// const switcherHelpTexts = { 55: `Grauer Button wechselt von Bokmål (nb) zu Nynorsk (nn) und zurück.\n\nJetzt aktiv ist: %%ACTIVE%%.`, 36: `Grauer Button wechselt von Ostarmenisch (hye) zu Westarmenisch (hyw) und zurück.\n\nJetzt aktiv ist: %%ACTIVE%%.`, 77: `Grauer Button wechselt von vereinfachter (\u7b80\u4f53) zu traditioneller (\u7e41\u9ad4) chinesischer Schrift und zurück.\n\nTürkisfarbener Button wechselt von Hochchinesisch (Mandarin \u666e) zu Kantonesisch (\u7cb5) und zurück.\n\nJetzt aktiv ist: %%ACTIVE%%.`, }; function addHelpButtons() { const allDivs = document.querySelectorAll('div[id]'); Object.entries(switcherHelpTexts).forEach(([indexStr, text]) => { const index = parseInt(indexStr, 10); const referenceDiv = allDivs[index]; if (!referenceDiv) return; if (referenceDiv.querySelector('.help-button')) return; const helpBtn = document.createElement('button'); helpBtn.className = 'help-button'; helpBtn.innerHTML = '?'; Object.assign(helpBtn.style, { float: 'right', backgroundColor: '#e0e0e0', color: '#333', fontWeight: 'bold', fontFamily: 'sans-serif', fontSize: '13px', width: '20px', height: '20px', lineHeight: '18px', textAlign: 'center', padding: '0', margin: '4px', border: '1px solid #aaa', borderRadius: '50%', cursor: 'pointer', zIndex: '1002' }); helpBtn.addEventListener('mouseenter', () => { helpBtn.style.backgroundColor = '#ccc'; }); helpBtn.addEventListener('mouseleave', () => { helpBtn.style.backgroundColor = '#e0e0e0'; }); helpBtn.addEventListener('click', () => { const detectActiveLabel = (index) => { const ref = document.querySelectorAll('div[id]')[index]; if (!ref) return '\u003f'; const buttons = ref.querySelectorAll('button'); if (index === 55) { const label = buttons[0]?.textContent.trim(); return label === 'nb \u203a nn' ? 'Bokmål (nb)' : 'Nynorsk (nn)'; } if (index === 36) { const label = buttons[0]?.textContent.trim(); return label === 'hye \u203a hyw' ? 'Ostarmenisch (hye)' : 'Westarmenisch (hyw)'; } if (index === 77) { const grayLabel = buttons[0]?.textContent.trim(); const turquoiseLabel = buttons[1]?.textContent.trim(); const sprache = turquoiseLabel === '\u666e \u203a \u7cb5' ? 'Hochchinesisch (Mandarin \u666e)' : 'Kantonesisch (\u7cb5)'; const schrift = turquoiseLabel === '\u7cb5 \u203a \u666e' ? 'Traditionelle Schrift (\u7e41\u9ad4)' : (grayLabel === '\u7b80\u4f53 \u203a \u7e41\u9ad4' ? 'Vereinfachte Schrift (\u7b80\u4f53)' : 'Traditionelle Schrift (\u7e41\u9ad4)'); return schrift + ', ' + sprache; } return '\u003f'; }; const active = detectActiveLabel(index); const msg = text.replace(/%%ACTIVE%%/g, active); alert(msg); }); referenceDiv.appendChild(helpBtn); }); } setTimeout(addHelpButtons, 777); //////////////////////////////////////////////////////// (function () { function replaceQuotes(el) { el.innerHTML = el.innerHTML.replace( /“([^”]*[\u4E00-\u9FFF][^”]*)”/g, '「$1」' ); } document.querySelectorAll('.mc').forEach(replaceQuotes); const observer = new MutationObserver(function (mutationsList) { for (const mutation of mutationsList) { if (mutation.type === 'childList' || mutation.type === 'characterData') { mutation.target.closest?.('.mc')?.querySelectorAll('.mc').forEach(replaceQuotes); } } }); document.querySelectorAll('.mc').forEach(el => { observer.observe(el, { childList: true, characterData: true, subtree: true }); }); })(); } //////////////////////////////////////////////////////// if(location.href.indexOf('!!')>0) { document.querySelectorAll('div.mc, div.LG').forEach(div => { div.innerHTML = div.innerHTML.replace( /()([\s\r\n]*)()+/gi, '
' ); }); } window.onbeforeunload = function() { document.body.style.opacity = '0.2'; setTimeout(function() { document.body.style.opacity = '1'; }, 2222); };