MediaWiki: Tweeki.js: Difference between revisions

From Ensiklopedia
No edit summary
Tag: Manual revert
No edit summary
Tag: Reverted
Line 32: Line 32:
tampilTanggal = hari + ", " + tanggal + " " + bulan + " " + tahun
tampilTanggal = hari + ", " + tanggal + " " + bulan + " " + tahun
document.querySelector("p.date").innerHTML = tampilTanggal;
document.querySelector("p.date").innerHTML = tampilTanggal;
// Titles stored in an array
  const titlesToStyle = ['Darmo Kondo', 'Nederland Indische Artsen School'];
  // Get all <a> elements in the <ul>
  const linkElements = document.querySelectorAll('.mw-category-group ul li a');
  // Loop through the <a> elements and check if their title is in the array
  linkElements.forEach(link => {
    if (titlesToStyle.includes(link.title)) {
      link.style.fontStyle = 'italic';
      // Add other specific styles for the <a> tag here if needed
    }
  });

Revision as of 15:54, 27 July 2023

/* Any JavaScript here will be loaded for users using the Tweeki skin */

date = new Date();
tahun = date.getFullYear();
bulan = date.getMonth();
tanggal = date.getDate();
hari = date.getDay();

switch(hari) {
 case 0: hari = "Minggu"; break;
 case 1: hari = "Senin"; break;
 case 2: hari = "Selasa"; break;
 case 3: hari = "Rabu"; break;
 case 4: hari = "Kamis"; break;
 case 5: hari = "Jum'at"; break;
 case 6: hari = "Sabtu"; break;
}
switch(bulan) {
 case 0: bulan = "Januari"; break;
 case 1: bulan = "Februari"; break;
 case 2: bulan = "Maret"; break;
 case 3: bulan = "April"; break;
 case 4: bulan = "Mei"; break;
 case 5: bulan = "Juni"; break;
 case 6: bulan = "Juli"; break;
 case 7: bulan = "Agustus"; break;
 case 8: bulan = "September"; break;
 case 9: bulan = "Oktober"; break;
 case 10: bulan = "November"; break;
 case 11: bulan = "Desember"; break;
}
tampilTanggal = hari + ", " + tanggal + " " + bulan + " " + tahun
document.querySelector("p.date").innerHTML = tampilTanggal;

// Titles stored in an array
  const titlesToStyle = ['Darmo Kondo', 'Nederland Indische Artsen School'];

  // Get all <a> elements in the <ul>
  const linkElements = document.querySelectorAll('.mw-category-group ul li a');

  // Loop through the <a> elements and check if their title is in the array
  linkElements.forEach(link => {
    if (titlesToStyle.includes(link.title)) {
      link.style.fontStyle = 'italic';
      // Add other specific styles for the <a> tag here if needed
    }
  });