Cookies help us deliver our services. By using our services, you agree to our use of cookies. More information

MediaWiki:Common.js

From NoSQLZoo
Revision as of 08:36, 5 June 2018 by 40166222 (talk | contribs)
Jump to: navigation, 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.
$(function() {
    "use strict";
    var nosqlzoo = document.createElement("script");
    var beautify = document.createElement("script");
    nosqlzoo.src = "/mw/nosqlzoo.js";
    beautify.src = "/mw/beautify.js";
    document.head.appendChild(nosqlzoo);
    document.head.appendChild(beautify);

    //Allow all the tables to be collapsible
    //items move into the "More" actions
    //Change the following to change the word "More"
    //http://sqlzoo.net/dev/MediaWiki:Vector-more-actions
    $("#left-navigation,#right-navigation").hide();
    $("#ca-view, #ca-viewsource, #ca-edit").addClass("collapsible");

    $("#mw-head").append(
        $("<div/>", {
            id: "cog-cont"
        }).append(
            $("<div/>", {
                css: {
                    "background-image": "url(//sqlzoo.net/design/Cog_font_awesome.svg)",
                    "z-index": 1003,
                    width: 32,
                    height: 32,
                    position: "absolute",
                    right: 0,
                    top: 0
                },
                title: "Wiki Controls",
                id: "cog",
                click: function() {
                    $("#coglist").slideToggle();
                    if ($("#overlay").length === 0) {
                        $("<div/>", {
                                id: "overlay",
                                click: function() {
                                    $("#coglist").slideUp();
                                    $("#overlay").remove();
                                },
                                css: {
                                    position: "absolute",
                                    top: 0,
                                    left: 0,
                                    background: "#AAA",
                                    width: "100%",
                                    height: "100%",
                                    opacity: 0.3,
                                    "z-index": 1002
                                }
                            })
                            .appendTo("body");
                    } else {
                        $("#overlay").remove();
                    }
                }
            }))
    );
    $("#cog-cont").append(
        $("<ul/>", {
            id: "coglist",
            css: {
                display: "none",
                "z-index": 1003
            }
        })
        .append($("<li/>").append($("#p-search")))
        .append($("#pick-engine"))
        .append($("#pt-createaccount"))
        .append($("#pt-userpage"))
        .append($("#pt-mytalk"))
        .append($("#pt-preferences"))
        .append($("#pt-watchlist"))
        .append($("#pt-mycontris"))
        //      .append($("#pt-login"))
        //      .append($("#pt-logout"))
        .append($("#ca-view"))
        .append($("#ca-viewsource"))
        .append($("#ca-edit"))
        .append($("#ca-history"))
        .append($("#ca-nstab-main"))
        .append($("#ca-talk"))
        .append($("#ca-watch"))
        .append($("#ca-unwatch"))
        .append($("#ca-move"))
        .append($("#ca-delete"))
        .append($("#ca-protect"))
    );
    $("#pt-login, #pt-logout").before($("#pick-engine"));
    /*$("#mw-head").prepend($("<a/>", {
        id: "napier-ad",
        href: "//www.napier.ac.uk/faculties/engineering-computing-creative/computing/Pages/Postgraduate.aspx?sz",
        title: "NoSQLZoo: developed and maintained at Edinburgh Napier University",
        text: "NoSQLZoo: developed and maintained at Edinburgh Napier University"
    }));*/
});

/*
 Tweek the Log in scheme
 * */
$(function() {
    "use strict";
    $("#mw-user-domain-section").hide();
    $("#wpRemember").attr("checked", true);
});