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

Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
 
(не показаны 3 промежуточные версии этого же участника)
Строка 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;
    }
    }
     }
     }
    }
}
}


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


Строка 91: Строка 73:
wk2bFuncTurnButtonIntoLink(buttonLoginId);
wk2bFuncTurnButtonIntoLink(buttonLoginId);


             const buttons = document.getElementsByClassName(buttonId);
             const buttons = document.getElementsByClassName(targetDivId);
             if (buttons. Length > 0) {
             if (buttons.length > 0) {
                 for (let index in buttons) {
                 for (let index in buttons) {
                     const targetDiv = buttons[index];
                     const targetDiv = buttons[index];

Текущая версия от 02:36, 8 августа 2025

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