MediaWiki:Common.js

From RevSpace
Revision as of 23:16, 20 May 2020 by Juerd (talk | contribs)
Jump to navigation Jump to search

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: 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. */
$.getScript("/status/mqtt-status.js?2", function () {
    $("<div id=spacestatus>?</div>").appendTo($("#p-logo"));
    $("<div id=n><a href='/N'>n = <span id=checked-in>?</span></a></div>").appendTo($("#p-logo"));
    $("#spacestatus")
       .revspace("groen", "rood")
       .on("closing", function () { $(this).stop().animate({zoom: 4}, function () { $(this).delay(500).animate({zoom:1}) } ); })
       .on("opening", function () { $(this).stop().animate({zoom: 4}, function () { $(this).delay(500).animate({zoom:1}) } ); })
    ;
    $(".spacestatus").revspace("open", "gesloten");
});

var nosummary = "No summary for hidden page";

$(function () { 
    if (! $("#firstHeading").text().match(/Hidden:/)) return;

    $("#editform #wpSummary")
    .val(nosummary)
    .change(function () { $(this).val(nosummary); })
    .hide();

    $("#wpSummaryLabel")
    .hide();
});

if ($("#kiekjes").length) {
    $.get("/kiekjes/latest?amount=8", function (data) {
        var photos = $("<div/>");
        for (var i in data.latest) {
            var item = data.latest[i];

            photos.append(
                $("<a>").attr({ href: item.url }).append(
                     $("<img>").attr({ src: item.thumbnail }).css({ width: '12.5%' })
                )
            );
        }
        $("#kiekjes").html(photos);
    });
}

// headings nummeren zoals in de toc
$(function() {
  $("a[href] .tocnumber").each(function() { $(this).html($(this).html() + "."); var id = $(this).parent().attr('href').replace(/^#/, ""); var h = document.getElementById(id); h.innerHTML = $(this).html() + " " + h.innerHTML;  });
})