MediaWiki:ReportS.js

/* @ Created By Lil' Miss Rarity, customized by Joeytje50 (i18n compatibility upgrade and dropdown languages) @ Some functions added by Jr Mime (pop-up layout, variables) @ Adapted to VSTF by VegaDark @ License: CC-BY-NC-SA // Variables for later on // Keep these in an object for organization var spa = { edittoken: mw.user.tokens.values.editToken, namespace: mw.config.get('wgNamespaceNumber'), pagename: mw.config.get('wgPageName'), server: mw.config.get('wgServer'), signature:  + , language: mw.config.get('wgUserLanguage'), username: mw.config.get('wgUserName') }; // Add buttons if(spa.pagename === "Report:Spam") { var buttonappend = 'Report Spam'; document.getElementById("lang-EN").innerHTML = buttonappend; } // This opens the form for the users to fill out function openFormSpam { $.showCustomModal('Report Spam', ' Wiki Name    Wiki URL  http://  .wikia.com  Spammer    Reason     ', {        id: "requestWindow",        width: 650,        buttons: [{            id: "cancel",            message: "Cancel",            handler: function  {                cancelformSpam;            }        }, {            id: "submit",            defaultButton: true,            message: "Save",            handler: function  { submitformSpam; }       }]    }); } // Closes the form function cancelformSpam {    $("#requestWindow").closeModal; } // Submits the form function submitformSpam { console.log('Saving...');    var $form = $('#spam'),        wikiname = $form.find('#wikiname').val,        url = $form.find('#wikiurl').val,        user = $form.find('#user').val,        comments = $form.find('#comment').val,        page = '*Wiki: http://' + url + '.wikia.com\n*Spammer: http://' + url + '.wikia.com/wiki/Special:Contributions/' + encodeURIComponent(user.replace(/ /g, "_")) + '\n*Reason: ' + comments + '\n*Signature: ' + spa.signature + '';    // If url or header is blank, return alerts    if (!url) {        alert('You forgot the wiki!');        return;    }    if (!wikiname) {        alert('You forgot the wikiname!');        return;    }    if (!user) {        alert('You forgot the spammer!');        return; }   if ( url.match( /(\/| |%20|_)/ ) ) { alert('Incorrectly entered the Wiki URL. Please do NOT copy/paste the URL, but just type in the suddomain (ie VSTF in http://vstf.wikia.com/wiki/Report:Spam_filter_problems) Do NOT use spaces, use dashes (-) instead'); return; } console.log('Checking...'); // Ajax URL var url = spa.server + '/api.php?action=edit&title=Report:Spam&section=new&sectiontitle=' + wikiname + '&text=' + encodeURIComponent(page) + '&summary=New+spam+report+(' + wikiname + ', ' + user + ')&token=' + encodeURIComponent(spa.edittoken); console.log('Got the url: ',url); $.post(url, function (r) { console.log('Should be done now:',r);	cancelformSpam;       window.location.reload;    }); console.log('Sent request...'); } /* */