User:Dominic1743/global.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:QuickLogs/code.js',    ] }); var MessageBlock = { title : 'Blocked', message : 'You have been blocked for $2 for $1.', autocheck : true }; importArticles({   type: 'script',    articles: [        'u:dev:MessageBlock/code.js'    ] }); importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxEdit.js',    ] }); /* Redirect to base page if ends with '/' */ if (window.location.href.match("/$")) { window.location.href = window.location.href.slice(0, -1); } /* Disable 5 sec edit save delay */ GlobalTriggers.bind("WikiaEditorReady", function(point) {   if (point.controls) {        point.controls.editform.off("submit").on("submit", function { point.setState(3); });   } }); /* Standard Edit Summary config */ window.dev = window.dev || {}; window.dev.editSummaries = { select: [ '(click to browse)', 'Quick', [ 'Credit to the wikia watchers', 'Redlink removal', 'Duplicate image', 'Removing vandalism', 'Fixing error(s)', 'Corrected spelling/grammar', 'Corrected formatting/layout' ],       'General', [ 'Testing', 'Testing (will revert shortly if fails)', 'Testing complete', 'Added/removed/corrected wikilink(s)', 'Added/removed/corrected interwiki link(s)', 'Added/removed/corrected external link(s)', 'Cleanup', 'Comment', 'Correction(s), coding', 'Expanded', 'Formatting', 'Grammar', 'Headings (adjusting, etc.)', 'HTML &rarr; wikicode', 'Layout', 'Mini-wikifying', 'Punctuation', 'Redlink removal', 'Refactoring', 'Removing RTE refuse', 'Re-ordering/re-organizing', 'Reply', 'Revised', 'Signing', 'Spelling', 'Style/layout', 'Suggestion', 'Tidying', 'Updating', 'Wikifying', 'Factual correction', 'Added/removed/corrected sources/appearances' ],       'Removal/Reversion', [ 'Reverted vandalism', 'Reverted test edit', 'Reverted vanity edit', 'Removed fanon', 'Removed libel/slander', 'Removed copyvio', 'Removed spam' ],       'Templates', [ 'Added/removed/corrected template(s)', 'Added/removed/corrected infobox(es)', 'Substituting template(s)', ],       'Categories', [ 'Added category(ies)', 'Alphabetised category(ies)', 'Creating Category page', 'Modified category(ies)', 'Removed category(ies)', 'Removed defunct category(ies)', 'Removed duplicate category(ies)' ],       'Images/Files', [ 'Adding image(s)', 'Modifying image(s)' ]   ] }; /* Show bot edits on RecentChanges */ if (wgPageName == "Special:RecentChanges") { if (window.location.href.indexOf("hidebots=") == -1 && window.location.href.indexOf("?") == -1) { window.location.href = window.location.href + "?hidebots=0"; } else if (window.location.href.indexOf("hidebots=") == -1 && window.location.href.indexOf("?") !== -1) { window.location.href = window.location.href + "&hidebots=0"; } } else if (wgPageName == "Special:Newwikis") { if (window.location.href.indexOf("language=") == -1 && window.location.href.indexOf("?") == -1) { window.location.href = window.location.href + "?language=en"; } else if (window.location.href.indexOf("language=") == -1 && window.location.href.indexOf("?") != -1) { window.location.href = window.location.href + "&language=en"; } } /* Block links */ $(function {   if ($('#UserProfileMasthead').length) {        $('.tag-container').after('Block');    }    // Threads    if (wgNamespaceNumber != 1201) return;    for (var i in $('.msg-toolbar')) {        var usr = $('.msg-toolbar:eq(' + i + ')').parent.find('.edited-by a').text;        $('.msg-toolbar:eq(' + i + ')').find('.WikiaMenuElement li').last.before('Block');    } }); /* Add gender tag to global masterhead */ $(function {   if($("#UserProfileMasthead").length === 0) {        return;    }    mw.loader.using('mediawiki.api').then(function { new mw.Api.get({           action: 'parse',            text: ''        }).done(function(d) {            if(d.parse.text['*'].indexOf('thisisjustsomethingstupid') === -1) {                $('.masthead-info hgroup').append(' ' + d.parse.text['*'] + ' ');            }        }); }); }); /* Create user page on link click */ $('', {id: 'qcup',}) .html('Create user page') //create the link .prependTo('#my-tools-menu') //put it in the toolbar .click(function { //when clicked   $.ajax( { //create the userpage type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:Dominic1743', //at this page summary: 'Creating user page (script)', //with this edit summary text: '', //using this tempalte format: 'json', token: mw.user.tokens.get( 'editToken' ) }   } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created user page!","confirm").show; //say we created the page } else { new BannerNotification("An error occurred while creating user page.","error").show; //say we didn't create the page }   } ).fail( function ( data ) { new BannerNotification("An error occurred while creating user page.","error").show; //say we didn't create the page } ); }); /* Create message wall greeting on link click */ $.ajax({   type: 'HEAD', //see if    url: wgServer + '/wiki/Message_Wall:Dominic1743', //my message wall exists    success: function { //if it exists        $('', {id: 'qcmwg',})        .html('Create Greeting') //create the link        .prependTo('#my-tools-menu') //put it in the my tools menu on the toolbar        .click(function { //when clicked $.ajax( { //create the message wall greeting           type: 'POST',            url: mw.util.wikiScript( 'api' ),            dataType: 'json',            data: {                action: 'edit',                title: 'Message_Wall_Greeting:Dominic1743', //at this page                summary: 'Creating message wall greeting (script)', //with this edit summary                text: '', //using this template                format: 'json',                token: mw.user.tokens.get( 'editToken' )            }            } ).done( function ( data ) {                if ( data.edit.result === 'Success' ) {                    new BannerNotification("Successfully created message wall greeting!","confirm").show; //say we created the page                } else {                    new BannerNotification("An error occurred creating while message wall greeting.","error").show; //say we didn't create the page }           } ).fail( function ( data ) { new BannerNotification("An error occurred while creating message wall greeting.","error").show; //say we didn't create the page } );       });    },    error: function { //if it doesn't exist return; //do nothing } }); /* Revert buttons */ //@author-Prince(ss)_Platinum (http://community.wikia.com/wiki/User:Prince(ss)_Platinum/vda.js) // Reverting tools V6.6 Gold (Original coding by VegaDark, modified by Ajraddatz and Manyman) function getElementsByClass(searchClass,node,tag) { // Function from http://www.dustindiaz.com/getelementsbyclass/  var classElements = new Array;  if ( node === null )    node = document;  if ( tag === null )    tag = '*';  var els = node.getElementsByTagName(tag);  var elsLen = els.length;  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");  for (i = 0, j = 0; i < elsLen; i++) {    if ( pattern.test(els[i].className) ) {      classElements[j] = els[i];      j++;    }  }  return classElements; } // _GET code from NoGray JS Library http://www.nogray.com/new_site/ var _GET = new Array; var _uri = location.href; var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&"); var _temp_get_arr_1 = new Array; for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){ _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("="); _GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]); } delete _uri; delete _temp_get_arr; delete _temp_get_arr_1; function getMessage (where, user1, user2) { var message = prompt ('Enter undo message below:', ''); window.location = 'http://'+ location.hostname + '/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message; } function AGFMessage (where, user1, user2) { var message = prompt ('Enter undo message below:', ''); window.location = 'http://'+ location.hostname + '/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=3&user1='+user1+'&user2='+user2+'&message='+message; } addOnloadHook(function { if (location.href.match(/diff=/)) {    // Get username of submitter    var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1[0].getElementsByTagName('a')[2].innerHTML;    var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[3].innerHTML;    $('#mw-content-text').prepend(' ');    document.getElementById('vda-cont').innerHTML = 'Custom Speculation</a></b> <b>Revert (Vandalism)</a> </b> <b>Revert (Good faith)</a> </b> <b>Revert (Spam)</a> </b>' + ; } else if (location.href.match(/revert=1/)) {    document.getElementById('wpSummary').value = 'Reverted Vandalism by $1 (talk | block) to last version by $2';    document.getElementById('editform').submit;  } else if (location.href.match(/revert=6/)) {    document.getElementById('wpSummary').value = 'Reverted good faith edits';    document.getElementById('editform').submit;  } else if (location.href.match(/revert=3/)) {    document.getElementById('wpSummary').value = 'Speculation';    document.getElementById('editform').submit;  } else if (location.href.match(/revert=2/)) {    document.getElementById('wpSummary').value =  +_GET['message']+ '';    document.getElementById('editform').submit; } else if (location.href.match(/revert=4/)) { document.getElementById('wpSummary').value = 'Reverted spam'; document.getElementById('editform').submit; } }); /* Imports */ window.batchDeleteDelay = 100; importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:CategoryRenameAuto-update/code.js', 'u:dev:MediaWiki:FastDelete/code.js', 'u:dev:MediaWiki:CacheCheck/code.js', 'u:dev:MediaWiki:MarkBlocked.js', 'u:dev:MediaWiki:LastEdited/code.js', 'u:dev:MediaWiki:AjaxUndo/code.js', 'u:dev:MediaWiki:PageCreator/code2.js', ] });