MediaWiki:Common.js: Difference between revisions

Move Gadvia score calculator to a gadget
Line 24: Line 24:
     const outputDateString = date.toString();
     const outputDateString = date.toString();
     span.title = `This date in your timezone: ${outputDateString}`;
     span.title = `This date in your timezone: ${outputDateString}`;
});
/* Rizline clickable bio chips */
findAndExecute(".rgwiki-rizline-bio-chip-focusable", (chip) => {
    chip.addEventListener("click", () => {
        const isLeft = chip.classList.contains("rgwiki-rizline-bio-chip-left");
        const isRight = chip.classList.contains("rgwiki-rizline-bio-chip-right");
        if (isLeft) {
            document.querySelectorAll(".rgwiki-rizline-bio-chip-focusable.rgwiki-rizline-bio-chip-left.rgwiki-rizline-bio-chip-clicked").forEach((x) => {
                x.classList.remove("rgwiki-rizline-bio-chip-clicked");
            });
        }
        if (isRight) {
            document.querySelectorAll(".rgwiki-rizline-bio-chip-focusable.rgwiki-rizline-bio-chip-right.rgwiki-rizline-bio-chip-clicked").forEach((x) => {
                x.classList.remove("rgwiki-rizline-bio-chip-clicked");
            });
        }
        chip.classList.add("rgwiki-rizline-bio-chip-clicked");
    });
});
});