×
Create a new article
Write your page title here:
We currently have 30 articles on Ghost Machine Wiki. Type your article name above or create one of the articles listed here!



    Ghost Machine Wiki

    Note: After publishing, you may have to bypass your browser's cache to see the changes.

    • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
    • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
    • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
    • Opera: Press Ctrl-F5.
    /*
     * AjaxRedirect
     * @description Redirects the current page quickly.
     * @author Ozuzanna
     */
    
    mw.loader.using([
        'mediawiki.api',
        'mediawiki.user'
    ], function() {
        var config = mw.config.get([
            'wgCanonicalNamespace',
            'wgCanonicalSpecialPageName',
            'wgPageName'
        ]);
        if (
            config.wgCanonicalNamespace === "Thread" ||
            config.wgCanonicalSpecialPageName ||
            window.AjaxRedirectLoaded
        ) {
            return;
        }
    
        window.AjaxRedirectLoaded = true;
    
        function respHandler(res) {
            if (res === true) {
                console.log('Redirect successfully made!');
                new BannerNotification('Redirect successfully made!', 'confirm').show();
                setTimeout(function() {
                    window.location.reload();
                }, 3000);
            } else {
                console.log('Failed to edit page!');
                new BannerNotification('Failed to edit page!', 'error').show();
            }
        }
    
        function click() {
            var redir = prompt('Please enter the page you want to redirect to:');
    
            if (!redir) {
                console.log('You need to specify the page to redirect to!');
                return;
            }
    
            new mw.Api().post({
                action: 'edit',
                watchlist: 'nochange',
                title: config.wgPageName,
                text: '#REDIRECT [[' + redir.charAt(0).toUpperCase() + redir.slice(1) + ']]',
                token: mw.user.tokens.get('editToken')
            }).done(function(d) {
                respHandler(!d.error);
            }).fail(function() {
                respHandler(false);
            });
        }
    
        function init() {
            $('#cosmos-actionsList-list').first().append(
                $('<li>').attr('id', 'ca-redirect').append(
                    $('<a>', {
                        css: {
                            cursor: 'pointer'
                        },
                        text: 'Ajax Redirect',
                        click: click
                    })
                )
            );
        }
        init();
    });
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.