User:Prince(ss) Platinum/PageMakerPro.js

//Written by: Prince(ss) Platinum (function($, mw, window) {       var pc = {                /* i18n (localization) */                i18n: {                        "en": {                                formTitle: "Create a New Page",                                formStart: "Create",                                formCancel: "Close",                                formPage: "Special:New_Page",                                formMain: "Main",                                formBlog: "Blog",                                formCat: "Category",                                formMW: "MediaWiki",                                formTemp: "Template",                                formCont: "Page Content",                                formBlank: "Blank",                                formPop: "Populated",                                urlBlog: "User-blog"                        }                },                /* Variables for use in the script */ server: mw.config.get("wgServer"), skin: mw.config.get("skin"), lang: mw.config.get("wgUserLanguage"), page: mw.config.get("wgPageName"), formHTML: '  ' + pc.i18n[pc.lang].formMain + ' ' + pc.i18n[pc.lang].formBlog + ' ' + pc.i18n[pc.lang].formCat + ' ' + pc.i18n[pc.lang].formMW + ' ' + pc.i18n[pc.lang].formTemp + '    ' + pc.i18n[pc.lang].formCont + ': ' + pc.i18n[pc.lang].formblank + ' ' + pc.i18n[pc.lang].formPop + '

',               /* Script functions */ init: function { /* Load buttons based on skin */ if (pc.skin == "oasis" || pc.skin == "wikia") { $(".createpage").click(function(e) {                                       pc.makeForm                                }); } else { if (pc.page != pc.i18n[pc.lang].formPage) { $("input[name=go]").html('' + pc.i18n[pc.lang].formGo + ''); } else { pc.makePage; }                       }                },                makeForm: function { $.showCustomModal(pc.i18n[pc.lang].formTitle, pc.formHTML, {                               id: "page-create",                                width: 650,                                buttons[{                                        id: "page-create-close",                                        message: pc.i18n[pc.lang].formCancel,                                        handler: function {                                                $("#page-create").closeModal;                                        }                                }, {                                        id: "page-create-go",                                        defaultButton: true,                                        message: pc.i18n[pc.lang].formGo,                                        handler: function {                                                pc.redirectWindow;                                        } }]                       });                },                makePage: function {                        $("title").text("Page Create");                        $("#bodyContent").html(pc.formHTML);                        var node = document.createElement("button");                                node.id = "page-create-monobook";                                node.textContent = pc.i18n[pc.lang].formGo;                                node.addEventHandler("click", function { pc.redirectWindow; };                       $("#page-create-fieldset").append($(node)); $("#page-create-monobook").css("float", "right"); },               redirectWindow: function { var namespace = $("input[name=namespace]:checked").val; var target = $("#NewPageTitle").val; var populated = $("input[name=pagecontent]:checked").val; var link; switch (namespace) { case "main": if (populated == "populated") { link = pc.server + '/wiki/' + target + '?action=edit&useFormat=1'; } else { link = pc.server + '/wiki/' + target + '?action=edit'; }                                       break; case "blog": link = pc.server + '/wiki/' + pc.i18n[pc.lang].urlBlog + '' + target + '?action=edit'; break; case "category": link = pc.server + '/wiki/' + pc.i18n[pc.lang].formCat + '' + target + '?action=edit'; break; case "mediawiki": link = pc.server + '/wiki/' + pc.i18n[pc.lang].formMW + '' + target + '?action=edit'; break; case "template": link = pc.server + '/wiki/' + pc.i18n[pc.lang].formTemp + '' + target + '?action=edit'; break; default: break; }                       window.location = link; }       };        $(document).ready(function {                pc.init;        }); }(this.jQuery, this.mediaWiki, this));