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

Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
Строка 48: Строка 48:


function wk2bFuncTurnButtonIntoLink(buttonId) {
function wk2bFuncTurnButtonIntoLink(buttonId) {
    const buttons = document.getElementsByClassName(buttonId);


    if (buttons. Length > 0) {
        for (let index in buttons) {
            const targetButton = buttons[index];
          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;
        }
        }
        }
    } else {
    const targetButton = document.getElementById(buttonId);
    const targetButton = document.getElementById(buttonId);
    if (targetButton != undefined) {
    if (targetButton != undefined) {
Строка 74: Строка 58:
    window. Location = linkToGo;
    window. Location = linkToGo;
    }
    }
     }
     }
    }
}
}



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

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