MediaWiki:Common.js

From Billy Meier

Note: After saving, 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: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */

/* Any JavaScript here will be loaded for all users on every page load. */

$( document ).ready(function() {
        console.log( "document loaded" );

var monthNames = [ "January / Januar", "February / Februar", "March / März", "April", "May / Mai", "June / Juni", "July / Juli", "August", "September", "October / Oktober", "November", "December / Dezember" ]; 
var dayNames= ["Sunday / Sonntag,","Monday / Montag,","Tuesday / Dienstag,","Wednesday / Mittwoch,","Thursday / Donnerstag,","Friday / Freitag,","Saturday / Samstag,"]

var newDate = new Date();

newDate.setDate(newDate.getDate());

$('#FOMdate').html(dayNames[newDate.getDay()] + " " + newDate.getUTCDate() + ' ' + monthNames[newDate.getUTCMonth()] + ' ' + newDate.getUTCFullYear());

setInterval( function() {

var seconds = new Date().getSeconds();

$("#sec").html(( seconds < 10 ? "0" : "" ) + seconds);
},1000);

setInterval( function() {

var minutes = new Date().getMinutes();

$("#min").html(( minutes < 10 ? "0" : "" ) + minutes);
},1000);

setInterval( function() {

var hours = new Date().getHours();

$("#hours").html(( hours < 10 ? "0" : "" ) + hours);
}, 1000);
});

$(function() {
  $(".DateDiv").each(function(index) {
    var sRange = $(this).find(".DateRange").html();
    var arrTemp = sRange.split(" to ");
    var dtFrom = new Date(arrTemp[0]);
    var dtTo = new Date(arrTemp[1]);
    var dtNow = new Date();
    if (dtNow >= dtFrom && dtNow <= dtTo)
      $(this).show();
  });
});