MediaWiki:Tweeki.js

From Ensiklopedia
Revision as of 15:54, 27 July 2023 by Admin (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* 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
    }
  });