MediaWiki:Common.js: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
Nie podano opisu zmian |
Nie podano opisu zmian |
||
| Linia 4: | Linia 4: | ||
$(function () { | $(function () { | ||
const startDate = new Date("2025-07-01"); | const startDate = new Date("2025-07-01"); | ||
const today = new Date(); | const today = new Date(); | ||
const msPerDay = 24 * 60 * 60 * 1000; | const msPerDay = 24 * 60 * 60 * 1000; | ||
const daysSinceStart = Math.floor((today - startDate) / msPerDay) + 1; | const daysSinceStart = Math.floor((today - startDate) / msPerDay) + 1; | ||
const formatDate = today.toLocaleDateString("pl-PL", { | const formatDate = today.toLocaleDateString("pl-PL", { | ||
Wersja z 08:51, 1 sie 2025
/* Umieszczony tutaj kod JavaScript zostanie załadowany przez każdego użytkownika, podczas każdego ładowania strony. */
mw.loader.using(['mediawiki.util'], function () {
$(function () {
const startDate = new Date("2025-07-01");
const today = new Date();
const msPerDay = 24 * 60 * 60 * 1000;
const daysSinceStart = Math.floor((today - startDate) / msPerDay) + 1;
const formatDate = today.toLocaleDateString("pl-PL", {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric"
});
const infoBox = document.createElement("div");
infoBox.style.background = "#f2f2f2";
infoBox.style.border = "2px solid #aaa";
infoBox.style.margin = "10px 0";
infoBox.style.padding = "8px";
infoBox.style.fontSize = "14px";
infoBox.style.fontWeight = "bold";
infoBox.style.textAlign = "center";
infoBox.style.fontFamily = "Verdana, sans-serif";
infoBox.innerHTML = `📅 <b>${formatDate}</b> | ⌛ Kolejopedia działa już <b>${daysSinceStart}</b> dni | 🏅 Koniec akcji „Dobry Artykuł”`;
const content = document.getElementById("bodyContent");
if (content) content.insertBefore(infoBox, content.firstChild);
});
});