User:Ozank Cx/common.js

importScript('User:Ozuzanna/wantedfiles.js'); var c = mw.config.get( [   'wgPageName',    'wgCanonicalSpecialPageName',    'wgNamespaceNumber',    'wgAction' ] ); /* */ /* Add link to chatconnect log */ if (c.wgCanonicalSpecialPageName == "Contributions") $(".chat-ban-log").after(' | Chatconnect log'); /* Custom edit buttons */ if (c.wgAction == "edit") { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/8LkDruM.jpg", "speedTip": "Images", "tagOpen": "", "tagClose": "", "sampleText": "" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/x391w2h.jpg", "speedTip": "Macros", "tagOpen": "", "tagClose": "", "sampleText": "" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/5aBV3vX.jpg", "speedTip": "Signature", "tagOpen": " ", "tagClose": "", "sampleText": "" }; } /* Quick Category Creation */ if (c.wgCanonicalSpecialPageName === "Wantedcategories") { $('.special li').each(function {   $(this).append(' (create)');  }); $('.quick-cat-create').click(function {   var name = $(this).attr('catname'),    content = "Images of " + name.slice(0,-7) + ".\n"; //Regular character categories    if (name.split('/EG').length === 2) //Equestria Girls      content = "Images of " + name.slice(0,-10) + " from My Little Pony Equestria Girls.\n";    createPage("Category:"+name,content);    $(this).remove;  }); } function createPage(title,text) { new mw.Api.post({ action: 'edit',  watchlist: 'nochange',  title: title,  text: text,  token: mw.user.tokens.get('editToken')  }) .done(function(d) {    if (!d.error) {      console.log(title + ' successfully made!');    }    else {      alert('Failed to create ' + title + ': '+ d.error.code);    }		  }) .fail(function {   alert('Failed to create ' + title);  }); } /* */ }) (this.jQuery, this.mediaWiki);
 * (function($, mw) {