MediaWiki:Gadget-MoveUtil.js: Difference between revisions

From Elwiki
mNo edit summary
mNo edit summary
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
if(wgNamespaceNumber == -1 && /MovePage(\/.+)?/.test(wgTitle)){
     console.log('__MOVEUTIL_LOG__');
     if($('#mw-movepage-table').length){
        $('#wpMovetalk').attr('checked', 'checked');
        $('#wpLeaveRedirect').removeAttr('checked');
        $('#wpMovesubpages').attr('checked', 'checked');
        /* Bind to Submit Event */
        $('#movepage').submit(function(event){
            alert('.submit called');
            var from, ns, to, wiki, api, new_wiki;
            api = new mw.Api();
 
            from = $('#mw-movepage-table strong').first().text();
            ns = api.mw.config.get('wgFormatteNamespaces', wgFormattedNamespaces);
            ns = ns[$('#wpNewTitleNs').val()];
            to = $('#wpNewTitleMain').val();
 
            /* Add Line in MoveList */
            api.postWithToken('edit', {
                'minor': '',
                'recreate': '',
                'bot': '',
                'action': 'edit',
                'title': 'User:Boxsnake/MoveList',
                'summary': 'Bot Adding From Page Move. --[[Special:Gadgets|Move Util]]',
                'contentmodel': 'wikitext',
                'appendtext': from + ' -> ' + (ns == '' ? '' : ns + ':') + to
            }).done(function(){
                // $('#movepage').submit();
            });
            event.preventDefault();
        });
    }
}

Latest revision as of 04:07, 2 December 2015

    console.log('__MOVEUTIL_LOG__');