User:BlackZetsu/Interwiki.js

// http://dev.wikia.com/wiki/QuickIW function wikiabar { var wikiabar = $(       'Interwiki'); $(window.WikiaBar.wikiaBarWrapperObj.find('.tools')).append(wikiabar); } function iw { mw.util.addCSS(".modalWrapper{color: #6c93b1;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-background-clip:padding-box!important;background-clip:padding-box!important;background-color:#fff!important;border-radius:8px!important;border:1px solid rgba(0,0,0,.2);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0!important}"); $.showCustomModal('QuickIW',       ' Desired language. (eg: pt-br)  Desired summary. (eg: Adding interwiki)  Desired interwikiname. (eg: Naruto) ', {            id: "cancel",            width: 600,            buttons: [{                message: "Add interwiki",                handler: function {                    addiw;                }            }]        }); } function success { alert("Done!"); $("#cancel").closeModal; location.reload; } function addiw { if ($("#page").val == "") { var wg = mw.config.get("wgPageName"); } else { var wg = $("#page").val; }   var lang = $("#lang").val var interwiki = '\n' + lang + ':' + wg + '' $.post(mw.util.wikiScript('api'), {       format: 'json',        action: 'edit',        summary: $("#summary").val || $("#summary").attr('placeholder'),        title: mw.config.get("wgPageName"),        appendtext: interwiki,        token: mw.user.tokens.get("editToken"),        success: success    }); } $(wikiabar);