User:DuckeyD/global.js

// LastEdited if (wgNamespaceNumber === 0 || wgNamespaceNumber === 2 || wgNamespaceNumber === 4 || wgNamespaceNumber === 14) { // Article, User, Project, Category window.lastEdited = { avatar: false, position: { element: document.getElementById('WikiaMainContent'), method: 'append' }   }; } else if (wgNamespaceNumber === 500) { // UserBlog } else { // MediaWiki, Module, File... window.lastEdited = { avatar: false }; }

// AjaxRC window.ajaxSpecialPages = [ 'Recentchanges', 'WikiActivity', 'Watchlist', 'Log', 'Newpages' ];

// Import importArticles({   type: 'script',    articles: [        'u:dev:AjaxRC/code.js',        'u:dev:MultiUpload/code.js',        'u:dev:NullEditButton/code.js',        'u:dev:PurgeButton/code.js',        'u:dev:LastEdited/code.js',        'u:dev:View Source/code.js',        'u:dev:RevealAnonIP/usercode.js',        'u:dev:LuaError/code.js',        'u:dev:ViewRemoved/code.js',        'u:dev:UserCheck/code.js',        'u:dev:SearchSuggest/code.js',        'u:dev:WhatLinksHere/code.js'    ] });

// Bypass Special:InfoboxBuilder // Author: Vuh if($('.template-classification-type-text').data('type') == 'infobox') { $('#ca-edit').attr('href', function(a) { return this.href + '&useeditor=source'; }); }

// Cat redlinks // Author: Nanaki $('#catlinks .newcategory, #WikiaArticle .newcategory').addClass('new');

// Nav changes $(function {    // Author: Nanaki    $('.wds-community-header__wiki-buttons a[data-tracking="wiki-activity"]').attr({href: '/wiki/Special:RecentChanges', title: 'Ostatnie zmiany', 'data-tracking': 'recent-changes'});    $('.wds-community-header__wiki-buttons a[data-tracking="more-recent-changes"]').attr({href: '/wiki/Special:WikiActivity', 'data-tracking': 'more-wiki-activity'}).text('Aktywność na wiki');    // Author: DuckeyD    $('.wds-community-header__wiki-buttons a[data-tracking="more-all-shortcuts"]').parent.remove;    if (mw.config.get('wgNamespaceNumber') === 10) {        $('.page-header__contribution-buttons .wds-list').append( $('').append($('', { 'href': '/wiki/Special:Log?type=templateclassification&user=&page=&year=&month=-1&page=' + mw.config.get('wgPageName') }).text('Historia typu')) )   }    // Author: Luqgreg (HEAVILY modified by DuckeyD)    $('.wds-community-header__wiki-buttons .wds-list').append([ $('', { 'class': 'wds-dropdown-level-2 wds-is-sticked-to-parent' }).append([           $('', { 'class': 'wds-dropdown-level-2__toggle' }).append([ $(' ').text('VAN'), $(' ') ]),           $(' ', { 'class': 'wds-is-not-scrollable wds-dropdown-level-2__content' }).append( $('', { 'class': 'wds-list wds-is-linked' }).append([                   $('').append($('', { 'href': '/wiki/Special:Insights/nonportableinfoboxes' }).text('S:I/NPI')),                    $('').append($('', { 'href': '/wiki/Special:Insights/templateswithouttype' }).text('S:I/UT')),                    $('').append($('', { 'href': '/wiki/Special:Log?type=templateclassification&user=&page=&year=&month=-1' }).text('S:L/TC')),                    $('').append($('', { 'href': '/wiki/Special:AllInfoboxes' }).text('S:AI')),                    $('').append($('<a>', { 'href': '/wiki/Special:Templates' }).text('S:T')),                    $('<li>').append($('<a>', { 'href': '//portability.wikia.com/wiki/Special:PortabilityDashboard?url=' + window.location.hostname }).text('S:PD')) // Author: Railfail536                ]) )       ]),        $('<li>', { 'class': 'wds-dropdown-level-2 wds-is-sticked-to-parent' }).append([            $('<a>', { 'class': 'wds-dropdown-level-2__toggle', 'href': '/wiki/Special:Search?search=.css&ns8=1' }).append([ $(' ').text('MW/*.css'), $('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" class="wds-icon wds-icon-tiny wds-dropdown-chevron" id="wds-icons-menu-control-tiny"><path d="M6.003 10.002a.997.997 0 0 1-.707-.293L.293 4.707a.999.999 0 1 1 1.414-1.414l4.296 4.295 4.293-4.293A.999.999 0 1 1 11.71 4.71l-5 5a.997.997 0 0 1-.707.293" fill-rule="evenodd"> ') ]),           $(' ', { 'class': 'wds-is-not-scrollable wds-dropdown-level-2__content' }).append( $('<ul>', { 'class': 'wds-list wds-is-linked' }).append([                   $('<li>').append($('<a>', { 'href': '/wiki/MediaWiki:Wikia.css' }).text('Wikia.css')),                    $('<li>').append($('<a>', { 'href': '/wiki/MediaWiki:Common.css' }).text('Common.css')),                    $('<li>').append($('<a>', { 'href': '/wiki/MediaWiki:Themes.css' }).text('Themes.css'))                ]) )       ]),        $('<li>', { 'class': 'wds-dropdown-level-2 wds-is-sticked-to-parent' }).append([            $('<a>', { 'class': 'wds-dropdown-level-2__toggle', 'href': '/wiki/Special:Search?search=.js&ns8=1' }).append([ $(' ').text('MW/*.js'), $('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" class="wds-icon wds-icon-tiny wds-dropdown-chevron" id="wds-icons-menu-control-tiny"><path d="M6.003 10.002a.997.997 0 0 1-.707-.293L.293 4.707a.999.999 0 1 1 1.414-1.414l4.296 4.295 4.293-4.293A.999.999 0 1 1 11.71 4.71l-5 5a.997.997 0 0 1-.707.293" fill-rule="evenodd"> ') ]),           $(' ', { 'class': 'wds-is-not-scrollable wds-dropdown-level-2__content' }).append( $('<ul>', { 'class': 'wds-list wds-is-linked' }).append([                   $('<li>').append($('<a>', { 'href': '/wiki/MediaWiki:ImportJS' }).text('ImportJS')),                    $('<li>').append($('<a>', { 'href': '/wiki/MediaWiki:Wikia.js' }).text('Wikia.js')),                    $('<li>').append($('<a>', { 'href': '/wiki/MediaWiki:Common.js' }).text('Common.js'))                ]) )       ]),        $('<li>', { 'class': 'wds-dropdown-level-2 wds-is-sticked-to-parent' }).append([            $('<a>', { 'class': 'wds-dropdown-level-2__toggle', 'href': '/wiki/Special:MyPage' }).append([ $(' ').text('S:MP'), $('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" class="wds-icon wds-icon-tiny wds-dropdown-chevron" id="wds-icons-menu-control-tiny"><path d="M6.003 10.002a.997.997 0 0 1-.707-.293L.293 4.707a.999.999 0 1 1 1.414-1.414l4.296 4.295 4.293-4.293A.999.999 0 1 1 11.71 4.71l-5 5a.997.997 0 0 1-.707.293" fill-rule="evenodd"> ') ]),           $(' ', { 'class': 'wds-is-not-scrollable wds-dropdown-level-2__content' }).append( $('<ul>', { 'class': 'wds-list wds-is-linked' }).append([                   $('<li>').append($('<a>', { 'href': mw.config.get('wgContentLanguage') === 'pl' ? '/wiki/Special:MyPage/brudnopis' : '/wiki/Special:MyPage/Sandbox' }).text(mw.config.get('wgContentLanguage') === 'pl' ? 'brudnopis' : 'Sandbox')),                    $('<li>').append($('<a>', { 'href': '/wiki/Special:MyPage/wikia.js' }).text('wikia.js')),                    $('<li>').append($('<a>', { 'href': '/wiki/Special:MyPage/common.js' }).text('common.js'))                ]) )       ]),        $('<li>', { 'class': 'wds-dropdown-level-2 wds-is-sticked-to-parent' }).append([            $('<a>', { 'class': 'wds-dropdown-level-2__toggle' }).append([ $(' ').text('Tools'), $('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" class="wds-icon wds-icon-tiny wds-dropdown-chevron" id="wds-icons-menu-control-tiny"><path d="M6.003 10.002a.997.997 0 0 1-.707-.293L.293 4.707a.999.999 0 1 1 1.414-1.414l4.296 4.295 4.293-4.293A.999.999 0 1 1 11.71 4.71l-5 5a.997.997 0 0 1-.707.293" fill-rule="evenodd"> ') ]),           $(' ', { 'class': 'wds-is-not-scrollable wds-dropdown-level-2__content' }).append( $('<ul>', { 'class': 'wds-list wds-is-linked' }).append([                   $('<li>').append($('<a>', { 'href': '/wiki/Special:BlankPage?blankspecial=MultiUpload' }).text('MultiUpload')),                    $('<li>').append($('<a>').text('CreateUserPage').click(function {                        // Author: DuckeyD                        // Based on: QuickCreateUserPage                        var pageContent = ;                        var pageTitle = 'User:' + mw.config.get('wgUserName');                        switch (mw.config.get('wgContentLanguage')) {                            case 'pl':                                pageContent = ;                                break;                            case 'de':                                pageContent = ;                                break;                            default:                                pageContent = ; break; }                       var api = new mw.Api; api.get({                           action: 'query',                            prop: 'info',                            titles: pageTitle                        }).done(function(data) {                            var	id = Object.keys(data.query.pages)[0];                            if (id === '-1' || data.query.pages[id].length === 0) {                                api.post({ action: 'edit', title: pageTitle, text: pageContent, token: mw.user.tokens.get('editToken') }).done(function(data) { if (data.edit.result === 'Success') { new BannerNotification('Utworzono stronę użytkownika.', 'confirm').show; } else { new BannerNotification('Nie można utworzyć strony użytkownika.', 'error').show; }                               }).fail(function { new BannerNotification('Nie można utworzyć strony użytkownika.', 'error').show; });                           } else {                                new BannerNotification('Strona użytkownika już istnieje.').show;                            }                        }); }))               ])            )        ])    ]); });