×
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.
    /**
     * Ajax Fast Delete
     *
     * @author Splarka
     * @author Uberfuzzy
     * @author Grunny
     *
     * @version 2.6
     */
    ;(function($, mw, window) {
        window.dev = (window.dev || {});
     
        // Don't load twice...
        if (window.dev.ajaxFastDelete !== undefined) {
            return false;
        }
     
        var conf = mw.config.get([
                'wgNamespaceNumber',
                'wgPageName',
                'wgVersion'
            ]),
            isUCP = conf.wgVersion !== '1.19.24';
     
        function init() {
            var self = {
                version: '2.6',
                init: function() {
                    if (
                        conf.wgNamespaceNumber === -1 ||
                        !window.fdButtons ||
                        (conf.wgNamespaceNumber === 2 && isUCP && $(".noarticletext").length) ||
                        (conf.wgNamespaceNumber != 2 && isUCP && !$('#ca-delete').length) ||
                        !isUCP && !$('#ca-delete').length
                    ) return;
                    var deleteButtons = '',
                        $profile;
                    if (isUCP) {
                        $profile = $('.ns-2 .page-header__contribution-buttons');
                    } else {
                        $profile = $('.UserProfileActionButton');
                    }
                    var deleteBtns = window.fdButtons.map(function(b) {
                        var sum = b.summary,
                            cssBtns;
                        if (isUCP) {
                            cssBtns = 'wds-button';
                        } else {
                            cssBtns = $profile.length ? 'wikia-button' : 'wds-button';
                        }
                        return '<a class="' + cssBtns + '" title="one-click delete: ' + sum + '" data-summary="' + sum + '" data-id="fastdelete">' + b.label + '</a>';
                    }).join('&nbsp;');
                    deleteButtons = '<span id="FastDeleteBtns">' + deleteBtns + '</span>';
     
                    if ($profile.length) {
                        $profile.append(deleteButtons);
                    } else if (!isUCP && $('.page-header__subtitle-blog-post').length) {
                        $('.page-header__subtitle-blog-post').append(deleteButtons);
                        $('.page-header__blog-post-details').css('margin-right', '5px');
                    } else {
                        $('#cosmos-header-articleHeader').append(deleteButtons);
                        mw.util.addCSS('a[data-id="fastdelete"]:nth-child(1){margin-left:5px}');
                        mw.util.addCSS('#cosmos-header-articleHeader #FastDeleteBtns > a:not(:first-child) {margin-left: -5px;}');
                    }
     
                    if ($('a[data-id="fastdelete"]').length) {
                        $('a[data-id="fastdelete"]').click(function() {
                            if (window.FastDeleteNoConfirm || confirm('Are you sure you want to delete this page?') === true) {
                                self.deletePage($(this).attr('data-summary'));
                            } else {
                                return;
                            }
                        });
                    }
                    mw.hook('fastdelete.init').fire(deleteButtons);
                },
                deletePage: function(deleteReason) {
                    (new mw.Api())
                    .post({
                            action: 'delete',
                            title: conf.wgPageName,
                            reason: deleteReason,
                            token: mw.user.tokens.get(isUCP ? 'csrfToken' : 'editToken')
                        })
                        .done(function(res) {
                            location.reload();
                        });
                }
            };
     
            window.dev.ajaxFastDelete = self;
     
            mw.loader.using(['mediawiki.util', 'mediawiki.api'], function() {
                $(self.init);
            });
        }
     
        init();
         
    })(jQuery, mediaWiki, window);
    
    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.