MediaWiki:Tweeki.js

From Ensiklopedia
Revision as of 16:52, 2 August 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;


$(function () {
   if (mw.config.get('wgNamespaceNumber') === 0) { // Check if it's a content page (namespace 0)
      var templateText = '{{Comment}}'; // Replace 'YourTemplate' with the name of your template
      $('#mw-content-text').append(templateText);
   }
});