User:Tark/common.js: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
(.)
 
mNo edit summary
Line 1: Line 1:
// Begin User info
// Adapted from http://en.wikipedia.org/wiki/w:User:PleaseStand/User_info
// Adapted from http://en.wikipedia.org/wiki/w:User:PleaseStand/User_info
function UserinfoJsFormatQty(qty, singular, plural) {
function UserinfoJsFormatQty(qty, singular, plural) {
     return String(qty).replace(/\d{1,3}(?=(\d{3})+(?!\d))/g, "$&,") + "\u00a0" + (qty == 1 ? singular : plural);
     return String(qty).replace(/\d{1,3}(?=(\d{3})+(?!\d))/g, "$&,") + "\u00a0" + (qty == 1 ? singular : plural);
Line 168: Line 168:
                         statusText += ". Last edited " + UserinfoJsFormatDateRel(lastEdited) + " ago.";
                         statusText += ". Last edited " + UserinfoJsFormatDateRel(lastEdited) + " ago.";
                     }
                     }
                   
 
                     // Other links link
                     // otfwiki links
                     statusText += " Links: ";
                     statusText += " Links: ";
                     statusText += "<a href=\"" + mw.config.get("wgArticlePath").replace("$1", "Special:Block/" + encodeURIComponent(user.name)) + "\">Block user</a>";
                     statusText += "<a href=\"" + mw.config.get("wgArticlePath").replace("$1", "Special:Block/" + encodeURIComponent(user.name)) + "\">Block user</a>";
                     statusText += " &middot; <a href=\"https://wiki.tarkoviski.me/user/portal/" + encodeURIComponent(user.name) + "\">Wiki Stats</a>";
                     statusText += " &middot; <a href=\"https://wikistats.espacore.de/user/portal/" + encodeURIComponent(user.name) + "\">Wiki Stats</a>";


                     var ss = document.getElementById("siteSub");
                     var ss = document.getElementById("siteSub");
                     ss.innerHTML = "<span>" + statusText + "</span>";
                     ss.innerHTML = "<span>" + statusText + "</span>";
                     ss.style.display = "block";
                     ss.style.display = "block";
                 });
                 });
         });
         });
     })
     });
}
// End User info
 
// Begin Purge link
// Adapted from https://www.mediawiki.org/wiki/MediaWiki:Gadget-purgetab.js
if (mw.config.get("wgIsArticle")) {
    mw.util.addPortletLink(
        "p-views",
        mw.util.wikiScript() + "?" + $.param({ title: mw.config.get("wgPageName"), action: "purge" }),
        mw.config.get("skin") === "vector" ? "Purge cache" : "*",
        "ca-purge",
        "Purge the server cache of this page",
        "*"
    );
}
// End Purge link
 
// Begin Clean delete reasons
// Adapted from https://www.mediawiki.org/wiki/MediaWiki:Gadget-CleanDeleteReasons.js
// if (mw.config.get("wgAction") == "delete") {
//    var wpReason = document.getElementById("wpReason");
//    if (wpReason) {
//        var regexp = /(content was|page was empty)/i;
//        if (regexp.test(wpReason.value)) {
//            wpReason.value = "";
//        }
//    }
// }
// End Clean delete reasons
 
// Begin Delete link
if (mw.config.get("wgIsArticle")) {
    mw.util.addPortletLink(
        "p-views",
        mw.util.wikiScript() + "?" + $.param({ title: mw.config.get("wgPageName"), action: "delete" }),
        mw.config.get("skin") === "vector" ? "Deleto" : "*",
        "ca-purge",
        "Purge the server cache of this page",
        "*"
    );
}
}
// End Delete link

Navigation menu