Opmerking: nadat u de wijzigingen hebt gepubliceerd is het wellicht nodig uw browsercache te legen.

  • Firefox / Safari: houd Shift ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-Shift-R op een Mac)
  • Google Chrome: druk op Ctrl-Shift-R (⌘-Shift-R op een Mac)
  • Internet Explorer / Edge: houd Ctrl ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5
  • Opera: druk op Ctrl-F5.
// Read-only mode voor Wikipedia
//if (window.location.href.includes("&action=edit")) {
//  window.location.href = window.location.href.replace("&action=edit", "");
//}

// Script op basis van [[:en:User:Enterprisey/watchlist-notice.js]]
// Dit script geeft een melding op de plek van de volglijst-link van de laatst geüpdatete pagina uit de volglijst. een rood sterretje linkt naar de diff van die wijziging en geeft ook extra informatie als de muis erboven is.
// Indien gewenst kan ook één pagina extra in de gaten gehouden worden (de string pageToWatch), met een opvallende melding op de plek van de SiteNotice als deze bovenaan de  volglijst komt.

// Specifieke pagina om in de gaten te houden (moet wel op de volglijst staan):
const pageToWatch = "";
const meldingMinuten = 120 // minuten waarbinnen een edit moet zijn gedaan om nog een melding te geven.
const currentPageName = mw.config.get("wgPageName").replace(/_/g, ' ');
// Volglijst update-notice tonen aan of uit?
const volglijstNotice = true;
var showPTWNotice = false; 
mw.loader.using("mediawiki.util", function () {
  var showNotice = function (bewerking) {
    // Stick a "Watchlist update!" notice after the notification count
    $("#pt-notifications-notice").after(
      $("<li>")
        .append(
          $("<a>")
            .text(bewerking.title + " geüpdatet")
            .css({
              "background-color": "#3385ff",
              color: "white",
              "border-radius": "2px",
              padding: "0.25em 0.45em 0.2em",
              cursor: "pointer",
              "font-weight": "bold",
              transition: "background-color 0.5s",
            })
            .attr("href", "/wiki/Special:Watchlist")
            .mouseover(updateNotice)
        )
        .attr("id", "watchlist-update-notice")
    );
    var commentString = bewerking.comment.replace("/* ", "");
    var bewerkingArray = commentString.split (' */');
    var tooltip = '➝ ' + bewerkingArray[0];
    if (bewerkingArray[1]) {
      tooltip += ': ' + bewerkingArray[1];       
    }
    var kop = bewerkingArray[0];
    if (kop.substr (0, 22) == 'Nieuw kopje aangemaakt') {
      kop = bewerkingArray[0].substr(24, bewerkingArray[0].length);
    }
    $("#pt-mytalk").before(
      $("<li>")
        .append(
          $("<a>")
            .text("*")
            .css({
              color: "#555555",
              "border-radius": "2px",
              padding: "0.25em 0.45em 0.2em",
              cursor: "pointer",
              "font-weight": "bold",
              transition: "background-color 0.5s",
            })
            .attr(
              "href",
              "https://nl.wikipedia.org/w/index.php?title=" +
                encodeURI(bewerking.title.replace(/ /g,"_")) +
                "&curid=" +
                bewerking.pageid +
                "&diff=" +
                bewerking.revid + "&volglijstmelder=true"
            )
        )
        .attr("id", "watchlist-update-diff")
        .attr(
          "title",
          bewerking.type +
            " door " +
            bewerking.user +
            " (" + tooltip +
            ")")
    );
    $("#pt-mytalk").before(
      $("<li>")
        .append(
          $("<a>")
            .text("→")
            .css({
              color: "#555555",
              "border-radius": "2px",
              padding: "0.25em 0.45em 0.2em",
              cursor: "pointer",
              "font-weight": "bold",
              transition: "background-color 0.5s",
            })
            .attr(
              "href",
              "https://nl.wikipedia.org/w/index.php?title=" + 
                encodeURI(bewerking.title.replace(/ /g,"_")) + "#" + kop.replace(/ /g,"_") 
            )
        )
        .attr("id", "watchlist-update-link")
        .attr(
          "title", tooltip)
    );
  };

  var updateNotice = function () {
    // Lighten the background color so the user knows we're updating
    $("#watchlist-update-notice a").css("background-color", "#7bff7b");

    // Update the notice
    var aantalEdits = 1;
    if (pageToWatch) {
      aantalEdits = 5;
    }
    $.getJSON(mw.util.wikiScript("api"), {
      format: "json",
      action: "query",
      list: "watchlist",
      wlprop: "comment|title|user|timestamp",
      wlshow: "unread",
      wllimit: aantalEdits,
    }).done(function (data) {
      if (!data.query) return;
      if (data.query.watchlist.length) {
        // There are new watchlist diffs to read, so show notice
        var minuten = Math.round((Date.now() - Date.parse(data.query.watchlist[0].timestamp)) / 60000);
        if (
          data.query.watchlist[0].title == pageToWatch &&
          data.query.watchlist[0].user !== "Nlwikibots" && minuten <= meldingMinuten
        ) {
          showPTWNotice = true;
          document.getElementById("siteNotice").innerHTML =
            '<div style="width:100%; margin: 0 auto; padding:.5em; background-color:#ffb84d;">De pagina <strong><a href="' +
            "https://nl.wikipedia.org/wiki/" +
            encodeURI(pageToWatch.replace(/ /g,"_")) +
            '">' +
            pageToWatch +
            '</a></strong> is onlangs gewijzigd door <a href = "https://nl.wikipedia.org/wiki/Overleg_gebruiker:' +
            encodeURI(data.query.watchlist[0].user) +
            '">' +
            data.query.watchlist[0].user +
            '</a>. (<a href="https://nl.wikipedia.org/w/index.php?title=' +
            encodeURI(pageToWatch.replace(/ /g,"_")) +
            "&curid=" +
            data.query.watchlist[0].pageid +
            "&diff=" +
            data.query.watchlist[0].revid +
            '">diff</a>)</div>';
        }
        if (!$("#watchlist-update-notice").length) {
          // That is, if it isn't shown already
          if (volglijstNotice) {
            showNotice(data.query.watchlist[0]);
          }
        } else {
          // There's already a notice, so change background
          $("#watchlist-update-notice a").css("background-color", "#3385ff");
        }
      } else {
        // No new watchlist diffs to read, so hide notice, diff and link
        $("#watchlist-update-notice").remove();
        $("#watchlist-update-diff").remove();
        $("#watchlist-update-link").remove();
        if (pageToWatch === currentPageName) {
          $("#siteNotice").remove();
          showPTWNotice = false;
        }
      }
    });
  };

  $(document).ready(function () {
    updateNotice();
    window.setInterval(updateNotice, 120000);
  });
});