User:50000cal/global.js

// Delay Settings batchDeleteDelay = 600; massCategorizationDelay = 600; nullEditDelay = 600; WHAMDelay = 600; massRenameDelay = 600; // Quick Deletion var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Clean-up', 'label': 'Clean-up'}; $(window).load(function {   importScriptPage('User:Dorumin/WHAM', 'starmanw');    if ( $("#backtotop").length ) { // Damn back to top button        mw.util.addCSS('#displayTimer { position: absolute;  margin-left: 700px; }');    }    switch( wgCanonicalNamespace ) {        case 'User':        case 'User_talk':        $('.UserProfileActionButton .wikia-menu-button').css('margin-left','24px').appendTo('.UserProfileActionButton');        break;    }    $('.UserProfileActionButton .wikia-button').show; }); /****************** Import scripts ******************/ importArticles({   type: 'script',    articles: [        'u:starmanw:MultiUpload/code.js',        'u:dev:AjaxBatchDelete/code.js',        'u:dev:ChatTimestamps/code.js',        'u:dev:DisplayTimer/code.js',        'u:dev:DupImageList/code.js',        'u:dev:FastDelete/code.js',        'u:dev:FindAndReplace/code.js',        'u:dev:ListFiles/code.js',        'u:dev:MassCategorization/code.js',        'u:dev:MassNullEdit/code.js',        'u:dev:PrivateMessageAlert/code.js',        'u:dev:QuickComments/code.js',        'u:dev:QuickDiff/code.js',        'u:dev:MediaWiki:FileUsageAuto-update/code.js'    ] }); importScriptPage('MediaWiki:ViewRemoved/code.js', 'dev'); window.ajaxRefresh = 1000; window.ajaxPages = [ "Special:WikiActivity", "Special:RecentChanges", "Special:Log", "Special:Log/upload", "Special:Images", "Special:Video" ];

$('.toolbar .tools').children('.mytools').after('  My Pages'); $('.custom-menu, .custom-tools-menu').hover(function {   $('.custom-tools-menu').css('display', 'block'); }, function {    setTimeout(function { if(!$('.custom-tools-menu').is(':hover') && !$('.custom-menu').is(':hover')) { $('.custom-tools-menu').css('display', 'none'); }   }, 1000); });

//Userpage $('').html('User Page') .prependTo('#my-pages-menu') .click(function {   $.ajax( { type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:50000cal', summary: 'Creating userpage', text: '{{w:User:50000cal', format: 'json', token: mw.user.tokens.get( 'editToken' ) }   } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; } else { new BannerNotification("An error occurred.","error").show; }   } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; } ); });

//New Page $(function {   $('').html('New Page')        .prependTo('#my-pages-menu')        .click(function { $.showCustomModal('New Page', ' Please specify the Page name. 

Page\'s Content \

Summary:  ', { id: 'npModal', buttons: [{ id: 'createPage', defaultButton: true, message: 'Create', handler: function { var pagename = $('#pagename').val; var pagecontent = $('#pagecontent').val; var summary = $('#summary').val; new mw.Api.post({                           action: 'edit',                            title: pagename,                            summary: summary,                            text: pagecontent,                            format: 'json',                            createonly: true,                            token: mw.user.tokens.get('editToken')                        }).done(function(data) {                            if (data.edit.result === 'Success') {                                new BannerNotification("Successfully created page!", "confirm").show;                            } else {                                new BannerNotification("An error occurred.", "error").show;                            }                        }).fail(function(data) {                            new BannerNotification("An error occurred.", "error").show;                        }); }               }, {                    id: 'pnCancel', defaultButton: true, message: 'Cancel', handler: function { $('#pnModal').closeModal; }               }]            });        }); });

//Open Page $(function {   $('').html('<a href="#">Open Page</a>')        .prependTo('#my-tools-menu')        .click(function { $.showCustomModal('Open Page', ' Please specify the page name. <input id="page-name" type="text" size="50"> ', {               id: 'opModal',                buttons: [{                    id: 'openPage',                    defaultButton: true,                    message: 'Open',                    handler: function {                    var page = $('#page-name').val;                    var open = '/wiki/' + page;                    window.open(open, '_self');            }                }, {                    id: 'opCancel',                    defaultButton: true,                    message: 'Cancel',                    handler: function {                        $('#opModal').closeModal;                    }                }]            }); }); });