User:Animum/Sandbox

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
 
//Script by [[User:Animum]] that helps with adding permission templates to Image: and Talk: pages.

importScript('User:Animum/urlparameters.js');
 
addOnloadHook(function() {
    if((wgNamespaceNumber == 1 || wgNamespaceNumber == 6) && UrlParameters["action"] == "edit" && UrlParameters["otrspermission"] == 1) {
        var ticket = prompt("Ticket number:");
        document.editform.wpTextbox1.value = "{{PermissionOTRS\|id\=" + ticket + "}}\n" + document.editform.wpTextbox1.value;
        document.editform.wpMinoredit.checked = false;
        document.editform.wpWatchthis.checked = false;
        document.editform.wpSummary.value = "Adding [[Commons:OTRS|OTRS]] permission information";
        document.editform.submit();
    }
});
 
addOnloadHook(function() {
    if(wgNamespaceNumber == 6 || wgNamespaceNumber == 1) {
        addPortletLink("p-cactions", wgScript + "?title=" + encodeURIComponent(wgPageName) + "&action=edit&otrspermission=1", "otrs", "ca-permissions");
    }
});