User:Andrewds1021/global.js

/********************* this comment is 80 characters long *********************/

(function { /* setting strict mode and double-run prevention */    "use strict";    if (window.andrewds1021 && window.andrewds1021.personal_global && window.andrewds1021.personal_global.has_run) return;   if (!window.andrewds1021) {        window.andrewds1021 = {            personal_global: {}        };    } else if (!window.andrewds1021.personal_global) {        window.andrewds1021.personal_global = {};    }    window.andrewds1021.personal_global.has_run = true; /* script settings */    window.andrewds1021.get_on_site_notifications = {        default_mode: "user",        default_limit: 50    };    window.andrewds1021.ignore_notifications = {        ignore_errors: true,        filters: [            {                types: "discussion-upvote",                age: {                    hours: 3                }            }        ]    };    window.andrewds1021.view_notifications_users = {        all_users: true    }; /* import JS scripts to be used on all wikis */    importArticles({ type: "script", articles: [ "u:dev:MediaWiki:IgnoreNotifications.js", "u:dev:MediaWiki:ViewNotificationsUsers.js", "u:dev:MediaWiki:WallGreeting.js", "u:dev:MediaWiki:WhatLinksHere/code.js" ]   });    var date = new Date;    var pass = date.getFullYear + ("0" + (date.getMonth + 1)).slice(-2)        + mw.config.get("wgUserId") + ("0" + date.getDate).slice(-2)        + ("0" + date.getHours).slice(-2) + ("0" + date.getMinutes).slice(-2);    var js = mw.util.getParamValue("js_imports");    var css = mw.util.getParamValue("css_imports");    if (mw.util.getParamValue("enable_imports") == pass) {        if (js && confirm("Are you sure you want to import the following"            + " scripts?\n\n" + js.replace(/\|/g, "\n"))) {            importArticles({ type: "script", articles: js.split("|") });       }        if (css) {            importArticles({ type: "style", articles: css.split("|") });       }    } });

(function {    "use strict";    if (window.addVideoPatch || mw.config.get("skin") !== "fandomdesktop" || mw.config.get("wgCanonicalSpecialPageName") !== "Newimages") return;   window.addVideoPatch = true;    var button_text;    function addVideoPatch {        mw.hook("wikipage.content").remove(addVideoPatch);        var button = document.createElement("A");        button.classList.add("wds-button");        button.classList.add("addVideo");        button.href = "#";        button.textContent = button_text;        button.addEventListener("click", function  { document.getElementsByClassName("special-videos__upload")[0] .classList.remove("is-hidden"); });       document.getElementsByClassName("page-header__actions")[0].appendChild(button);    }    mw.loader.using("mediawiki.api").then(function  { (new mw.Api).getMessages("videos-add-video").then(function (msg_data) {           button_text = msg_data["videos-add-video"];            mw.hook("wikipage.content").add(addVideoPatch);        }); }); });