Widget:ContactsPageWidget: различия между версиями

Перейти к навигации Перейти к поиску
(Новая страница: «<noinclude>__NOTOC__ This widget created to hold some JavaScript code for Contacts Button custom behaiour </noinclude> <includeonly> <style> .wk2bUnAuthPopup { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 300px; padding: 20px; background-color: white; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); border-radius: 8px; border: 1px solid rgb(167, 215, 249); text-align:...»)
 
Нет описания правки
Строка 48: Строка 48:


function wk2bFuncTurnButtonIntoLink(buttonId) {
function wk2bFuncTurnButtonIntoLink(buttonId) {
const targetButton = document.getElementById(buttonId);
    const buttons = document.getElementsByClassName(buttonId)
if (targetButton != undefined) {
    if (buttons .length > 0) {
const linkToGo = targetButton.childNodes[1].childNodes[0].href.replace("source", "returnto");
        for (let index in buttons) {
const buttonText = targetButton.childNodes[1].childNodes[0].textContent;
            const targetButton = buttons[index];
targetButton.childNodes[1].removeChild(targetButton.childNodes[1].childNodes[0])
          if (targetButton != undefined) {
targetButton.innerHTML = '<p>' + buttonText + '</p>';
        const linkToGo = targetButton.childNodes[1].childNodes[0].href.replace("source", "returnto");
targetButton.onclick = function() {
        const buttonText = targetButton.childNodes[1].childNodes[0].textContent;
window.location = linkToGo;
        targetButton.childNodes[1].removeChild(targetButton.childNodes[1].childNodes[0])
}
        targetButton.innerHTML = '<p>' + buttonText + '</p>';
}
        targetButton.onclick = function() {
        window. Location = linkToGo;
        }
        }
 
        }
    } else {
    const targetButton = document.getElementById(buttonId);
    if (targetButton != undefined) {
    const linkToGo = targetButton.childNodes[1].childNodes[0].href.replace("source", "returnto");
    const buttonText = targetButton.childNodes[1].childNodes[0].textContent;
    targetButton.childNodes[1].removeChild(targetButton.childNodes[1].childNodes[0])
    targetButton.innerHTML = '<p>' + buttonText + '</p>';
    targetButton.onclick = function() {
    window. Location = linkToGo;
    }
    }
    }
}
}


window.onload = (event) => {
window. Onload = (event) => {
     console.log("Page is fully loaded");
     console.log("Page is fully loaded");



Версия от 23:01, 7 августа 2025

This widget created to hold some JavaScript code for Contacts Button custom behaiour