MediaWiki:UserDropdown/code.js

if($.inArray('sysop',wgUserGroups) != -1) { function getUserDropdownLinks(callback) { $.get('/api.php?action=query&prop=revisions&rvlimit=1&rvprop=content&titles=MediaWiki:Custom-User-Dropdown&format=json&v=1.1').done(callback); $('#WikiaArticle').append(mw.message( 'Custom-User-Dropdown', 5 ).text); }

getUserDropdownLinks(function(data) {       var liste = $(' ');        var content = data.query.pages[Object.keys(data.query.pages)[0]].revisions[0]['*'];        var links = content.split('\n');        for(i = 0; i < links.length; i++) {            //here follows code for js-links...            links[i] = links[i].replace( /\n?\*\s?\|(.+)/, '$2 ' );           links[i] = links[i].replace( /\n?\*\s?(.+)[|](.+)\n?/g, '$2' );           links[i] = links[i].replace( /\n?\*\s?(http:\/\/(.+))[ ](.+)\n?/, '$3' );       }        //Edit Button        $('.Wall.Thread ul.comments ul.replies li.SpeechBubble.message').each(function(key, val) { /* Variablen */ answer = $(val).find('.speech-bubble-message .MiniEditorWrapper'); user = answer.find('.edited-by a').text; msgContent = answer.find('.msg-body').html; buttons = answer.find('.msg-toolbar .buttonswrapper .buttons'); console.log(key,user); /* Button erzeugen */ adminButton = $(' ').addClass('wikia-menu-button secondary combined edit-user').text('Benutzer').append(               $(' ').addClass('drop').append( $(' ').addClass('chevron').attr('src','data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D') ),               $(' ').addClass('WikiaMenuElement').css('min-width','51px')            ).click(function {                $(this).addClass('active');            }).on('keyup keypress blur mouseleave', function {                $(this).removeClass('active');              }).appendTo(buttons); currentLinks = []; for(n = 0; n < links.length; n++) { currentLinks[n] = links[n].replace(//g,user); adminButton.find('ul.WikiaMenuElement').append(currentLinks[n]); }       });    }); }